Skip to content

Commit

Permalink
Fix two issues
Browse files Browse the repository at this point in the history
1. Fix undefine error of variable arch
2. Make sure enough huge page memory is allocated for specific host numa node

Signed-off-by: liang-cong-red-hat <[email protected]>
  • Loading branch information
liang-cong-red-hat committed Jan 27, 2025
1 parent 5552930 commit ccdc124
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions libvirt/tests/src/numa/guest_numa.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ def dynamic_node_replacement(params, numa_info, test_obj):
key_names = ['memnode_nodeset_', 'page_nodenum_']
for param in params:
if 'numa_cells_with_memory_required' in param:
arch = platform.machine()
if 'ppc64' in arch:
if not node_list:
test_obj.cancel("No NUMA nodes available on this system to perform the test.")
Expand Down Expand Up @@ -291,6 +292,20 @@ def _update_qemu_conf():
deallocate = True
hp_cl.target_hugepages = hugepage_num
hp_cl.set_hugepages()
# for strict mode, allocate the guest numa cell again to
# make sure it has enough huge page
numa_hugepage_dict = {}
if numa_memnode and numa_memnode[0]['mode'] == 'strict':
if numa_cell:
for cell in numa_cell:
if cell['id'] == numa_memnode[0]['cellid']:
numa_hugepage_dict['node'] = numa_memnode[0]['nodeset']
numa_hugepage_dict['hp_num'] = int(
cell['memory']) // default_mem_huge_page_size
numa_hugepage_dict['hp_size'] = default_mem_huge_page_size
if numa_hugepage_dict:
hp_cl.set_node_num_huge_pages(
numa_hugepage_dict['hp_num'], numa_hugepage_dict['node'], numa_hugepage_dict['hp_size'])
if page_list:
hp_size = [h_list[p_size]['size'] for p_size in range(len(h_list))]
multi_hp_size = hp_cl.get_multi_supported_hugepage_size()
Expand Down

0 comments on commit ccdc124

Please sign in to comment.