Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve test issue with aarch64 and 4k default hp size #5917

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
start_vm = "no"
umask_value = '027'
mem_backing_attrs = {'hugepages': {}}
default_hp_size = 2048
target_hugepages = 1024
aarch64:
default_hp_size = 524288
target_hugepages = 4
s390-virtio:
kvm_module_parameters = "hpage=1"
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from virttest import utils_libvirtd
from virttest.libvirt_xml import vm_xml
from virttest.libvirt_xml.vm_xml import VMXML
from avocado.utils import memory as avocado_mem


def run(test, params, env):
Expand All @@ -30,6 +31,19 @@ def run(test, params, env):
if os.path.exists(hp_path):
shutil.rmtree(hp_path)
utils_libvirtd.Libvirtd().restart()

# verify test runs on machine with expected size of hugepages
# and recalculate the target_hugepage if necessary
default_hp_size = int(params.get("default_hp_size", 2048))
target_hugepages = int(params.get("target_hugepages", 1024))
actual_hp_size = avocado_mem.get_huge_page_size()
if actual_hp_size != default_hp_size:
# actual hp size is different that is expected for defined number of hugepages
# as the size is not the main focus of the test, we have to recalculate and replace
new_target_hugepages = int((default_hp_size * target_hugepages) / actual_hp_size)
test.log.warn(f"Default HP size is different than expected. Parameter 'target_hugepagees' was updated: {new_target_hugepages}")
params["target_hugepages"] = new_target_hugepages

hp_cfg = test_setup.HugePageConfig(params)
hp_cfg.set_hugepages()

Expand Down
Loading