Skip to content

Commit

Permalink
netperf: implements dynamic NUMA binding
Browse files Browse the repository at this point in the history
The test was taking the last NUMA node to
bind the VM's memory. In some systems the last
NUMA node could have no memory and/or CPUs
assigned, updates the test to take the first
valid node.

Signed-off-by: mcasquer <[email protected]>
  • Loading branch information
mcasquer committed Jan 19, 2025
1 parent bd33da7 commit dc7d668
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 4 deletions.
2 changes: 1 addition & 1 deletion generic/tests/cfg/netperf.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
- netperf: install setup image_copy unattended_install.cdrom
virt_test_type = qemu libvirt
type = netperf
not_preprocess = yes
kill_vm = yes
image_snapshot = yes
setup_ksm = no
Expand Down Expand Up @@ -32,7 +33,6 @@
# bridge_force_create=yes
# bridge_nic1 =
#numa configration
numa_node = -1
netperf_with_numa = yes
# configure netperf test parameters, some seconds will be took to
# wait all the clients work, this wait time should be less than
Expand Down
30 changes: 27 additions & 3 deletions generic/tests/netperf.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,15 @@
import time

from avocado.utils import process
from virttest import error_context, remote, utils_misc, utils_net, utils_test, virt_vm
from virttest import (
env_process,
error_context,
remote,
utils_misc,
utils_net,
utils_test,
virt_vm,
)

from provider import netperf_base, win_driver_utils

Expand Down Expand Up @@ -136,8 +144,24 @@ def mtu_set(mtu):
"The ethenet device does not support jumbo," "cancel test"
)

vm = env.get_vm(params["main_vm"])
vm.verify_alive()
pinned_node = 0
host_numa = utils_misc.NumaInfo()
node_list = host_numa.online_nodes_withcpumem
try:
for node in node_list:
node_mem_free = int(host_numa.read_from_node_meminfo(node, "MemFree"))
mem = int(params["mem"])
mem_kb = mem * 1024
if node_mem_free > mem_kb:
pinned_node = node
params["qemu_command_prefix"] = f"numactl -m {pinned_node}"
vm_name = params["main_vm"]
env_process.preprocess_vm(test, params, env, vm_name)
vm = env.get_vm(vm_name)
vm.verify_alive()
except virt_vm.VMCreateError:
test.error("Not enough memory on the nodes to create the VM")

login_timeout = int(params.get("login_timeout", 360))

config_cmds = params.get("config_cmds")
Expand Down

0 comments on commit dc7d668

Please sign in to comment.