From: Pavel Hrdina Date: Tue, 9 Nov 2021 14:00:53 +0000 (+0100) Subject: qemu_command: do not use host-nodes for system memory X-Git-Tag: v7.10.0-rc1~163 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d73265af6ec41104c20633b5c0a23688a62105e6;p=thirdparty%2Flibvirt.git qemu_command: do not use host-nodes for system memory Commit 88957116c9d3cb4705380c3702c9d4315fb500bb switched to use memory-backend-* for regular VM memory as well. That change indirectly started using 'host-nodes' for system memory which results in QEMU calling mbind() to bind the system memory to specific NUMA node if the VM XML contains the configuration similar to this: ... ... Once the VM was started with that configuration it was no longer possible to change the memory NUMA nodeset. Fixes: 677c90cc1d1fcb3aba09b5d4f0f8f83099911775 Signed-off-by: Pavel Hrdina Reviewed-by: Michal Privoznik --- diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 483041f584..9bd7258b1d 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -3631,7 +3631,8 @@ qemuBuildMemoryBackendProps(virJSONValue **backendProps, /* If mode is "restrictive", we should only use cgroups setting allowed memory * nodes, and skip passing the host-nodes and policy parameters to QEMU command * line which means we will use system default memory policy. */ - if (nodemask && mode != VIR_DOMAIN_NUMATUNE_MEM_RESTRICTIVE) { + if (!systemMemory && nodemask && + mode != VIR_DOMAIN_NUMATUNE_MEM_RESTRICTIVE) { if (!virNumaNodesetIsAvailable(nodemask)) return -1; if (virJSONValueObjectAdd(props, diff --git a/tests/qemuxml2argvdata/numatune-system-memory.x86_64-latest.args b/tests/qemuxml2argvdata/numatune-system-memory.x86_64-latest.args new file mode 100644 index 0000000000..aee9b2ce76 --- /dev/null +++ b/tests/qemuxml2argvdata/numatune-system-memory.x86_64-latest.args @@ -0,0 +1,32 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/tmp/lib/domain--1-QEMUGuest1 \ +USER=test \ +LOGNAME=test \ +XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \ +/usr/bin/qemu-system-x86_64 \ +-name guest=QEMUGuest1,debug-threads=on \ +-S \ +-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/tmp/lib/domain--1-QEMUGuest1/master-key.aes"}' \ +-machine pc,accel=tcg,usb=off,dump-guest-core=off,memory-backend=pc.ram \ +-cpu qemu64 \ +-m 214 \ +-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264}' \ +-overcommit mem-lock=off \ +-smp 2,sockets=2,cores=1,threads=1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=charmonitor,fd=1729,server=on,wait=off \ +-mon chardev=charmonitor,id=monitor,mode=control \ +-rtc base=utc \ +-no-shutdown \ +-no-acpi \ +-boot strict=on \ +-device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \ +-audiodev id=audio1,driver=none \ +-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \ +-msg timestamp=on diff --git a/tests/qemuxml2argvdata/numatune-system-memory.xml b/tests/qemuxml2argvdata/numatune-system-memory.xml new file mode 100644 index 0000000000..833303fe36 --- /dev/null +++ b/tests/qemuxml2argvdata/numatune-system-memory.xml @@ -0,0 +1,24 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219136 + 219136 + 2 + + + + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu-system-x86_64 + + + + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index a0498a0d92..161e7efa62 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -2063,6 +2063,7 @@ mymain(void) DO_TEST_CAPS_LATEST("numatune-memnode"); DO_TEST_PARSE_ERROR_NOCAPS("numatune-memnode-invalid-mode"); DO_TEST_CAPS_LATEST("numatune-memnode-restrictive-mode"); + DO_TEST_CAPS_LATEST("numatune-system-memory"); DO_TEST("numatune-memnode-no-memory", QEMU_CAPS_NUMA,