[PATCH] qemu: Use memory-object-file when needed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We were missing a check for '!nodemask' in the condition that decides
whether we need memory-object-file or not.  We only used userNodeset,
but forgot that we might need to use nodemask even if that's not set.

Even though there was a test for this, the args file was incorrect, so
it is very nicely visible what this change does function-wise.  Even
with that I added the same test but instead of auto nodeset I specified
one in numatune/memory just to make sure it fixes the problem.

Signed-off-by: Martin Kletzander <mkletzan@xxxxxxxxxx>
---
 src/qemu/qemu_command.c                            |  3 ++-
 .../qemuxml2argv-numatune-auto-prefer.args         |  4 ++-
 ...emuxml2argv-numatune-hugepages-no-memnode.args} |  3 ++-
 .../qemuxml2argv-numatune-hugepages-no-memnode.xml | 29 ++++++++++++++++++++++
 tests/qemuxml2argvtest.c                           |  2 ++
 5 files changed, 38 insertions(+), 3 deletions(-)
 copy tests/qemuxml2argvdata/{qemuxml2argv-numatune-auto-prefer.args => qemuxml2argv-numatune-hugepages-no-memnode.args} (72%)
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-numatune-hugepages-no-memnode.xml

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 5d3ab3a4eac5..debaea491be8 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -5238,7 +5238,8 @@ qemuBuildMemoryBackendStr(unsigned long long size,
     }

     /* If none of the following is requested... */
-    if (!pagesize && !userNodeset && !memAccess && !nodeSpecified && !force) {
+    if (!pagesize && !userNodeset && !memAccess &&
+        !nodeSpecified && !nodemask && !force) {
         /* report back that using the new backend is not necessary
          * to achieve the desired configuration */
         ret = 1;
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-numatune-auto-prefer.args b/tests/qemuxml2argvdata/qemuxml2argv-numatune-auto-prefer.args
index b4c49d44c525..710dae2aaa56 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-numatune-auto-prefer.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-numatune-auto-prefer.args
@@ -10,7 +10,9 @@ QEMU_AUDIO_DRV=none \
 -M pc \
 -m 64 \
 -smp 1 \
--numa node,nodeid=0,cpus=0,mem=64 \
+-object memory-backend-ram,id=ram-node0,size=67108864,host-nodes=0-3,\
+policy=preferred \
+-numa node,nodeid=0,cpus=0,memdev=ram-node0 \
 -uuid 9f4b6512-e73a-4a25-93e8-5307802821ce \
 -nographic \
 -monitor unix:/tmp/test-monitor,server,nowait \
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-numatune-auto-prefer.args b/tests/qemuxml2argvdata/qemuxml2argv-numatune-hugepages-no-memnode.args
similarity index 72%
copy from tests/qemuxml2argvdata/qemuxml2argv-numatune-auto-prefer.args
copy to tests/qemuxml2argvdata/qemuxml2argv-numatune-hugepages-no-memnode.args
index b4c49d44c525..3ee81e9da7be 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-numatune-auto-prefer.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-numatune-hugepages-no-memnode.args
@@ -10,7 +10,8 @@ QEMU_AUDIO_DRV=none \
 -M pc \
 -m 64 \
 -smp 1 \
--numa node,nodeid=0,cpus=0,mem=64 \
+-object memory-backend-ram,id=ram-node0,size=67108864,host-nodes=1,policy=bind \
+-numa node,nodeid=0,cpus=0,memdev=ram-node0 \
 -uuid 9f4b6512-e73a-4a25-93e8-5307802821ce \
 -nographic \
 -monitor unix:/tmp/test-monitor,server,nowait \
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-numatune-hugepages-no-memnode.xml b/tests/qemuxml2argvdata/qemuxml2argv-numatune-hugepages-no-memnode.xml
new file mode 100644
index 000000000000..83fe891306ce
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-numatune-hugepages-no-memnode.xml
@@ -0,0 +1,29 @@
+<domain type='qemu'>
+  <name>QEMUGuest</name>
+  <uuid>9f4b6512-e73a-4a25-93e8-5307802821ce</uuid>
+  <memory unit='KiB'>65536</memory>
+  <currentMemory unit='KiB'>65536</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <numatune>
+    <memory nodeset='1'/>
+  </numatune>
+  <os>
+    <type arch='x86_64' machine='pc'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <cpu>
+    <numa>
+      <cell id='0' cpus='0' memory='65536' unit='KiB'/>
+    </numa>
+  </cpu>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/kvm</emulator>
+    <controller type='usb' index='0'/>
+    <controller type='pci' index='0' model='pci-root'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 7cd8c8e18f0e..1a7cfa3d9de3 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1344,6 +1344,8 @@ mymain(void)
     DO_TEST("numatune-auto-nodeset-invalid", NONE);
     DO_TEST("numatune-auto-prefer", QEMU_CAPS_OBJECT_MEMORY_RAM,
             QEMU_CAPS_OBJECT_MEMORY_FILE);
+    DO_TEST("numatune-hugepages-no-memnode", QEMU_CAPS_OBJECT_MEMORY_RAM,
+            QEMU_CAPS_OBJECT_MEMORY_FILE);
     DO_TEST_FAILURE("numatune-static-nodeset-exceed-hostnode",
                     QEMU_CAPS_OBJECT_MEMORY_RAM);
     DO_TEST_PARSE_ERROR("numatune-memnode-nocpu", NONE);
-- 
2.7.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]