Skip to content

Commit

Permalink
Merge pull request autotest#5348 from hs0210/memory_misc_enable_arm
Browse files Browse the repository at this point in the history
memory_misc: Enable test for aarch64
  • Loading branch information
Yingshun authored Dec 18, 2023
2 parents 6edd654 + 2480aeb commit 0ed5b0d
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 13 deletions.
20 changes: 17 additions & 3 deletions libvirt/tests/cfg/memory/memory_misc.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
numa_node_size = 512000
cpu_attrs = {'numa_cell': [{'id': '0', 'cpus': '0-7', 'memory': '${numa_node_size}', 'unit': 'KiB'}, {'id': '1', 'cpus': '8-15', 'memory': '${numa_node_size}', 'unit': 'KiB'}]}
mem_device_attrs = {'source': {'pagesize_unit': 'KiB', 'pagesize': 2048, 'nodemask': '0'}, 'mem_model': 'dimm', 'target': {'size': 131072, 'node': 1, 'size_unit': 'KiB'}}
aarch64:
mem_device_attrs = {'source': {'pagesize_unit': 'KiB', 'pagesize': 524288, 'nodemask': '0'}, 'mem_model': 'dimm', 'target': {'size': 524288, 'node': 1, 'size_unit': 'KiB'}}
- nodeset_specified:
no s390-virtio
pagesize = 1048576
Expand All @@ -58,19 +60,29 @@
no s390-virtio
pagesize = 2048
pagenum = 5120
aarch64:
pagesize = 524288
pagenum = 20
vm_attrs = {'max_mem_rt': 83886080, 'max_mem_rt_slots': 8, 'max_mem_rt_unit': 'KiB', 'memory': 20971520, 'memory_unit': 'KiB', 'current_mem': 20971520, 'current_mem_unit': 'KiB'}
mem_backing_attrs = {'hugepages': {}}
cpu_attrs = {'numa_cell': [{'id': '0', 'cpus': '0-1', 'memory': '19922944', 'unit': 'KiB', 'discard': 'yes'}]}
mem_device_attrs = {'source': {'pagesize_unit': 'KiB', 'pagesize': 2048, 'nodemask': '0'}, 'mem_model': 'dimm', 'target': {'size': 1048576, 'node': 0, 'size_unit': 'KiB'}}
mem_device_attrs = {'source': {'pagesize_unit': 'KiB', 'pagesize': ${pagesize}, 'nodemask': '0'}, 'mem_model': 'dimm', 'target': {'size': 1048576, 'node': 0, 'size_unit': 'KiB'}}
- mount_hp_running_vm:
no s390-virtio
pagesize = 2048
hp_path = '/dev/hugepages1G'
mount_pagesize = 1048576
mount_path = '/dev/hugepages1G'
mount_option = 'pagesize=1G'
aarch64:
pagesize = 524288
mount_pagesize = 2048
mount_path= '/dev/hugepages2M'
mount_option = 'pagesize=2M'
vm_attrs = {'vcpu': 4, 'max_mem_rt': 15242880, 'max_mem_rt_slots': 16, 'max_mem_rt_unit': 'KiB'}
numa_node_size = 1048576
cpu_attrs = {'numa_cell': [{'id': '0', 'cpus': '0-1', 'memory': '${numa_node_size}', 'unit': 'KiB'}, {'id': '1', 'cpus': '2-3', 'memory': '${numa_node_size}', 'unit': 'KiB'}]}
mem_backing_attrs = {'hugepages': {'pages': [{'unit': 'KiB', 'size': '${pagesize}'}]}}
mem_device_attrs = {'source': {'pagesize': 1048576, 'pagesize_unit': 'KiB'}, 'mem_model': 'dimm', 'target': {'size': 1048576, 'node': 0, 'size_unit': 'KiB'}}
mem_device_attrs = {'source': {'pagesize': ${mount_pagesize}, 'pagesize_unit': 'KiB'}, 'mem_model': 'dimm', 'target': {'size': 1048576, 'node': 0, 'size_unit': 'KiB'}}
- edit_mem:
variants case:
- forbid_0:
Expand Down Expand Up @@ -143,6 +155,8 @@
vmxml_current_mem = 1024000
vmxml_vcpu = 4
cpu_attrs = {'mode': 'host-model', 'numa_cell': [{'id': '0', 'cpus': '0,2', 'memory': '${numa_node_size}', 'unit': 'KiB'}, {'id': '1', 'cpus': '1,3', 'memory': '${numa_node_size}', 'unit': 'KiB'}]}
aarch64:
cpu_attrs = {'mode': 'host-passthrough', 'numa_cell': [{'id': '0', 'cpus': '0,2', 'memory': '${numa_node_size}', 'unit': 'KiB'}, {'id': '1', 'cpus': '1,3', 'memory': '${numa_node_size}', 'unit': 'KiB'}]}
dimm_device_1_attrs = {'mem_model': 'dimm', 'target': {'size': ${at_size}, 'size_unit': 'KiB', 'node': 1}}
dimm_device_0_attrs = {'mem_model': 'dimm', 'target': {'size': 0, 'size_unit': 'KiB', 'node': 0}}
audit_cmd = ausearch -ts recent -m VIRT_RESOURCE| grep 'mem'
Expand Down
26 changes: 16 additions & 10 deletions libvirt/tests/src/memory/memory_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,10 +246,12 @@ def _setup_mbxml():
test.log.debug(virsh.dumpxml(vm_name).stdout_text)

if case == 'mount_hp_running_vm':
pagesize = int(params.get('pagesize'))
mount_pagesize = int(params.get('mount_pagesize'))
vm_mem_size = vmxml.memory
hp_cfg = test_setup.HugePageConfig(params)
hp_cfg.set_kernel_hugepages(1048576, vm_mem_size // 1048576)
hp_cfg.set_kernel_hugepages(2048, vm_mem_size // 2048)
hp_cfg.set_kernel_hugepages(pagesize, vm_mem_size // pagesize)
hp_cfg.set_kernel_hugepages(mount_pagesize, vm_mem_size // mount_pagesize)
set_vmxml(vmxml, params)
_setup_mbxml()
vmxml.sync()
Expand Down Expand Up @@ -386,11 +388,15 @@ def run_test_memorybacking(case):
if case == 'mount_hp_running_vm':
vm.start()
utils_libvirtd.Libvirtd('virtqemud').stop()
hp_path = params.get('hp_path')
if not os.path.exists(hp_path):
os.mkdir(hp_path)
utils_disk.mount('hugetlbfs', hp_path, 'hugetlbfs',
options='pagesize=1G', verbose=True)
mount_path = params.get('mount_path')
mount_option = params.get('mount_option')

if not os.path.exists(mount_path):
os.mkdir(mount_path)
utils_disk.mount('hugetlbfs', mount_path, 'hugetlbfs',
options=mount_option, verbose=True)
libvirtd = utils_libvirtd.Libvirtd()
libvirtd.restart()

vm_state = virsh.domstate(vm_name).stdout_text
if 'running' not in vm_state:
Expand Down Expand Up @@ -425,9 +431,9 @@ def cleanup_test_memorybacking(case):
if case == 'hp_from_2_numa_nodes':
restore_hugepages()
if case == 'mount_hp_running_vm':
hp_path = params.get('hp_path')
utils_disk.umount('hugetlbfs', hp_path, 'hugetlbfs')
os.rmdir(hp_path)
mount_path = params.get('mount_path')
utils_disk.umount('hugetlbfs', mount_path, 'hugetlbfs')
os.rmdir(mount_path)

def run_test_edit_mem(case):
"""
Expand Down

0 comments on commit 0ed5b0d

Please sign in to comment.