]> xenbits.xensource.com Git - libvirt.git/commitdiff
tests: extract pages-discard out of hugepages-pages
authorPavel Hrdina <phrdina@redhat.com>
Wed, 8 Aug 2018 10:27:18 +0000 (12:27 +0200)
committerPavel Hrdina <phrdina@redhat.com>
Fri, 10 Aug 2018 15:06:48 +0000 (17:06 +0200)
From the args output you can see that the 'discard' feature is not
honored if you don't use hugepages, that is a bug, following patche
will fix it.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
tests/qemuxml2argvdata/hugepages-pages.args
tests/qemuxml2argvdata/hugepages-pages.xml
tests/qemuxml2argvdata/pages-discard.args [new file with mode: 0644]
tests/qemuxml2argvdata/pages-discard.xml [new file with mode: 0644]
tests/qemuxml2argvtest.c
tests/qemuxml2xmloutdata/hugepages-pages.xml
tests/qemuxml2xmloutdata/pages-discard.xml [new symlink]
tests/qemuxml2xmltest.c

index aad8aa9f85f6493ec1651b985c28fcc9365d6e13..3ed0a48c400896e1a5edce8b111d7dc4a59cb47b 100644 (file)
@@ -11,20 +11,20 @@ QEMU_AUDIO_DRV=none \
 -m 4096 \
 -smp 4,sockets=4,cores=1,threads=1 \
 -object memory-backend-file,id=ram-node0,prealloc=yes,\
-mem-path=/dev/hugepages1G/libvirt/qemu/-1-QEMUGuest1,discard-data=yes,\
-size=1073741824,host-nodes=0-3,policy=bind \
+mem-path=/dev/hugepages1G/libvirt/qemu/-1-QEMUGuest1,size=1073741824,\
+host-nodes=0-3,policy=bind \
 -numa node,nodeid=0,cpus=0,memdev=ram-node0 \
 -object memory-backend-file,id=ram-node1,prealloc=yes,\
 mem-path=/dev/hugepages2M/libvirt/qemu/-1-QEMUGuest1,size=1073741824,\
 host-nodes=0-3,policy=bind \
 -numa node,nodeid=1,cpus=1,memdev=ram-node1 \
 -object memory-backend-file,id=ram-node2,prealloc=yes,\
-mem-path=/dev/hugepages1G/libvirt/qemu/-1-QEMUGuest1,discard-data=yes,\
-size=1073741824,host-nodes=0-3,policy=bind \
+mem-path=/dev/hugepages1G/libvirt/qemu/-1-QEMUGuest1,size=1073741824,\
+host-nodes=0-3,policy=bind \
 -numa node,nodeid=2,cpus=2,memdev=ram-node2 \
 -object memory-backend-file,id=ram-node3,prealloc=yes,\
-mem-path=/dev/hugepages1G/libvirt/qemu/-1-QEMUGuest1,discard-data=yes,\
-size=1073741824,host-nodes=3,policy=bind \
+mem-path=/dev/hugepages1G/libvirt/qemu/-1-QEMUGuest1,size=1073741824,\
+host-nodes=3,policy=bind \
 -numa node,nodeid=3,cpus=3,memdev=ram-node3 \
 -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
 -display none \
index cba83e754c295939d167da9596d898e366ca2b17..f9270782d4fe12d564363dd422ef27d115b79097 100644 (file)
@@ -8,7 +8,6 @@
       <page size='2048' unit='KiB' nodeset='1'/>
       <page size='1048576' unit='KiB' nodeset='0,2-3'/>
     </hugepages>
-    <discard/>
   </memoryBacking>
   <vcpu placement='static'>4</vcpu>
   <numatune>
@@ -22,7 +21,7 @@
   <cpu>
     <numa>
       <cell id='0' cpus='0' memory='1048576' unit='KiB'/>
-      <cell id='1' cpus='1' memory='1048576' unit='KiB' discard='no'/>
+      <cell id='1' cpus='1' memory='1048576' unit='KiB'/>
       <cell id='2' cpus='2' memory='1048576' unit='KiB'/>
       <cell id='3' cpus='3' memory='1048576' unit='KiB'/>
     </numa>
diff --git a/tests/qemuxml2argvdata/pages-discard.args b/tests/qemuxml2argvdata/pages-discard.args
new file mode 100644 (file)
index 0000000..f249dbd
--- /dev/null
@@ -0,0 +1,27 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/home/test \
+USER=test \
+LOGNAME=test \
+QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-i686 \
+-name QEMUGuest1 \
+-S \
+-machine pc,accel=tcg,usb=off,dump-guest-core=off \
+-m 4096 \
+-smp 4,sockets=4,cores=1,threads=1 \
+-numa node,nodeid=0,cpus=0,mem=1024 \
+-numa node,nodeid=1,cpus=1,mem=1024 \
+-numa node,nodeid=2,cpus=2,mem=1024 \
+-numa node,nodeid=3,cpus=3,mem=1024 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-display none \
+-no-user-config \
+-nodefaults \
+-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\
+server,nowait \
+-mon chardev=charmonitor,id=monitor,mode=control \
+-rtc base=utc \
+-no-shutdown \
+-no-acpi \
+-usb
diff --git a/tests/qemuxml2argvdata/pages-discard.xml b/tests/qemuxml2argvdata/pages-discard.xml
new file mode 100644 (file)
index 0000000..a8c6b74
--- /dev/null
@@ -0,0 +1,36 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>4194304</memory>
+  <currentMemory unit='KiB'>4194304</currentMemory>
+  <memoryBacking>
+    <discard/>
+  </memoryBacking>
+  <vcpu placement='static'>4</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <cpu>
+    <numa>
+      <cell id='0' cpus='0' memory='1048576' unit='KiB'/>
+      <cell id='1' cpus='1' memory='1048576' unit='KiB' discard='no'/>
+      <cell id='2' cpus='2' memory='1048576' unit='KiB'/>
+      <cell id='3' cpus='3' memory='1048576' 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/qemu-system-i686</emulator>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
+    <controller type='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
index 88e07dd431d5d353d93e0c6e807d523028c62fba..fab690e3de7f0b23d3c4bc132b05850795bf27dd 100644 (file)
@@ -944,6 +944,9 @@ mymain(void)
     DO_TEST("pmu-feature", NONE);
     DO_TEST("pmu-feature-off", NONE);
 
+    DO_TEST("pages-discard",
+            QEMU_CAPS_OBJECT_MEMORY_FILE,
+            QEMU_CAPS_OBJECT_MEMORY_FILE_DISCARD);
     DO_TEST("hugepages-default", NONE);
     DO_TEST("hugepages-numa-default",
             QEMU_CAPS_OBJECT_MEMORY_FILE);
@@ -952,8 +955,7 @@ mymain(void)
             QEMU_CAPS_OBJECT_MEMORY_FILE);
     DO_TEST("hugepages-pages",
             QEMU_CAPS_OBJECT_MEMORY_RAM,
-            QEMU_CAPS_OBJECT_MEMORY_FILE,
-            QEMU_CAPS_OBJECT_MEMORY_FILE_DISCARD);
+            QEMU_CAPS_OBJECT_MEMORY_FILE);
     DO_TEST("hugepages-pages2", QEMU_CAPS_OBJECT_MEMORY_RAM,
             QEMU_CAPS_OBJECT_MEMORY_FILE);
     DO_TEST("hugepages-pages3", QEMU_CAPS_OBJECT_MEMORY_RAM,
index 292454588e556536429f23bdfdc57b6bfda4b053..498610a217fed837e62f6fa2d455a7e048a2ca1d 100644 (file)
@@ -8,7 +8,6 @@
       <page size='2048' unit='KiB' nodeset='1'/>
       <page size='1048576' unit='KiB' nodeset='0,2-3'/>
     </hugepages>
-    <discard/>
   </memoryBacking>
   <vcpu placement='static'>4</vcpu>
   <numatune>
@@ -22,7 +21,7 @@
   <cpu>
     <numa>
       <cell id='0' cpus='0' memory='1048576' unit='KiB'/>
-      <cell id='1' cpus='1' memory='1048576' unit='KiB' discard='no'/>
+      <cell id='1' cpus='1' memory='1048576' unit='KiB'/>
       <cell id='2' cpus='2' memory='1048576' unit='KiB'/>
       <cell id='3' cpus='3' memory='1048576' unit='KiB'/>
     </numa>
diff --git a/tests/qemuxml2xmloutdata/pages-discard.xml b/tests/qemuxml2xmloutdata/pages-discard.xml
new file mode 120000 (symlink)
index 0000000..4d22fef
--- /dev/null
@@ -0,0 +1 @@
+../qemuxml2argvdata/pages-discard.xml
\ No newline at end of file
index 97286295cc2e4c7bb15e01f9132815bcd4aeabec..8d924f9e009c53afbb4d82104eed8d810a0c8321 100644 (file)
@@ -325,6 +325,7 @@ mymain(void)
     DO_TEST("pmu-feature", NONE);
     DO_TEST("pmu-feature-off", NONE);
 
+    DO_TEST("pages-discard", NONE);
     DO_TEST("hugepages-default", NONE);
     DO_TEST("hugepages-numa-default-dimm", NONE);
     DO_TEST("hugepages-pages", NONE);