[libvirt] [PATCH v2 00/20] Fix and improve hugepage code

changes in v2: - renamed existing test cases to sensible names - split of some existing test cases - fixed uncovered issue with memory discard v1: https://www.redhat.com/archives/libvir-list/2018-July/msg00667.html Pavel Hrdina (20): tests: rename hugepages to hugepages-default tests: extract hugepages-numa-default-dimm out of hugepages-numa tests: rename hugepages-numa into hugepages-numa-default tests: remove unnecessary XML elements from hugepages-numa-default tests: extract pages-discard out of hugepages-pages tests: rename hugepages-pages into hugepages-numa-nodeset tests: rename hugepages-pages2 into hugepages-numa-default-2M tests: extract pages-discard-hugepages out of hugepages-pages3 tests: rename hugepages-pages3 into hugepages-numa-nodeset-part tests: rename hugepages-pages4 into hugepages-numa-nodeset-nonexist tests: rename hugepages-pages5 into hugepages-default-2M tests: rename hugepages-pages6 into hugepages-default-system-size tests: rename hugepages-pages7 into pages-dimm-discard tests: rename hugepages-pages8 into hugepages-nodeset-nonexist tests: introduce hugepages-default-1G-nodeset-2M tests: introduce hugepages-nodeset conf: Move hugepage XML validation check out of qemu_command conf: Move hugepages validation out of XML parser conf: Introduce virDomainDefPostParseMemtune qemu: ensure that memory 'discard' is used if specified in XML src/conf/domain_conf.c | 134 +++++++++++++----- src/qemu/qemu_command.c | 38 +---- ...s => hugepages-default-1G-nodeset-2M.args} | 7 +- .../hugepages-default-1G-nodeset-2M.xml | 31 ++++ ...-pages5.args => hugepages-default-2M.args} | 5 +- ...es-pages5.xml => hugepages-default-2M.xml} | 13 +- .../hugepages-default-system-size.args | 24 ++++ ....xml => hugepages-default-system-size.xml} | 13 +- ...{hugepages.args => hugepages-default.args} | 2 - .../{hugepages.xml => hugepages-default.xml} | 5 - ...es8.xml => hugepages-nodeset-nonexist.xml} | 13 +- tests/qemuxml2argvdata/hugepages-nodeset.args | 26 ++++ tests/qemuxml2argvdata/hugepages-nodeset.xml | 30 ++++ ...s2.args => hugepages-numa-default-2M.args} | 5 +- ...ges2.xml => hugepages-numa-default-2M.xml} | 8 +- ....args => hugepages-numa-default-dimm.args} | 12 +- .../hugepages-numa-default-dimm.xml | 45 ++++++ .../hugepages-numa-default.args | 27 ++++ .../hugepages-numa-default.xml | 30 ++++ ...ml => hugepages-numa-nodeset-nonexist.xml} | 17 +-- ....args => hugepages-numa-nodeset-part.args} | 8 +- .../hugepages-numa-nodeset-part.xml | 34 +++++ ...pages.args => hugepages-numa-nodeset.args} | 17 +-- ...s-pages.xml => hugepages-numa-nodeset.xml} | 15 +- tests/qemuxml2argvdata/hugepages-numa.args | 63 -------- tests/qemuxml2argvdata/hugepages-numa.xml | 111 --------------- .../qemuxml2argvdata/pages-dimm-discard.args | 33 +++++ ...ages-pages7.xml => pages-dimm-discard.xml} | 18 +-- .../pages-discard-hugepages.args | 31 ++++ ...pages3.xml => pages-discard-hugepages.xml} | 16 +-- tests/qemuxml2argvdata/pages-discard.args | 38 +++++ tests/qemuxml2argvdata/pages-discard.xml | 36 +++++ .../seclabel-dynamic-none-relabel.xml | 2 +- tests/qemuxml2argvtest.c | 56 ++++---- .../hugepages-default-2M.xml | 1 + .../hugepages-default-system-size.xml | 1 + .../{hugepages.xml => hugepages-default.xml} | 6 - .../qemuxml2xmloutdata/hugepages-nodeset.xml | 30 ++++ ...ges2.xml => hugepages-numa-default-2M.xml} | 13 +- .../hugepages-numa-default-dimm.xml | 1 + .../hugepages-numa-nodeset-part.xml | 36 +++++ ...s-pages.xml => hugepages-numa-nodeset.xml} | 20 +-- tests/qemuxml2xmloutdata/hugepages-pages3.xml | 47 ------ tests/qemuxml2xmloutdata/hugepages-pages4.xml | 1 - tests/qemuxml2xmloutdata/hugepages-pages5.xml | 1 - tests/qemuxml2xmloutdata/hugepages-pages6.xml | 1 - tests/qemuxml2xmloutdata/hugepages-pages7.xml | 1 - .../qemuxml2xmloutdata/pages-dimm-discard.xml | 1 + .../pages-discard-hugepages.xml | 1 + tests/qemuxml2xmloutdata/pages-discard.xml | 1 + .../seclabel-dynamic-none-relabel.xml | 2 +- tests/qemuxml2xmltest.c | 19 +-- 52 files changed, 634 insertions(+), 512 deletions(-) rename tests/qemuxml2argvdata/{hugepages-pages6.args => hugepages-default-1G-nodeset-2M.args} (72%) create mode 100644 tests/qemuxml2argvdata/hugepages-default-1G-nodeset-2M.xml rename tests/qemuxml2argvdata/{hugepages-pages5.args => hugepages-default-2M.args} (75%) rename tests/qemuxml2argvdata/{hugepages-pages5.xml => hugepages-default-2M.xml} (63%) create mode 100644 tests/qemuxml2argvdata/hugepages-default-system-size.args rename tests/qemuxml2argvdata/{hugepages-pages6.xml => hugepages-default-system-size.xml} (63%) rename tests/qemuxml2argvdata/{hugepages.args => hugepages-default.args} (82%) rename tests/qemuxml2argvdata/{hugepages.xml => hugepages-default.xml} (79%) rename tests/qemuxml2argvdata/{hugepages-pages8.xml => hugepages-nodeset-nonexist.xml} (64%) create mode 100644 tests/qemuxml2argvdata/hugepages-nodeset.args create mode 100644 tests/qemuxml2argvdata/hugepages-nodeset.xml rename tests/qemuxml2argvdata/{hugepages-pages2.args => hugepages-numa-default-2M.args} (77%) rename tests/qemuxml2argvdata/{hugepages-pages2.xml => hugepages-numa-default-2M.xml} (77%) rename tests/qemuxml2argvdata/{hugepages-pages7.args => hugepages-numa-default-dimm.args} (66%) create mode 100644 tests/qemuxml2argvdata/hugepages-numa-default-dimm.xml create mode 100644 tests/qemuxml2argvdata/hugepages-numa-default.args create mode 100644 tests/qemuxml2argvdata/hugepages-numa-default.xml rename tests/qemuxml2argvdata/{hugepages-pages4.xml => hugepages-numa-nodeset-nonexist.xml} (66%) rename tests/qemuxml2argvdata/{hugepages-pages3.args => hugepages-numa-nodeset-part.args} (71%) create mode 100644 tests/qemuxml2argvdata/hugepages-numa-nodeset-part.xml rename tests/qemuxml2argvdata/{hugepages-pages.args => hugepages-numa-nodeset.args} (62%) rename tests/qemuxml2argvdata/{hugepages-pages.xml => hugepages-numa-nodeset.xml} (69%) delete mode 100644 tests/qemuxml2argvdata/hugepages-numa.args delete mode 100644 tests/qemuxml2argvdata/hugepages-numa.xml create mode 100644 tests/qemuxml2argvdata/pages-dimm-discard.args rename tests/qemuxml2argvdata/{hugepages-pages7.xml => pages-dimm-discard.xml} (73%) create mode 100644 tests/qemuxml2argvdata/pages-discard-hugepages.args rename tests/qemuxml2argvdata/{hugepages-pages3.xml => pages-discard-hugepages.xml} (68%) create mode 100644 tests/qemuxml2argvdata/pages-discard.args create mode 100644 tests/qemuxml2argvdata/pages-discard.xml create mode 120000 tests/qemuxml2xmloutdata/hugepages-default-2M.xml create mode 120000 tests/qemuxml2xmloutdata/hugepages-default-system-size.xml rename tests/qemuxml2xmloutdata/{hugepages.xml => hugepages-default.xml} (82%) create mode 100644 tests/qemuxml2xmloutdata/hugepages-nodeset.xml rename tests/qemuxml2xmloutdata/{hugepages-pages2.xml => hugepages-numa-default-2M.xml} (67%) create mode 120000 tests/qemuxml2xmloutdata/hugepages-numa-default-dimm.xml create mode 100644 tests/qemuxml2xmloutdata/hugepages-numa-nodeset-part.xml rename tests/qemuxml2xmloutdata/{hugepages-pages.xml => hugepages-numa-nodeset.xml} (62%) delete mode 100644 tests/qemuxml2xmloutdata/hugepages-pages3.xml delete mode 120000 tests/qemuxml2xmloutdata/hugepages-pages4.xml delete mode 120000 tests/qemuxml2xmloutdata/hugepages-pages5.xml delete mode 120000 tests/qemuxml2xmloutdata/hugepages-pages6.xml delete mode 120000 tests/qemuxml2xmloutdata/hugepages-pages7.xml create mode 120000 tests/qemuxml2xmloutdata/pages-dimm-discard.xml create mode 120000 tests/qemuxml2xmloutdata/pages-discard-hugepages.xml create mode 120000 tests/qemuxml2xmloutdata/pages-discard.xml -- 2.17.1

Remove unnecessary XML elements as well. Signed-off-by: Pavel Hrdina <phrdina@redhat.com> --- .../{hugepages.args => hugepages-default.args} | 2 -- .../{hugepages.xml => hugepages-default.xml} | 5 ----- tests/qemuxml2argvtest.c | 2 +- .../{hugepages.xml => hugepages-default.xml} | 6 ------ tests/qemuxml2xmltest.c | 2 +- 5 files changed, 2 insertions(+), 15 deletions(-) rename tests/qemuxml2argvdata/{hugepages.args => hugepages-default.args} (82%) rename tests/qemuxml2argvdata/{hugepages.xml => hugepages-default.xml} (79%) rename tests/qemuxml2xmloutdata/{hugepages.xml => hugepages-default.xml} (82%) diff --git a/tests/qemuxml2argvdata/hugepages.args b/tests/qemuxml2argvdata/hugepages-default.args similarity index 82% rename from tests/qemuxml2argvdata/hugepages.args rename to tests/qemuxml2argvdata/hugepages-default.args index ea61ba930e..115da3ea35 100644 --- a/tests/qemuxml2argvdata/hugepages.args +++ b/tests/qemuxml2argvdata/hugepages-default.args @@ -24,6 +24,4 @@ server,nowait \ -no-acpi \ -boot c \ -usb \ --drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \ --device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \ -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 diff --git a/tests/qemuxml2argvdata/hugepages.xml b/tests/qemuxml2argvdata/hugepages-default.xml similarity index 79% rename from tests/qemuxml2argvdata/hugepages.xml rename to tests/qemuxml2argvdata/hugepages-default.xml index 2e65902f1c..99f53828fe 100644 --- a/tests/qemuxml2argvdata/hugepages.xml +++ b/tests/qemuxml2argvdata/hugepages-default.xml @@ -17,11 +17,6 @@ <on_crash>destroy</on_crash> <devices> <emulator>/usr/bin/qemu-system-i686</emulator> - <disk type='block' device='disk'> - <source dev='/dev/HostVG/QEMUGuest1'/> - <target dev='hda' bus='ide'/> - <address type='drive' controller='0' bus='0' target='0' unit='0'/> - </disk> <controller type='usb' index='0'/> <controller type='ide' index='0'/> <controller type='pci' index='0' model='pci-root'/> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 16000ca59d..cfebf364fb 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -960,7 +960,7 @@ mymain(void) DO_TEST("pmu-feature", NONE); DO_TEST("pmu-feature-off", NONE); - DO_TEST("hugepages", NONE); + DO_TEST("hugepages-default", NONE); DO_TEST("hugepages-numa", QEMU_CAPS_PIIX_DISABLE_S3, QEMU_CAPS_PIIX_DISABLE_S4, QEMU_CAPS_VIRTIO_SCSI, diff --git a/tests/qemuxml2xmloutdata/hugepages.xml b/tests/qemuxml2xmloutdata/hugepages-default.xml similarity index 82% rename from tests/qemuxml2xmloutdata/hugepages.xml rename to tests/qemuxml2xmloutdata/hugepages-default.xml index f78ca95c1b..40043434ee 100644 --- a/tests/qemuxml2xmloutdata/hugepages.xml +++ b/tests/qemuxml2xmloutdata/hugepages-default.xml @@ -17,12 +17,6 @@ <on_crash>destroy</on_crash> <devices> <emulator>/usr/bin/qemu-system-i686</emulator> - <disk type='block' device='disk'> - <driver name='qemu' type='raw'/> - <source dev='/dev/HostVG/QEMUGuest1'/> - <target dev='hda' bus='ide'/> - <address type='drive' controller='0' bus='0' target='0' unit='0'/> - </disk> <controller type='usb' index='0'> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> </controller> diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 6c4f96e505..ff6e611421 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -329,7 +329,7 @@ mymain(void) DO_TEST("pmu-feature", NONE); DO_TEST("pmu-feature-off", NONE); - DO_TEST("hugepages", NONE); + DO_TEST("hugepages-default", NONE); DO_TEST("hugepages-pages", NONE); DO_TEST("hugepages-pages2", NONE); DO_TEST("hugepages-pages3", NONE); -- 2.17.1

Signed-off-by: Pavel Hrdina <phrdina@redhat.com> --- .../hugepages-numa-default-dimm.args | 31 +++++++++++++ .../hugepages-numa-default-dimm.xml | 45 +++++++++++++++++++ tests/qemuxml2argvdata/hugepages-numa.args | 6 +-- tests/qemuxml2argvdata/hugepages-numa.xml | 11 ----- tests/qemuxml2argvtest.c | 2 + .../hugepages-numa-default-dimm.xml | 1 + tests/qemuxml2xmltest.c | 1 + 7 files changed, 81 insertions(+), 16 deletions(-) create mode 100644 tests/qemuxml2argvdata/hugepages-numa-default-dimm.args create mode 100644 tests/qemuxml2argvdata/hugepages-numa-default-dimm.xml create mode 120000 tests/qemuxml2xmloutdata/hugepages-numa-default-dimm.xml diff --git a/tests/qemuxml2argvdata/hugepages-numa-default-dimm.args b/tests/qemuxml2argvdata/hugepages-numa-default-dimm.args new file mode 100644 index 0000000000..855966a137 --- /dev/null +++ b/tests/qemuxml2argvdata/hugepages-numa-default-dimm.args @@ -0,0 +1,31 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/home/test \ +USER=test \ +LOGNAME=test \ +QEMU_AUDIO_DRV=none \ +/usr/bin/qemu-system-x86_64 \ +-name fedora \ +-S \ +-machine pc-i440fx-2.3,accel=tcg,usb=off,dump-guest-core=off \ +-m size=1048576k,slots=16,maxmem=1099511627776k \ +-smp 2,sockets=2,cores=1,threads=1 \ +-mem-prealloc \ +-mem-path /dev/hugepages2M/libvirt/qemu/-1-fedora \ +-numa node,nodeid=0,cpus=0-1,mem=1024 \ +-object memory-backend-file,id=memdimm0,prealloc=yes,\ +mem-path=/dev/hugepages1G/libvirt/qemu/-1-fedora,size=1073741824,\ +host-nodes=1-3,policy=bind \ +-device pc-dimm,node=0,memdev=memdimm0,id=dimm0,slot=0 \ +-uuid 63840878-0deb-4095-97e6-fc444d9bc9fa \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-fedora/monitor.sock,\ +server,nowait \ +-mon chardev=charmonitor,id=monitor,mode=control \ +-rtc base=utc \ +-no-shutdown \ +-no-acpi \ +-boot c \ +-usb diff --git a/tests/qemuxml2argvdata/hugepages-numa-default-dimm.xml b/tests/qemuxml2argvdata/hugepages-numa-default-dimm.xml new file mode 100644 index 0000000000..14a3368678 --- /dev/null +++ b/tests/qemuxml2argvdata/hugepages-numa-default-dimm.xml @@ -0,0 +1,45 @@ +<domain type='qemu'> + <name>fedora</name> + <uuid>63840878-0deb-4095-97e6-fc444d9bc9fa</uuid> + <maxMemory slots='16' unit='KiB'>1099511627776</maxMemory> + <memory unit='KiB'>1572863</memory> + <currentMemory unit='KiB'>1048576</currentMemory> + <memoryBacking> + <hugepages/> + </memoryBacking> + <vcpu placement='static'>2</vcpu> + <os> + <type arch='x86_64' machine='pc-i440fx-2.3'>hvm</type> + <boot dev='hd'/> + </os> + <cpu> + <numa> + <cell id='0' cpus='0-1' 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-x86_64</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'/> + <memory model='dimm'> + <source> + <nodemask>1-3</nodemask> + <pagesize unit='KiB'>1048576</pagesize> + </source> + <target> + <size unit='KiB'>1048576</size> + <node>0</node> + </target> + <address type='dimm' slot='0'/> + </memory> + </devices> +</domain> diff --git a/tests/qemuxml2argvdata/hugepages-numa.args b/tests/qemuxml2argvdata/hugepages-numa.args index aa834f5511..20c7802fd8 100644 --- a/tests/qemuxml2argvdata/hugepages-numa.args +++ b/tests/qemuxml2argvdata/hugepages-numa.args @@ -8,15 +8,11 @@ QEMU_AUDIO_DRV=spice \ -name fedora \ -S \ -machine pc-i440fx-2.3,accel=tcg,usb=off,dump-guest-core=off \ --m size=1048576k,slots=16,maxmem=1099511627776k \ +-m 1024 \ -smp 2,sockets=2,cores=1,threads=1 \ -mem-prealloc \ -mem-path /dev/hugepages2M/libvirt/qemu/-1-fedora \ -numa node,nodeid=0,cpus=0-1,mem=1024 \ --object memory-backend-file,id=memdimm0,prealloc=yes,\ -mem-path=/dev/hugepages1G/libvirt/qemu/-1-fedora,size=1073741824,\ -host-nodes=1-3,policy=bind \ --device pc-dimm,node=0,memdev=memdimm0,id=dimm0,slot=0 \ -uuid 63840878-0deb-4095-97e6-fc444d9bc9fa \ -no-user-config \ -nodefaults \ diff --git a/tests/qemuxml2argvdata/hugepages-numa.xml b/tests/qemuxml2argvdata/hugepages-numa.xml index eef471b4ec..d3c6308be0 100644 --- a/tests/qemuxml2argvdata/hugepages-numa.xml +++ b/tests/qemuxml2argvdata/hugepages-numa.xml @@ -1,7 +1,6 @@ <domain type='qemu'> <name>fedora</name> <uuid>63840878-0deb-4095-97e6-fc444d9bc9fa</uuid> - <maxMemory slots='16' unit='KiB'>1099511627776</maxMemory> <memory unit='KiB'>1572863</memory> <currentMemory unit='KiB'>1048576</currentMemory> <memoryBacking> @@ -97,15 +96,5 @@ <memballoon model='virtio'> <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/> </memballoon> - <memory model='dimm'> - <source> - <nodemask>1-3</nodemask> - <pagesize unit='KiB'>1048576</pagesize> - </source> - <target> - <size unit='KiB'>1048576</size> - <node>0</node> - </target> - </memory> </devices> </domain> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index cfebf364fb..1631663bc6 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -968,6 +968,8 @@ mymain(void) QEMU_CAPS_SPICE, QEMU_CAPS_DEVICE_QXL, QEMU_CAPS_HDA_DUPLEX, QEMU_CAPS_USB_REDIR, + QEMU_CAPS_OBJECT_MEMORY_FILE); + DO_TEST("hugepages-numa-default-dimm", QEMU_CAPS_DEVICE_PC_DIMM, QEMU_CAPS_OBJECT_MEMORY_FILE); DO_TEST("hugepages-pages", diff --git a/tests/qemuxml2xmloutdata/hugepages-numa-default-dimm.xml b/tests/qemuxml2xmloutdata/hugepages-numa-default-dimm.xml new file mode 120000 index 0000000000..8fa2b323aa --- /dev/null +++ b/tests/qemuxml2xmloutdata/hugepages-numa-default-dimm.xml @@ -0,0 +1 @@ +../qemuxml2argvdata/hugepages-numa-default-dimm.xml \ No newline at end of file diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index ff6e611421..a943975ada 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -330,6 +330,7 @@ mymain(void) DO_TEST("pmu-feature-off", NONE); DO_TEST("hugepages-default", NONE); + DO_TEST("hugepages-numa-default-dimm", NONE); DO_TEST("hugepages-pages", NONE); DO_TEST("hugepages-pages2", NONE); DO_TEST("hugepages-pages3", NONE); -- 2.17.1

Signed-off-by: Pavel Hrdina <phrdina@redhat.com> --- .../{hugepages-numa.args => hugepages-numa-default.args} | 0 .../{hugepages-numa.xml => hugepages-numa-default.xml} | 0 tests/qemuxml2argvtest.c | 2 +- 3 files changed, 1 insertion(+), 1 deletion(-) rename tests/qemuxml2argvdata/{hugepages-numa.args => hugepages-numa-default.args} (100%) rename tests/qemuxml2argvdata/{hugepages-numa.xml => hugepages-numa-default.xml} (100%) diff --git a/tests/qemuxml2argvdata/hugepages-numa.args b/tests/qemuxml2argvdata/hugepages-numa-default.args similarity index 100% rename from tests/qemuxml2argvdata/hugepages-numa.args rename to tests/qemuxml2argvdata/hugepages-numa-default.args diff --git a/tests/qemuxml2argvdata/hugepages-numa.xml b/tests/qemuxml2argvdata/hugepages-numa-default.xml similarity index 100% rename from tests/qemuxml2argvdata/hugepages-numa.xml rename to tests/qemuxml2argvdata/hugepages-numa-default.xml diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 1631663bc6..0c311e0906 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -961,7 +961,7 @@ mymain(void) DO_TEST("pmu-feature-off", NONE); DO_TEST("hugepages-default", NONE); - DO_TEST("hugepages-numa", + DO_TEST("hugepages-numa-default", QEMU_CAPS_PIIX_DISABLE_S3, QEMU_CAPS_PIIX_DISABLE_S4, QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_ICH9_USB_EHCI1, -- 2.17.1

Signed-off-by: Pavel Hrdina <phrdina@redhat.com> --- .../hugepages-numa-default.args | 42 ++--------- .../hugepages-numa-default.xml | 74 +------------------ tests/qemuxml2argvtest.c | 6 -- 3 files changed, 7 insertions(+), 115 deletions(-) diff --git a/tests/qemuxml2argvdata/hugepages-numa-default.args b/tests/qemuxml2argvdata/hugepages-numa-default.args index 20c7802fd8..cc2223aee1 100644 --- a/tests/qemuxml2argvdata/hugepages-numa-default.args +++ b/tests/qemuxml2argvdata/hugepages-numa-default.args @@ -3,7 +3,7 @@ PATH=/bin \ HOME=/home/test \ USER=test \ LOGNAME=test \ -QEMU_AUDIO_DRV=spice \ +QEMU_AUDIO_DRV=none \ /usr/bin/qemu-system-x86_64 \ -name fedora \ -S \ @@ -14,46 +14,14 @@ QEMU_AUDIO_DRV=spice \ -mem-path /dev/hugepages2M/libvirt/qemu/-1-fedora \ -numa node,nodeid=0,cpus=0-1,mem=1024 \ -uuid 63840878-0deb-4095-97e6-fc444d9bc9fa \ +-display none \ -no-user-config \ -nodefaults \ -chardev socket,id=charmonitor,path=/tmp/lib/domain--1-fedora/monitor.sock,\ server,nowait \ -mon chardev=charmonitor,id=monitor,mode=control \ --rtc base=utc,driftfix=slew \ --no-hpet \ +-rtc base=utc \ -no-shutdown \ --global PIIX4_PM.disable_s3=1 \ --global PIIX4_PM.disable_s4=1 \ +-no-acpi \ -boot c \ --device ich9-usb-ehci1,id=usb,bus=pci.0,addr=0x6.0x7 \ --device ich9-usb-uhci1,masterbus=usb.0,firstport=0,bus=pci.0,multifunction=on,\ -addr=0x6 \ --device ich9-usb-uhci2,masterbus=usb.0,firstport=2,bus=pci.0,addr=0x6.0x1 \ --device ich9-usb-uhci3,masterbus=usb.0,firstport=4,bus=pci.0,addr=0x6.0x2 \ --device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x5 \ --drive file=/var/lib/libvirt/images/fedora.qcow2,format=qcow2,if=none,\ -id=drive-virtio-disk0 \ --device virtio-blk-pci,bus=pci.0,addr=0x7,drive=drive-virtio-disk0,\ -id=virtio-disk0 \ --drive if=none,id=drive-ide0-0-0,media=cdrom,readonly=on \ --device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \ --chardev socket,id=charchannel0,\ -path=/var/lib/libvirt/qemu/channel/target/fedora.org.qemu.guest_agent.0,server,\ -nowait \ --device virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,\ -id=channel0,name=org.qemu.guest_agent.0 \ --chardev spicevmc,id=charchannel1,name=vdagent \ --device virtserialport,bus=virtio-serial0.0,nr=2,chardev=charchannel1,\ -id=channel1,name=com.redhat.spice.0 \ --device usb-tablet,id=input0,bus=usb.0,port=1 \ --spice port=5901,tls-port=5902,addr=127.0.0.1,x509-dir=/etc/pki/libvirt-spice \ --vga qxl \ --global qxl-vga.ram_size=67108864 \ --global qxl-vga.vram_size=67108864 \ --device intel-hda,id=sound0,bus=pci.0,addr=0x4 \ --device hda-duplex,id=sound0-codec0,bus=sound0.0,cad=0 \ --chardev spicevmc,id=charredir0,name=usbredir \ --device usb-redir,chardev=charredir0,id=redir0,bus=usb.0,port=2 \ --chardev spicevmc,id=charredir1,name=usbredir \ --device usb-redir,chardev=charredir1,id=redir1,bus=usb.0,port=3 \ --device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x8 +-usb diff --git a/tests/qemuxml2argvdata/hugepages-numa-default.xml b/tests/qemuxml2argvdata/hugepages-numa-default.xml index d3c6308be0..6bbd80d515 100644 --- a/tests/qemuxml2argvdata/hugepages-numa-default.xml +++ b/tests/qemuxml2argvdata/hugepages-numa-default.xml @@ -11,90 +11,20 @@ <type arch='x86_64' machine='pc-i440fx-2.3'>hvm</type> <boot dev='hd'/> </os> - <features> - <acpi/> - <apic/> - <pae/> - </features> <cpu> <numa> <cell id='0' cpus='0-1' memory='1048576' unit='KiB'/> </numa> </cpu> - <clock offset='utc'> - <timer name='rtc' tickpolicy='catchup'/> - <timer name='pit' tickpolicy='delay'/> - <timer name='hpet' present='no'/> - </clock> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> <on_crash>restart</on_crash> - <pm> - <suspend-to-mem enabled='no'/> - <suspend-to-disk enabled='no'/> - </pm> <devices> <emulator>/usr/bin/qemu-system-x86_64</emulator> - <disk type='file' device='disk'> - <driver name='qemu' type='qcow2'/> - <source file='/var/lib/libvirt/images/fedora.qcow2'/> - <target dev='vda' bus='virtio'/> - <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/> - </disk> - <disk type='block' device='cdrom'> - <driver name='qemu' type='raw'/> - <target dev='hda' bus='ide'/> - <readonly/> - <address type='drive' controller='0' bus='0' target='0' unit='0'/> - </disk> - <controller type='usb' index='0' model='ich9-ehci1'> - <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x7'/> - </controller> - <controller type='usb' index='0' model='ich9-uhci1'> - <master startport='0'/> - <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0' multifunction='on'/> - </controller> - <controller type='usb' index='0' model='ich9-uhci2'> - <master startport='2'/> - <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x1'/> - </controller> - <controller type='usb' index='0' model='ich9-uhci3'> - <master startport='4'/> - <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x2'/> - </controller> + <controller type='usb' index='0'/> <controller type='pci' index='0' model='pci-root'/> - <controller type='ide' index='0'> - <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> - </controller> - <controller type='virtio-serial' index='0'> - <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/> - </controller> - <channel type='unix'> - <source mode='bind' path='/var/lib/libvirt/qemu/channel/target/fedora.org.qemu.guest_agent.0'/> - <target type='virtio' name='org.qemu.guest_agent.0'/> - <address type='virtio-serial' controller='0' bus='0' port='1'/> - </channel> - <channel type='spicevmc'> - <target type='virtio' name='com.redhat.spice.0'/> - <address type='virtio-serial' controller='0' bus='0' port='2'/> - </channel> - <input type='tablet' bus='usb'/> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> - <graphics type='spice' autoport='yes'/> - <sound model='ich6'> - <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> - </sound> - <video> - <model type='qxl' ram='65536' vram='65536' vgamem='16384' heads='1'/> - <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> - </video> - <redirdev bus='usb' type='spicevmc'> - </redirdev> - <redirdev bus='usb' type='spicevmc'> - </redirdev> - <memballoon model='virtio'> - <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/> - </memballoon> + <memballoon model='none'/> </devices> </domain> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 0c311e0906..f36058272f 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -962,12 +962,6 @@ mymain(void) DO_TEST("hugepages-default", NONE); DO_TEST("hugepages-numa-default", - QEMU_CAPS_PIIX_DISABLE_S3, QEMU_CAPS_PIIX_DISABLE_S4, - QEMU_CAPS_VIRTIO_SCSI, - QEMU_CAPS_ICH9_USB_EHCI1, - QEMU_CAPS_SPICE, - QEMU_CAPS_DEVICE_QXL, - QEMU_CAPS_HDA_DUPLEX, QEMU_CAPS_USB_REDIR, QEMU_CAPS_OBJECT_MEMORY_FILE); DO_TEST("hugepages-numa-default-dimm", QEMU_CAPS_DEVICE_PC_DIMM, -- 2.17.1

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 | 12 +++---- tests/qemuxml2argvdata/hugepages-pages.xml | 3 +- tests/qemuxml2argvdata/pages-discard.args | 28 +++++++++++++++ tests/qemuxml2argvdata/pages-discard.xml | 36 ++++++++++++++++++++ tests/qemuxml2argvtest.c | 6 ++-- tests/qemuxml2xmloutdata/hugepages-pages.xml | 3 +- tests/qemuxml2xmloutdata/pages-discard.xml | 1 + tests/qemuxml2xmltest.c | 1 + 8 files changed, 78 insertions(+), 12 deletions(-) create mode 100644 tests/qemuxml2argvdata/pages-discard.args create mode 100644 tests/qemuxml2argvdata/pages-discard.xml create mode 120000 tests/qemuxml2xmloutdata/pages-discard.xml diff --git a/tests/qemuxml2argvdata/hugepages-pages.args b/tests/qemuxml2argvdata/hugepages-pages.args index b52cd581d5..7ece0272a0 100644 --- a/tests/qemuxml2argvdata/hugepages-pages.args +++ b/tests/qemuxml2argvdata/hugepages-pages.args @@ -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 \ diff --git a/tests/qemuxml2argvdata/hugepages-pages.xml b/tests/qemuxml2argvdata/hugepages-pages.xml index cba83e754c..f9270782d4 100644 --- a/tests/qemuxml2argvdata/hugepages-pages.xml +++ b/tests/qemuxml2argvdata/hugepages-pages.xml @@ -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 index 0000000000..9db8c72a22 --- /dev/null +++ b/tests/qemuxml2argvdata/pages-discard.args @@ -0,0 +1,28 @@ +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 \ +-boot c \ +-usb diff --git a/tests/qemuxml2argvdata/pages-discard.xml b/tests/qemuxml2argvdata/pages-discard.xml new file mode 100644 index 0000000000..a8c6b74d95 --- /dev/null +++ b/tests/qemuxml2argvdata/pages-discard.xml @@ -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> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index f36058272f..b72d4217ea 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -960,6 +960,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); @@ -968,8 +971,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, diff --git a/tests/qemuxml2xmloutdata/hugepages-pages.xml b/tests/qemuxml2xmloutdata/hugepages-pages.xml index 292454588e..498610a217 100644 --- a/tests/qemuxml2xmloutdata/hugepages-pages.xml +++ b/tests/qemuxml2xmloutdata/hugepages-pages.xml @@ -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 index 0000000000..4d22fef81f --- /dev/null +++ b/tests/qemuxml2xmloutdata/pages-discard.xml @@ -0,0 +1 @@ +../qemuxml2argvdata/pages-discard.xml \ No newline at end of file diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index a943975ada..2d85084d4a 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -329,6 +329,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); -- 2.17.1

Remove unnecessary XML elements as well. <numatune> for numa guest is tested by numatune-memnode test. Signed-off-by: Pavel Hrdina <phrdina@redhat.com> --- ...s-pages.args => hugepages-numa-nodeset.args} | 17 +++++------------ ...ges-pages.xml => hugepages-numa-nodeset.xml} | 12 +----------- tests/qemuxml2argvtest.c | 2 +- ...ges-pages.xml => hugepages-numa-nodeset.xml} | 17 +---------------- tests/qemuxml2xmltest.c | 2 +- 5 files changed, 9 insertions(+), 41 deletions(-) rename tests/qemuxml2argvdata/{hugepages-pages.args => hugepages-numa-nodeset.args} (77%) rename tests/qemuxml2argvdata/{hugepages-pages.xml => hugepages-numa-nodeset.xml} (74%) rename tests/qemuxml2xmloutdata/{hugepages-pages.xml => hugepages-numa-nodeset.xml} (66%) diff --git a/tests/qemuxml2argvdata/hugepages-pages.args b/tests/qemuxml2argvdata/hugepages-numa-nodeset.args similarity index 77% rename from tests/qemuxml2argvdata/hugepages-pages.args rename to tests/qemuxml2argvdata/hugepages-numa-nodeset.args index 7ece0272a0..22f0e605fe 100644 --- a/tests/qemuxml2argvdata/hugepages-pages.args +++ b/tests/qemuxml2argvdata/hugepages-numa-nodeset.args @@ -11,20 +11,16 @@ 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,size=1073741824,\ -host-nodes=0-3,policy=bind \ +mem-path=/dev/hugepages1G/libvirt/qemu/-1-QEMUGuest1,size=1073741824 \ -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 \ +mem-path=/dev/hugepages2M/libvirt/qemu/-1-QEMUGuest1,size=1073741824 \ -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,size=1073741824,\ -host-nodes=0-3,policy=bind \ +mem-path=/dev/hugepages1G/libvirt/qemu/-1-QEMUGuest1,size=1073741824 \ -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,size=1073741824,\ -host-nodes=3,policy=bind \ +mem-path=/dev/hugepages1G/libvirt/qemu/-1-QEMUGuest1,size=1073741824 \ -numa node,nodeid=3,cpus=3,memdev=ram-node3 \ -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ -display none \ @@ -37,7 +33,4 @@ server,nowait \ -no-shutdown \ -no-acpi \ -boot c \ --usb \ --drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \ --device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \ --device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 +-usb diff --git a/tests/qemuxml2argvdata/hugepages-pages.xml b/tests/qemuxml2argvdata/hugepages-numa-nodeset.xml similarity index 74% rename from tests/qemuxml2argvdata/hugepages-pages.xml rename to tests/qemuxml2argvdata/hugepages-numa-nodeset.xml index f9270782d4..e81fa44d58 100644 --- a/tests/qemuxml2argvdata/hugepages-pages.xml +++ b/tests/qemuxml2argvdata/hugepages-numa-nodeset.xml @@ -10,10 +10,6 @@ </hugepages> </memoryBacking> <vcpu placement='static'>4</vcpu> - <numatune> - <memory mode='strict' nodeset='0-3'/> - <memnode cellid='3' mode='strict' nodeset='3'/> - </numatune> <os> <type arch='i686' machine='pc'>hvm</type> <boot dev='hd'/> @@ -32,16 +28,10 @@ <on_crash>destroy</on_crash> <devices> <emulator>/usr/bin/qemu-system-i686</emulator> - <disk type='block' device='disk'> - <source dev='/dev/HostVG/QEMUGuest1'/> - <target dev='hda' bus='ide'/> - <address type='drive' controller='0' bus='0' target='0' unit='0'/> - </disk> <controller type='usb' index='0'/> - <controller type='ide' index='0'/> <controller type='pci' index='0' model='pci-root'/> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> - <memballoon model='virtio'/> + <memballoon model='none'/> </devices> </domain> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index b72d4217ea..2d94c20f40 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -969,7 +969,7 @@ mymain(void) DO_TEST("hugepages-numa-default-dimm", QEMU_CAPS_DEVICE_PC_DIMM, QEMU_CAPS_OBJECT_MEMORY_FILE); - DO_TEST("hugepages-pages", + DO_TEST("hugepages-numa-nodeset", QEMU_CAPS_OBJECT_MEMORY_RAM, QEMU_CAPS_OBJECT_MEMORY_FILE); DO_TEST("hugepages-pages2", QEMU_CAPS_OBJECT_MEMORY_RAM, diff --git a/tests/qemuxml2xmloutdata/hugepages-pages.xml b/tests/qemuxml2xmloutdata/hugepages-numa-nodeset.xml similarity index 66% rename from tests/qemuxml2xmloutdata/hugepages-pages.xml rename to tests/qemuxml2xmloutdata/hugepages-numa-nodeset.xml index 498610a217..affd124048 100644 --- a/tests/qemuxml2xmloutdata/hugepages-pages.xml +++ b/tests/qemuxml2xmloutdata/hugepages-numa-nodeset.xml @@ -10,10 +10,6 @@ </hugepages> </memoryBacking> <vcpu placement='static'>4</vcpu> - <numatune> - <memory mode='strict' nodeset='0-3'/> - <memnode cellid='3' mode='strict' nodeset='3'/> - </numatune> <os> <type arch='i686' machine='pc'>hvm</type> <boot dev='hd'/> @@ -32,23 +28,12 @@ <on_crash>destroy</on_crash> <devices> <emulator>/usr/bin/qemu-system-i686</emulator> - <disk type='block' device='disk'> - <driver name='qemu' type='raw'/> - <source dev='/dev/HostVG/QEMUGuest1'/> - <target dev='hda' bus='ide'/> - <address type='drive' controller='0' bus='0' target='0' unit='0'/> - </disk> <controller type='usb' index='0'> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> </controller> - <controller type='ide' index='0'> - <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> - </controller> <controller type='pci' index='0' model='pci-root'/> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> - <memballoon model='virtio'> - <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> - </memballoon> + <memballoon model='none'/> </devices> </domain> diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 2d85084d4a..1484c3176f 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -332,7 +332,7 @@ mymain(void) DO_TEST("pages-discard", NONE); DO_TEST("hugepages-default", NONE); DO_TEST("hugepages-numa-default-dimm", NONE); - DO_TEST("hugepages-pages", NONE); + DO_TEST("hugepages-numa-nodeset", NONE); DO_TEST("hugepages-pages2", NONE); DO_TEST("hugepages-pages3", NONE); DO_TEST("hugepages-pages4", NONE); -- 2.17.1

Remove unnecessary XML elements as well. Signed-off-by: Pavel Hrdina <phrdina@redhat.com> --- ...s-pages2.args => hugepages-numa-default-2M.args} | 5 +---- ...ges-pages2.xml => hugepages-numa-default-2M.xml} | 8 +------- tests/qemuxml2argvtest.c | 5 +++-- ...ges-pages2.xml => hugepages-numa-default-2M.xml} | 13 +------------ tests/qemuxml2xmltest.c | 2 +- 5 files changed, 7 insertions(+), 26 deletions(-) rename tests/qemuxml2argvdata/{hugepages-pages2.args => hugepages-numa-default-2M.args} (77%) rename tests/qemuxml2argvdata/{hugepages-pages2.xml => hugepages-numa-default-2M.xml} (77%) rename tests/qemuxml2xmloutdata/{hugepages-pages2.xml => hugepages-numa-default-2M.xml} (67%) diff --git a/tests/qemuxml2argvdata/hugepages-pages2.args b/tests/qemuxml2argvdata/hugepages-numa-default-2M.args similarity index 77% rename from tests/qemuxml2argvdata/hugepages-pages2.args rename to tests/qemuxml2argvdata/hugepages-numa-default-2M.args index 21105ef844..2dfacefe4a 100644 --- a/tests/qemuxml2argvdata/hugepages-pages2.args +++ b/tests/qemuxml2argvdata/hugepages-numa-default-2M.args @@ -25,7 +25,4 @@ path=/tmp/lib/domain--1-SomeDummyHugepagesGu/monitor.sock,server,nowait \ -no-shutdown \ -no-acpi \ -boot c \ --usb \ --drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \ --device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \ --device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 +-usb diff --git a/tests/qemuxml2argvdata/hugepages-pages2.xml b/tests/qemuxml2argvdata/hugepages-numa-default-2M.xml similarity index 77% rename from tests/qemuxml2argvdata/hugepages-pages2.xml rename to tests/qemuxml2argvdata/hugepages-numa-default-2M.xml index 3b2d72ef3c..357c77da2a 100644 --- a/tests/qemuxml2argvdata/hugepages-pages2.xml +++ b/tests/qemuxml2argvdata/hugepages-numa-default-2M.xml @@ -25,16 +25,10 @@ <on_crash>destroy</on_crash> <devices> <emulator>/usr/bin/qemu-system-i686</emulator> - <disk type='block' device='disk'> - <source dev='/dev/HostVG/QEMUGuest1'/> - <target dev='hda' bus='ide'/> - <address type='drive' controller='0' bus='0' target='0' unit='0'/> - </disk> <controller type='usb' index='0'/> - <controller type='ide' index='0'/> <controller type='pci' index='0' model='pci-root'/> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> - <memballoon model='virtio'/> + <memballoon model='none'/> </devices> </domain> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 2d94c20f40..697f3436c6 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -966,14 +966,15 @@ mymain(void) DO_TEST("hugepages-default", NONE); DO_TEST("hugepages-numa-default", QEMU_CAPS_OBJECT_MEMORY_FILE); + DO_TEST("hugepages-numa-default-2M", + QEMU_CAPS_OBJECT_MEMORY_RAM, + QEMU_CAPS_OBJECT_MEMORY_FILE); DO_TEST("hugepages-numa-default-dimm", QEMU_CAPS_DEVICE_PC_DIMM, QEMU_CAPS_OBJECT_MEMORY_FILE); DO_TEST("hugepages-numa-nodeset", QEMU_CAPS_OBJECT_MEMORY_RAM, 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, QEMU_CAPS_OBJECT_MEMORY_FILE, QEMU_CAPS_OBJECT_MEMORY_FILE_DISCARD); diff --git a/tests/qemuxml2xmloutdata/hugepages-pages2.xml b/tests/qemuxml2xmloutdata/hugepages-numa-default-2M.xml similarity index 67% rename from tests/qemuxml2xmloutdata/hugepages-pages2.xml rename to tests/qemuxml2xmloutdata/hugepages-numa-default-2M.xml index cd79960f1b..3777824e1a 100644 --- a/tests/qemuxml2xmloutdata/hugepages-pages2.xml +++ b/tests/qemuxml2xmloutdata/hugepages-numa-default-2M.xml @@ -25,23 +25,12 @@ <on_crash>destroy</on_crash> <devices> <emulator>/usr/bin/qemu-system-i686</emulator> - <disk type='block' device='disk'> - <driver name='qemu' type='raw'/> - <source dev='/dev/HostVG/QEMUGuest1'/> - <target dev='hda' bus='ide'/> - <address type='drive' controller='0' bus='0' target='0' unit='0'/> - </disk> <controller type='usb' index='0'> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> </controller> - <controller type='ide' index='0'> - <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> - </controller> <controller type='pci' index='0' model='pci-root'/> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> - <memballoon model='virtio'> - <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> - </memballoon> + <memballoon model='none'/> </devices> </domain> diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 1484c3176f..1e6aca2a90 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -331,9 +331,9 @@ mymain(void) DO_TEST("pages-discard", NONE); DO_TEST("hugepages-default", NONE); + DO_TEST("hugepages-numa-default-2M", NONE); DO_TEST("hugepages-numa-default-dimm", NONE); DO_TEST("hugepages-numa-nodeset", NONE); - DO_TEST("hugepages-pages2", NONE); DO_TEST("hugepages-pages3", NONE); DO_TEST("hugepages-pages4", NONE); DO_TEST("hugepages-pages5", NONE); -- 2.17.1

Similar thing happens as for pages-discard, it is not passed to QEMU. Signed-off-by: Pavel Hrdina <phrdina@redhat.com> --- tests/qemuxml2argvdata/hugepages-pages3.args | 3 +- tests/qemuxml2argvdata/hugepages-pages3.xml | 4 +-- .../pages-discard-hugepages.args | 28 +++++++++++++++ .../pages-discard-hugepages.xml | 34 +++++++++++++++++++ tests/qemuxml2argvtest.c | 7 ++-- tests/qemuxml2xmloutdata/hugepages-pages3.xml | 4 +-- .../pages-discard-hugepages.xml | 1 + tests/qemuxml2xmltest.c | 1 + 8 files changed, 74 insertions(+), 8 deletions(-) create mode 100644 tests/qemuxml2argvdata/pages-discard-hugepages.args create mode 100644 tests/qemuxml2argvdata/pages-discard-hugepages.xml create mode 120000 tests/qemuxml2xmloutdata/pages-discard-hugepages.xml diff --git a/tests/qemuxml2argvdata/hugepages-pages3.args b/tests/qemuxml2argvdata/hugepages-pages3.args index d55265cdd8..2fc701ca22 100644 --- a/tests/qemuxml2argvdata/hugepages-pages3.args +++ b/tests/qemuxml2argvdata/hugepages-pages3.args @@ -13,8 +13,7 @@ QEMU_AUDIO_DRV=none \ -object memory-backend-ram,id=ram-node0,size=268435456 \ -numa node,nodeid=0,cpus=0,memdev=ram-node0 \ -object memory-backend-file,id=ram-node1,prealloc=yes,\ -mem-path=/dev/hugepages1G/libvirt/qemu/-1-SomeDummyHugepagesGu,\ -discard-data=yes,size=805306368 \ +mem-path=/dev/hugepages1G/libvirt/qemu/-1-SomeDummyHugepagesGu,size=805306368 \ -numa node,nodeid=1,cpus=1,memdev=ram-node1 \ -uuid ef1bdff4-27f3-4e85-a807-5fb4d58463cc \ -display none \ diff --git a/tests/qemuxml2argvdata/hugepages-pages3.xml b/tests/qemuxml2argvdata/hugepages-pages3.xml index 147acc4c95..3d3b3f3cc3 100644 --- a/tests/qemuxml2argvdata/hugepages-pages3.xml +++ b/tests/qemuxml2argvdata/hugepages-pages3.xml @@ -15,8 +15,8 @@ </os> <cpu> <numa> - <cell id='0' cpus='0' memory='262144' unit='KiB' discard='no'/> - <cell id='1' cpus='1' memory='786432' unit='KiB' discard='yes'/> + <cell id='0' cpus='0' memory='262144' unit='KiB'/> + <cell id='1' cpus='1' memory='786432' unit='KiB'/> </numa> </cpu> <clock offset='utc'/> diff --git a/tests/qemuxml2argvdata/pages-discard-hugepages.args b/tests/qemuxml2argvdata/pages-discard-hugepages.args new file mode 100644 index 0000000000..2dfacefe4a --- /dev/null +++ b/tests/qemuxml2argvdata/pages-discard-hugepages.args @@ -0,0 +1,28 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/home/test \ +USER=test \ +LOGNAME=test \ +QEMU_AUDIO_DRV=none \ +/usr/bin/qemu-system-i686 \ +-name SomeDummyHugepagesGuest \ +-S \ +-machine pc,accel=tcg,usb=off,dump-guest-core=off \ +-m 1024 \ +-smp 2,sockets=2,cores=1,threads=1 \ +-mem-prealloc \ +-mem-path /dev/hugepages2M/libvirt/qemu/-1-SomeDummyHugepagesGu \ +-numa node,nodeid=0,cpus=0,mem=256 \ +-numa node,nodeid=1,cpus=1,mem=768 \ +-uuid ef1bdff4-27f3-4e85-a807-5fb4d58463cc \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=charmonitor,\ +path=/tmp/lib/domain--1-SomeDummyHugepagesGu/monitor.sock,server,nowait \ +-mon chardev=charmonitor,id=monitor,mode=control \ +-rtc base=utc \ +-no-shutdown \ +-no-acpi \ +-boot c \ +-usb diff --git a/tests/qemuxml2argvdata/pages-discard-hugepages.xml b/tests/qemuxml2argvdata/pages-discard-hugepages.xml new file mode 100644 index 0000000000..d1620d1946 --- /dev/null +++ b/tests/qemuxml2argvdata/pages-discard-hugepages.xml @@ -0,0 +1,34 @@ +<domain type='qemu'> + <name>SomeDummyHugepagesGuest</name> + <uuid>ef1bdff4-27f3-4e85-a807-5fb4d58463cc</uuid> + <memory unit='KiB'>1048576</memory> + <currentMemory unit='KiB'>1048576</currentMemory> + <memoryBacking> + <hugepages/> + </memoryBacking> + <vcpu placement='static'>2</vcpu> + <os> + <type arch='i686' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <cpu> + <numa> + <cell id='0' cpus='0' memory='262144' unit='KiB' discard='no'/> + <cell id='1' cpus='1' memory='786432' unit='KiB' discard='yes'/> + </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> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 697f3436c6..4f1c583327 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -963,6 +963,10 @@ mymain(void) DO_TEST("pages-discard", QEMU_CAPS_OBJECT_MEMORY_FILE, QEMU_CAPS_OBJECT_MEMORY_FILE_DISCARD); + DO_TEST("pages-discard-hugepages", + QEMU_CAPS_OBJECT_MEMORY_RAM, + 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); @@ -976,8 +980,7 @@ mymain(void) QEMU_CAPS_OBJECT_MEMORY_RAM, QEMU_CAPS_OBJECT_MEMORY_FILE); DO_TEST("hugepages-pages3", QEMU_CAPS_OBJECT_MEMORY_RAM, - QEMU_CAPS_OBJECT_MEMORY_FILE, - QEMU_CAPS_OBJECT_MEMORY_FILE_DISCARD); + QEMU_CAPS_OBJECT_MEMORY_FILE); DO_TEST("hugepages-shared", QEMU_CAPS_OBJECT_MEMORY_RAM, QEMU_CAPS_OBJECT_MEMORY_FILE); diff --git a/tests/qemuxml2xmloutdata/hugepages-pages3.xml b/tests/qemuxml2xmloutdata/hugepages-pages3.xml index 90e6efa5ea..be21c3eddd 100644 --- a/tests/qemuxml2xmloutdata/hugepages-pages3.xml +++ b/tests/qemuxml2xmloutdata/hugepages-pages3.xml @@ -15,8 +15,8 @@ </os> <cpu> <numa> - <cell id='0' cpus='0' memory='262144' unit='KiB' discard='no'/> - <cell id='1' cpus='1' memory='786432' unit='KiB' discard='yes'/> + <cell id='0' cpus='0' memory='262144' unit='KiB'/> + <cell id='1' cpus='1' memory='786432' unit='KiB'/> </numa> </cpu> <clock offset='utc'/> diff --git a/tests/qemuxml2xmloutdata/pages-discard-hugepages.xml b/tests/qemuxml2xmloutdata/pages-discard-hugepages.xml new file mode 120000 index 0000000000..3d2f0682dc --- /dev/null +++ b/tests/qemuxml2xmloutdata/pages-discard-hugepages.xml @@ -0,0 +1 @@ +../qemuxml2argvdata/pages-discard-hugepages.xml \ No newline at end of file diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 1e6aca2a90..186cd6c2e5 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -330,6 +330,7 @@ mymain(void) DO_TEST("pmu-feature-off", NONE); DO_TEST("pages-discard", NONE); + DO_TEST("pages-discard-hugepages", NONE); DO_TEST("hugepages-default", NONE); DO_TEST("hugepages-numa-default-2M", NONE); DO_TEST("hugepages-numa-default-dimm", NONE); -- 2.17.1

Remove unnecessary XML elements as well. Signed-off-by: Pavel Hrdina <phrdina@redhat.com> --- ...pages3.args => hugepages-numa-nodeset-part.args} | 5 +---- ...s-pages3.xml => hugepages-numa-nodeset-part.xml} | 8 +------- tests/qemuxml2argvtest.c | 3 ++- ...s-pages3.xml => hugepages-numa-nodeset-part.xml} | 13 +------------ tests/qemuxml2xmltest.c | 2 +- 5 files changed, 6 insertions(+), 25 deletions(-) rename tests/qemuxml2argvdata/{hugepages-pages3.args => hugepages-numa-nodeset-part.args} (80%) rename tests/qemuxml2argvdata/{hugepages-pages3.xml => hugepages-numa-nodeset-part.xml} (77%) rename tests/qemuxml2xmloutdata/{hugepages-pages3.xml => hugepages-numa-nodeset-part.xml} (67%) diff --git a/tests/qemuxml2argvdata/hugepages-pages3.args b/tests/qemuxml2argvdata/hugepages-numa-nodeset-part.args similarity index 80% rename from tests/qemuxml2argvdata/hugepages-pages3.args rename to tests/qemuxml2argvdata/hugepages-numa-nodeset-part.args index 2fc701ca22..9999071176 100644 --- a/tests/qemuxml2argvdata/hugepages-pages3.args +++ b/tests/qemuxml2argvdata/hugepages-numa-nodeset-part.args @@ -26,7 +26,4 @@ path=/tmp/lib/domain--1-SomeDummyHugepagesGu/monitor.sock,server,nowait \ -no-shutdown \ -no-acpi \ -boot c \ --usb \ --drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \ --device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \ --device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 +-usb diff --git a/tests/qemuxml2argvdata/hugepages-pages3.xml b/tests/qemuxml2argvdata/hugepages-numa-nodeset-part.xml similarity index 77% rename from tests/qemuxml2argvdata/hugepages-pages3.xml rename to tests/qemuxml2argvdata/hugepages-numa-nodeset-part.xml index 3d3b3f3cc3..b19bdedb36 100644 --- a/tests/qemuxml2argvdata/hugepages-pages3.xml +++ b/tests/qemuxml2argvdata/hugepages-numa-nodeset-part.xml @@ -25,16 +25,10 @@ <on_crash>destroy</on_crash> <devices> <emulator>/usr/bin/qemu-system-i686</emulator> - <disk type='block' device='disk'> - <source dev='/dev/HostVG/QEMUGuest1'/> - <target dev='hda' bus='ide'/> - <address type='drive' controller='0' bus='0' target='0' unit='0'/> - </disk> <controller type='usb' index='0'/> - <controller type='ide' index='0'/> <controller type='pci' index='0' model='pci-root'/> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> - <memballoon model='virtio'/> + <memballoon model='none'/> </devices> </domain> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 4f1c583327..b2ee1fe6bb 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -979,7 +979,8 @@ mymain(void) DO_TEST("hugepages-numa-nodeset", QEMU_CAPS_OBJECT_MEMORY_RAM, QEMU_CAPS_OBJECT_MEMORY_FILE); - DO_TEST("hugepages-pages3", QEMU_CAPS_OBJECT_MEMORY_RAM, + DO_TEST("hugepages-numa-nodeset-part", + QEMU_CAPS_OBJECT_MEMORY_RAM, QEMU_CAPS_OBJECT_MEMORY_FILE); DO_TEST("hugepages-shared", QEMU_CAPS_OBJECT_MEMORY_RAM, diff --git a/tests/qemuxml2xmloutdata/hugepages-pages3.xml b/tests/qemuxml2xmloutdata/hugepages-numa-nodeset-part.xml similarity index 67% rename from tests/qemuxml2xmloutdata/hugepages-pages3.xml rename to tests/qemuxml2xmloutdata/hugepages-numa-nodeset-part.xml index be21c3eddd..1230edfd02 100644 --- a/tests/qemuxml2xmloutdata/hugepages-pages3.xml +++ b/tests/qemuxml2xmloutdata/hugepages-numa-nodeset-part.xml @@ -25,23 +25,12 @@ <on_crash>destroy</on_crash> <devices> <emulator>/usr/bin/qemu-system-i686</emulator> - <disk type='block' device='disk'> - <driver name='qemu' type='raw'/> - <source dev='/dev/HostVG/QEMUGuest1'/> - <target dev='hda' bus='ide'/> - <address type='drive' controller='0' bus='0' target='0' unit='0'/> - </disk> <controller type='usb' index='0'> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> </controller> - <controller type='ide' index='0'> - <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> - </controller> <controller type='pci' index='0' model='pci-root'/> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> - <memballoon model='virtio'> - <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> - </memballoon> + <memballoon model='none'/> </devices> </domain> diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 186cd6c2e5..29dc03e805 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -335,7 +335,7 @@ mymain(void) DO_TEST("hugepages-numa-default-2M", NONE); DO_TEST("hugepages-numa-default-dimm", NONE); DO_TEST("hugepages-numa-nodeset", NONE); - DO_TEST("hugepages-pages3", NONE); + DO_TEST("hugepages-numa-nodeset-part", NONE); DO_TEST("hugepages-pages4", NONE); DO_TEST("hugepages-pages5", NONE); DO_TEST("hugepages-pages6", NONE); -- 2.17.1

Remove unnecessary XML elements as well. Signed-off-by: Pavel Hrdina <phrdina@redhat.com> --- ....xml => hugepages-numa-nodeset-nonexist.xml} | 17 +---------------- tests/qemuxml2argvtest.c | 5 +++-- .../hugepages-numa-nodeset-nonexist.xml | 1 + tests/qemuxml2xmloutdata/hugepages-pages4.xml | 1 - tests/qemuxml2xmltest.c | 2 +- 5 files changed, 6 insertions(+), 20 deletions(-) rename tests/qemuxml2argvdata/{hugepages-pages4.xml => hugepages-numa-nodeset-nonexist.xml} (66%) create mode 120000 tests/qemuxml2xmloutdata/hugepages-numa-nodeset-nonexist.xml delete mode 120000 tests/qemuxml2xmloutdata/hugepages-pages4.xml diff --git a/tests/qemuxml2argvdata/hugepages-pages4.xml b/tests/qemuxml2argvdata/hugepages-numa-nodeset-nonexist.xml similarity index 66% rename from tests/qemuxml2argvdata/hugepages-pages4.xml rename to tests/qemuxml2argvdata/hugepages-numa-nodeset-nonexist.xml index 9f79881a59..8211d72be9 100644 --- a/tests/qemuxml2argvdata/hugepages-pages4.xml +++ b/tests/qemuxml2argvdata/hugepages-numa-nodeset-nonexist.xml @@ -10,10 +10,6 @@ </hugepages> </memoryBacking> <vcpu placement='static'>4</vcpu> - <numatune> - <memory mode='strict' nodeset='0-3'/> - <memnode cellid='3' mode='strict' nodeset='3'/> - </numatune> <os> <type arch='i686' machine='pc'>hvm</type> <boot dev='hd'/> @@ -32,23 +28,12 @@ <on_crash>destroy</on_crash> <devices> <emulator>/usr/bin/qemu-system-i686</emulator> - <disk type='block' device='disk'> - <driver name='qemu' type='raw'/> - <source dev='/dev/HostVG/QEMUGuest1'/> - <target dev='hda' bus='ide'/> - <address type='drive' controller='0' bus='0' target='0' unit='0'/> - </disk> <controller type='usb' index='0'> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> </controller> - <controller type='ide' index='0'> - <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> - </controller> <controller type='pci' index='0' model='pci-root'/> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> - <memballoon model='virtio'> - <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> - </memballoon> + <memballoon model='none'/> </devices> </domain> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index b2ee1fe6bb..d4a6738b98 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -982,12 +982,13 @@ mymain(void) DO_TEST("hugepages-numa-nodeset-part", QEMU_CAPS_OBJECT_MEMORY_RAM, QEMU_CAPS_OBJECT_MEMORY_FILE); + DO_TEST_FAILURE("hugepages-numa-nodeset-nonexist", + QEMU_CAPS_OBJECT_MEMORY_RAM, + QEMU_CAPS_OBJECT_MEMORY_FILE); DO_TEST("hugepages-shared", QEMU_CAPS_OBJECT_MEMORY_RAM, QEMU_CAPS_OBJECT_MEMORY_FILE); DO_TEST_PARSE_ERROR("hugepages-memaccess-invalid", NONE); - DO_TEST_FAILURE("hugepages-pages4", - QEMU_CAPS_OBJECT_MEMORY_RAM, QEMU_CAPS_OBJECT_MEMORY_FILE); DO_TEST("hugepages-pages5", NONE); DO_TEST("hugepages-pages6", NONE); DO_TEST("hugepages-pages7", diff --git a/tests/qemuxml2xmloutdata/hugepages-numa-nodeset-nonexist.xml b/tests/qemuxml2xmloutdata/hugepages-numa-nodeset-nonexist.xml new file mode 120000 index 0000000000..d490edca69 --- /dev/null +++ b/tests/qemuxml2xmloutdata/hugepages-numa-nodeset-nonexist.xml @@ -0,0 +1 @@ +../qemuxml2argvdata/hugepages-numa-nodeset-nonexist.xml \ No newline at end of file diff --git a/tests/qemuxml2xmloutdata/hugepages-pages4.xml b/tests/qemuxml2xmloutdata/hugepages-pages4.xml deleted file mode 120000 index 127e66e64f..0000000000 --- a/tests/qemuxml2xmloutdata/hugepages-pages4.xml +++ /dev/null @@ -1 +0,0 @@ -../qemuxml2argvdata/hugepages-pages4.xml \ No newline at end of file diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 29dc03e805..92dfa87e24 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -336,7 +336,7 @@ mymain(void) DO_TEST("hugepages-numa-default-dimm", NONE); DO_TEST("hugepages-numa-nodeset", NONE); DO_TEST("hugepages-numa-nodeset-part", NONE); - DO_TEST("hugepages-pages4", NONE); + DO_TEST("hugepages-numa-nodeset-nonexist", NONE); DO_TEST("hugepages-pages5", NONE); DO_TEST("hugepages-pages6", NONE); DO_TEST("hugepages-pages7", NONE); -- 2.17.1

Remove unnecessary XML elements as well. Signed-off-by: Pavel Hrdina <phrdina@redhat.com> --- ...epages-pages5.args => hugepages-default-2M.args} | 5 +---- ...ugepages-pages5.xml => hugepages-default-2M.xml} | 13 +------------ tests/qemuxml2argvtest.c | 2 +- tests/qemuxml2xmloutdata/hugepages-default-2M.xml | 1 + tests/qemuxml2xmloutdata/hugepages-pages5.xml | 1 - tests/qemuxml2xmltest.c | 2 +- 6 files changed, 5 insertions(+), 19 deletions(-) rename tests/qemuxml2argvdata/{hugepages-pages5.args => hugepages-default-2M.args} (75%) rename tests/qemuxml2argvdata/{hugepages-pages5.xml => hugepages-default-2M.xml} (63%) create mode 120000 tests/qemuxml2xmloutdata/hugepages-default-2M.xml delete mode 120000 tests/qemuxml2xmloutdata/hugepages-pages5.xml diff --git a/tests/qemuxml2argvdata/hugepages-pages5.args b/tests/qemuxml2argvdata/hugepages-default-2M.args similarity index 75% rename from tests/qemuxml2argvdata/hugepages-pages5.args rename to tests/qemuxml2argvdata/hugepages-default-2M.args index dc13abed10..d094be1252 100644 --- a/tests/qemuxml2argvdata/hugepages-pages5.args +++ b/tests/qemuxml2argvdata/hugepages-default-2M.args @@ -23,7 +23,4 @@ path=/tmp/lib/domain--1-SomeDummyHugepagesGu/monitor.sock,server,nowait \ -no-shutdown \ -no-acpi \ -boot c \ --usb \ --drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \ --device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \ --device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 +-usb diff --git a/tests/qemuxml2argvdata/hugepages-pages5.xml b/tests/qemuxml2argvdata/hugepages-default-2M.xml similarity index 63% rename from tests/qemuxml2argvdata/hugepages-pages5.xml rename to tests/qemuxml2argvdata/hugepages-default-2M.xml index f636c186de..ac219a7800 100644 --- a/tests/qemuxml2argvdata/hugepages-pages5.xml +++ b/tests/qemuxml2argvdata/hugepages-default-2M.xml @@ -19,23 +19,12 @@ <on_crash>destroy</on_crash> <devices> <emulator>/usr/bin/qemu-system-i686</emulator> - <disk type='block' device='disk'> - <driver name='qemu' type='raw'/> - <source dev='/dev/HostVG/QEMUGuest1'/> - <target dev='hda' bus='ide'/> - <address type='drive' controller='0' bus='0' target='0' unit='0'/> - </disk> <controller type='usb' index='0'> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> </controller> - <controller type='ide' index='0'> - <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> - </controller> <controller type='pci' index='0' model='pci-root'/> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> - <memballoon model='virtio'> - <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> - </memballoon> + <memballoon model='none'/> </devices> </domain> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index d4a6738b98..5ce77cb69e 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -968,6 +968,7 @@ mymain(void) QEMU_CAPS_OBJECT_MEMORY_FILE, QEMU_CAPS_OBJECT_MEMORY_FILE_DISCARD); DO_TEST("hugepages-default", NONE); + DO_TEST("hugepages-default-2M", NONE); DO_TEST("hugepages-numa-default", QEMU_CAPS_OBJECT_MEMORY_FILE); DO_TEST("hugepages-numa-default-2M", @@ -989,7 +990,6 @@ mymain(void) QEMU_CAPS_OBJECT_MEMORY_RAM, QEMU_CAPS_OBJECT_MEMORY_FILE); DO_TEST_PARSE_ERROR("hugepages-memaccess-invalid", NONE); - DO_TEST("hugepages-pages5", NONE); DO_TEST("hugepages-pages6", NONE); DO_TEST("hugepages-pages7", QEMU_CAPS_DEVICE_PC_DIMM, QEMU_CAPS_OBJECT_MEMORY_FILE, diff --git a/tests/qemuxml2xmloutdata/hugepages-default-2M.xml b/tests/qemuxml2xmloutdata/hugepages-default-2M.xml new file mode 120000 index 0000000000..8786948fdd --- /dev/null +++ b/tests/qemuxml2xmloutdata/hugepages-default-2M.xml @@ -0,0 +1 @@ +../qemuxml2argvdata/hugepages-default-2M.xml \ No newline at end of file diff --git a/tests/qemuxml2xmloutdata/hugepages-pages5.xml b/tests/qemuxml2xmloutdata/hugepages-pages5.xml deleted file mode 120000 index cfead1c317..0000000000 --- a/tests/qemuxml2xmloutdata/hugepages-pages5.xml +++ /dev/null @@ -1 +0,0 @@ -../qemuxml2argvdata/hugepages-pages5.xml \ No newline at end of file diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 92dfa87e24..0949c45092 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -332,12 +332,12 @@ mymain(void) DO_TEST("pages-discard", NONE); DO_TEST("pages-discard-hugepages", NONE); DO_TEST("hugepages-default", NONE); + DO_TEST("hugepages-default-2M", NONE); DO_TEST("hugepages-numa-default-2M", NONE); DO_TEST("hugepages-numa-default-dimm", NONE); DO_TEST("hugepages-numa-nodeset", NONE); DO_TEST("hugepages-numa-nodeset-part", NONE); DO_TEST("hugepages-numa-nodeset-nonexist", NONE); - DO_TEST("hugepages-pages5", NONE); DO_TEST("hugepages-pages6", NONE); DO_TEST("hugepages-pages7", NONE); DO_TEST("hugepages-shared", NONE); -- 2.17.1

Remove unnecessary XML elements as well. Signed-off-by: Pavel Hrdina <phrdina@redhat.com> --- ...ges6.args => hugepages-default-system-size.args} | 5 +---- ...pages6.xml => hugepages-default-system-size.xml} | 13 +------------ tests/qemuxml2argvtest.c | 2 +- .../hugepages-default-system-size.xml | 1 + tests/qemuxml2xmloutdata/hugepages-pages6.xml | 1 - tests/qemuxml2xmltest.c | 2 +- 6 files changed, 5 insertions(+), 19 deletions(-) rename tests/qemuxml2argvdata/{hugepages-pages6.args => hugepages-default-system-size.args} (72%) rename tests/qemuxml2argvdata/{hugepages-pages6.xml => hugepages-default-system-size.xml} (63%) create mode 120000 tests/qemuxml2xmloutdata/hugepages-default-system-size.xml delete mode 120000 tests/qemuxml2xmloutdata/hugepages-pages6.xml diff --git a/tests/qemuxml2argvdata/hugepages-pages6.args b/tests/qemuxml2argvdata/hugepages-default-system-size.args similarity index 72% rename from tests/qemuxml2argvdata/hugepages-pages6.args rename to tests/qemuxml2argvdata/hugepages-default-system-size.args index 51467c0ae1..eeb7d142ce 100644 --- a/tests/qemuxml2argvdata/hugepages-pages6.args +++ b/tests/qemuxml2argvdata/hugepages-default-system-size.args @@ -21,7 +21,4 @@ path=/tmp/lib/domain--1-SomeDummyHugepagesGu/monitor.sock,server,nowait \ -no-shutdown \ -no-acpi \ -boot c \ --usb \ --drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \ --device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \ --device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 +-usb diff --git a/tests/qemuxml2argvdata/hugepages-pages6.xml b/tests/qemuxml2argvdata/hugepages-default-system-size.xml similarity index 63% rename from tests/qemuxml2argvdata/hugepages-pages6.xml rename to tests/qemuxml2argvdata/hugepages-default-system-size.xml index fc4f57fbc0..8a809ead5e 100644 --- a/tests/qemuxml2argvdata/hugepages-pages6.xml +++ b/tests/qemuxml2argvdata/hugepages-default-system-size.xml @@ -19,23 +19,12 @@ <on_crash>destroy</on_crash> <devices> <emulator>/usr/bin/qemu-system-i686</emulator> - <disk type='block' device='disk'> - <driver name='qemu' type='raw'/> - <source dev='/dev/HostVG/QEMUGuest1'/> - <target dev='hda' bus='ide'/> - <address type='drive' controller='0' bus='0' target='0' unit='0'/> - </disk> <controller type='usb' index='0'> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> </controller> - <controller type='ide' index='0'> - <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> - </controller> <controller type='pci' index='0' model='pci-root'/> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> - <memballoon model='virtio'> - <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> - </memballoon> + <memballoon model='none'/> </devices> </domain> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 5ce77cb69e..ea7103f93c 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -969,6 +969,7 @@ mymain(void) QEMU_CAPS_OBJECT_MEMORY_FILE_DISCARD); DO_TEST("hugepages-default", NONE); DO_TEST("hugepages-default-2M", NONE); + DO_TEST("hugepages-default-system-size", NONE); DO_TEST("hugepages-numa-default", QEMU_CAPS_OBJECT_MEMORY_FILE); DO_TEST("hugepages-numa-default-2M", @@ -990,7 +991,6 @@ mymain(void) QEMU_CAPS_OBJECT_MEMORY_RAM, QEMU_CAPS_OBJECT_MEMORY_FILE); DO_TEST_PARSE_ERROR("hugepages-memaccess-invalid", NONE); - DO_TEST("hugepages-pages6", NONE); DO_TEST("hugepages-pages7", QEMU_CAPS_DEVICE_PC_DIMM, QEMU_CAPS_OBJECT_MEMORY_FILE, QEMU_CAPS_OBJECT_MEMORY_FILE_DISCARD); diff --git a/tests/qemuxml2xmloutdata/hugepages-default-system-size.xml b/tests/qemuxml2xmloutdata/hugepages-default-system-size.xml new file mode 120000 index 0000000000..e64e3fb282 --- /dev/null +++ b/tests/qemuxml2xmloutdata/hugepages-default-system-size.xml @@ -0,0 +1 @@ +../qemuxml2argvdata/hugepages-default-system-size.xml \ No newline at end of file diff --git a/tests/qemuxml2xmloutdata/hugepages-pages6.xml b/tests/qemuxml2xmloutdata/hugepages-pages6.xml deleted file mode 120000 index 584b7c92c8..0000000000 --- a/tests/qemuxml2xmloutdata/hugepages-pages6.xml +++ /dev/null @@ -1 +0,0 @@ -../qemuxml2argvdata/hugepages-pages6.xml \ No newline at end of file diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 0949c45092..8b8ab1d939 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -333,12 +333,12 @@ mymain(void) DO_TEST("pages-discard-hugepages", NONE); DO_TEST("hugepages-default", NONE); DO_TEST("hugepages-default-2M", NONE); + DO_TEST("hugepages-default-system-size", NONE); DO_TEST("hugepages-numa-default-2M", NONE); DO_TEST("hugepages-numa-default-dimm", NONE); DO_TEST("hugepages-numa-nodeset", NONE); DO_TEST("hugepages-numa-nodeset-part", NONE); DO_TEST("hugepages-numa-nodeset-nonexist", NONE); - DO_TEST("hugepages-pages6", NONE); DO_TEST("hugepages-pages7", NONE); DO_TEST("hugepages-shared", NONE); DO_TEST("hugepages-memaccess", NONE); -- 2.17.1

Remove unnecessary XML elements as well. Signed-off-by: Pavel Hrdina <phrdina@redhat.com> --- ...ges-pages7.args => pages-dimm-discard.args} | 16 +++++----------- ...pages-pages7.xml => pages-dimm-discard.xml} | 18 +----------------- tests/qemuxml2argvtest.c | 7 ++++--- tests/qemuxml2xmloutdata/hugepages-pages7.xml | 1 - .../qemuxml2xmloutdata/pages-dimm-discard.xml | 1 + tests/qemuxml2xmltest.c | 2 +- 6 files changed, 12 insertions(+), 33 deletions(-) rename tests/qemuxml2argvdata/{hugepages-pages7.args => pages-dimm-discard.args} (65%) rename tests/qemuxml2argvdata/{hugepages-pages7.xml => pages-dimm-discard.xml} (73%) delete mode 120000 tests/qemuxml2xmloutdata/hugepages-pages7.xml create mode 120000 tests/qemuxml2xmloutdata/pages-dimm-discard.xml diff --git a/tests/qemuxml2argvdata/hugepages-pages7.args b/tests/qemuxml2argvdata/pages-dimm-discard.args similarity index 65% rename from tests/qemuxml2argvdata/hugepages-pages7.args rename to tests/qemuxml2argvdata/pages-dimm-discard.args index 02a98026eb..97184e074a 100644 --- a/tests/qemuxml2argvdata/hugepages-pages7.args +++ b/tests/qemuxml2argvdata/pages-dimm-discard.args @@ -10,16 +10,14 @@ QEMU_AUDIO_DRV=none \ -machine pc-i440fx-2.3,accel=tcg,usb=off,dump-guest-core=off \ -m size=1048576k,slots=16,maxmem=1099511627776k \ -smp 2,sockets=2,cores=1,threads=1 \ --mem-prealloc \ --mem-path /dev/hugepages2M/libvirt/qemu/-1-fedora \ -numa node,nodeid=0,cpus=0-1,mem=1024 \ -object memory-backend-file,id=memdimm0,prealloc=yes,\ mem-path=/dev/hugepages1G/libvirt/qemu/-1-fedora,size=1073741824,\ host-nodes=1-3,policy=bind \ -device pc-dimm,node=0,memdev=memdimm0,id=dimm0,slot=0 \ --object memory-backend-file,id=memdimm1,prealloc=yes,\ -mem-path=/dev/hugepages2M/libvirt/qemu/-1-fedora,discard-data=yes,share=no,\ -size=536870912 \ +-object memory-backend-file,id=memdimm1,\ +mem-path=/var/lib/libvirt/qemu/ram/libvirt/qemu/-1-fedora/dimm1,\ +discard-data=yes,share=no,size=536870912 \ -device pc-dimm,node=0,memdev=memdimm1,id=dimm1,slot=1 \ -uuid 63840878-0deb-4095-97e6-fc444d9bc9fa \ -display none \ @@ -30,10 +28,6 @@ server,nowait \ -mon chardev=charmonitor,id=monitor,mode=control \ -rtc base=utc \ -no-shutdown \ +-no-acpi \ -boot c \ --usb \ --drive file=/var/lib/libvirt/images/fedora.qcow2,format=qcow2,if=none,\ -id=drive-virtio-disk0 \ --device virtio-blk-pci,bus=pci.0,addr=0x7,drive=drive-virtio-disk0,\ -id=virtio-disk0 \ --device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 +-usb diff --git a/tests/qemuxml2argvdata/hugepages-pages7.xml b/tests/qemuxml2argvdata/pages-dimm-discard.xml similarity index 73% rename from tests/qemuxml2argvdata/hugepages-pages7.xml rename to tests/qemuxml2argvdata/pages-dimm-discard.xml index 28c72f85a7..3d233687e1 100644 --- a/tests/qemuxml2argvdata/hugepages-pages7.xml +++ b/tests/qemuxml2argvdata/pages-dimm-discard.xml @@ -4,19 +4,11 @@ <maxMemory slots='16' unit='KiB'>1099511627776</maxMemory> <memory unit='KiB'>2621439</memory> <currentMemory unit='KiB'>2621439</currentMemory> - <memoryBacking> - <hugepages/> - </memoryBacking> <vcpu placement='static'>2</vcpu> <os> <type arch='x86_64' machine='pc-i440fx-2.3'>hvm</type> <boot dev='hd'/> </os> - <features> - <acpi/> - <apic/> - <pae/> - </features> <cpu> <numa> <cell id='0' cpus='0-1' memory='1048576' unit='KiB'/> @@ -28,21 +20,13 @@ <on_crash>restart</on_crash> <devices> <emulator>/usr/bin/qemu-system-x86_64</emulator> - <disk type='file' device='disk'> - <driver name='qemu' type='qcow2'/> - <source file='/var/lib/libvirt/images/fedora.qcow2'/> - <target dev='vda' bus='virtio'/> - <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/> - </disk> <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='virtio'> - <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> - </memballoon> + <memballoon model='none'/> <memory model='dimm' discard='no'> <source> <nodemask>1-3</nodemask> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index ea7103f93c..2c1473f3f8 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -967,6 +967,10 @@ mymain(void) QEMU_CAPS_OBJECT_MEMORY_RAM, QEMU_CAPS_OBJECT_MEMORY_FILE, QEMU_CAPS_OBJECT_MEMORY_FILE_DISCARD); + DO_TEST("pages-dimm-discard", + QEMU_CAPS_DEVICE_PC_DIMM, + QEMU_CAPS_OBJECT_MEMORY_FILE, + QEMU_CAPS_OBJECT_MEMORY_FILE_DISCARD); DO_TEST("hugepages-default", NONE); DO_TEST("hugepages-default-2M", NONE); DO_TEST("hugepages-default-system-size", NONE); @@ -991,9 +995,6 @@ mymain(void) QEMU_CAPS_OBJECT_MEMORY_RAM, QEMU_CAPS_OBJECT_MEMORY_FILE); DO_TEST_PARSE_ERROR("hugepages-memaccess-invalid", NONE); - DO_TEST("hugepages-pages7", - QEMU_CAPS_DEVICE_PC_DIMM, QEMU_CAPS_OBJECT_MEMORY_FILE, - QEMU_CAPS_OBJECT_MEMORY_FILE_DISCARD); DO_TEST_FAILURE("hugepages-pages8", QEMU_CAPS_DEVICE_PC_DIMM, QEMU_CAPS_OBJECT_MEMORY_FILE, QEMU_CAPS_OBJECT_MEMORY_FILE_DISCARD); diff --git a/tests/qemuxml2xmloutdata/hugepages-pages7.xml b/tests/qemuxml2xmloutdata/hugepages-pages7.xml deleted file mode 120000 index b4ce4defda..0000000000 --- a/tests/qemuxml2xmloutdata/hugepages-pages7.xml +++ /dev/null @@ -1 +0,0 @@ -../qemuxml2argvdata/hugepages-pages7.xml \ No newline at end of file diff --git a/tests/qemuxml2xmloutdata/pages-dimm-discard.xml b/tests/qemuxml2xmloutdata/pages-dimm-discard.xml new file mode 120000 index 0000000000..05bbef8d65 --- /dev/null +++ b/tests/qemuxml2xmloutdata/pages-dimm-discard.xml @@ -0,0 +1 @@ +../qemuxml2argvdata/pages-dimm-discard.xml \ No newline at end of file diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 8b8ab1d939..0b965d3401 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -331,6 +331,7 @@ mymain(void) DO_TEST("pages-discard", NONE); DO_TEST("pages-discard-hugepages", NONE); + DO_TEST("pages-dimm-discard", NONE); DO_TEST("hugepages-default", NONE); DO_TEST("hugepages-default-2M", NONE); DO_TEST("hugepages-default-system-size", NONE); @@ -339,7 +340,6 @@ mymain(void) DO_TEST("hugepages-numa-nodeset", NONE); DO_TEST("hugepages-numa-nodeset-part", NONE); DO_TEST("hugepages-numa-nodeset-nonexist", NONE); - DO_TEST("hugepages-pages7", NONE); DO_TEST("hugepages-shared", NONE); DO_TEST("hugepages-memaccess", NONE); DO_TEST("hugepages-memaccess2", NONE); -- 2.17.1

Remove unnecessary XML elements as well. Signed-off-by: Pavel Hrdina <phrdina@redhat.com> --- ...es-pages8.xml => hugepages-nodeset-nonexist.xml} | 13 +------------ tests/qemuxml2argvtest.c | 7 ++++--- 2 files changed, 5 insertions(+), 15 deletions(-) rename tests/qemuxml2argvdata/{hugepages-pages8.xml => hugepages-nodeset-nonexist.xml} (64%) diff --git a/tests/qemuxml2argvdata/hugepages-pages8.xml b/tests/qemuxml2argvdata/hugepages-nodeset-nonexist.xml similarity index 64% rename from tests/qemuxml2argvdata/hugepages-pages8.xml rename to tests/qemuxml2argvdata/hugepages-nodeset-nonexist.xml index 4cf4c1a8ad..477d3f1f2b 100644 --- a/tests/qemuxml2argvdata/hugepages-pages8.xml +++ b/tests/qemuxml2argvdata/hugepages-nodeset-nonexist.xml @@ -19,23 +19,12 @@ <on_crash>destroy</on_crash> <devices> <emulator>/usr/bin/qemu-system-i686</emulator> - <disk type='block' device='disk'> - <driver name='qemu' type='raw'/> - <source dev='/dev/HostVG/QEMUGuest1'/> - <target dev='hda' bus='ide'/> - <address type='drive' controller='0' bus='0' target='0' unit='0'/> - </disk> <controller type='usb' index='0'> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> </controller> - <controller type='ide' index='0'> - <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> - </controller> <controller type='pci' index='0' model='pci-root'/> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> - <memballoon model='virtio'> - <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> - </memballoon> + <memballoon model='none'/> </devices> </domain> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 2c1473f3f8..54bcfdf3f7 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -974,6 +974,10 @@ mymain(void) DO_TEST("hugepages-default", NONE); DO_TEST("hugepages-default-2M", NONE); DO_TEST("hugepages-default-system-size", NONE); + DO_TEST_FAILURE("hugepages-nodeset-nonexist", + QEMU_CAPS_DEVICE_PC_DIMM, + QEMU_CAPS_OBJECT_MEMORY_FILE, + QEMU_CAPS_OBJECT_MEMORY_FILE_DISCARD); DO_TEST("hugepages-numa-default", QEMU_CAPS_OBJECT_MEMORY_FILE); DO_TEST("hugepages-numa-default-2M", @@ -995,9 +999,6 @@ mymain(void) QEMU_CAPS_OBJECT_MEMORY_RAM, QEMU_CAPS_OBJECT_MEMORY_FILE); DO_TEST_PARSE_ERROR("hugepages-memaccess-invalid", NONE); - DO_TEST_FAILURE("hugepages-pages8", - QEMU_CAPS_DEVICE_PC_DIMM, QEMU_CAPS_OBJECT_MEMORY_FILE, - QEMU_CAPS_OBJECT_MEMORY_FILE_DISCARD); DO_TEST("hugepages-memaccess", QEMU_CAPS_OBJECT_MEMORY_FILE, QEMU_CAPS_OBJECT_MEMORY_RAM, QEMU_CAPS_DEVICE_PC_DIMM, QEMU_CAPS_NUMA); -- 2.17.1

This test case is currently working but it uncovers existing issue in our code that the generated QEMU commandline uses the default 1G hugepage instead of the 2M hugepage specified for exact node. The issue in our code is that for non-numa guests we take into account only the first hugepage. This will be fixed as invalid configuration since it doesn't make any sense to set default and specific hugepage for non-numa guest. Signed-off-by: Pavel Hrdina <phrdina@redhat.com> --- .../hugepages-default-1G-nodeset-2M.args | 26 ++++++++++++++++ .../hugepages-default-1G-nodeset-2M.xml | 31 +++++++++++++++++++ tests/qemuxml2argvtest.c | 1 + .../hugepages-default-1G-nodeset-2M.xml | 1 + tests/qemuxml2xmltest.c | 1 + 5 files changed, 60 insertions(+) create mode 100644 tests/qemuxml2argvdata/hugepages-default-1G-nodeset-2M.args create mode 100644 tests/qemuxml2argvdata/hugepages-default-1G-nodeset-2M.xml create mode 120000 tests/qemuxml2xmloutdata/hugepages-default-1G-nodeset-2M.xml diff --git a/tests/qemuxml2argvdata/hugepages-default-1G-nodeset-2M.args b/tests/qemuxml2argvdata/hugepages-default-1G-nodeset-2M.args new file mode 100644 index 0000000000..d1f8974032 --- /dev/null +++ b/tests/qemuxml2argvdata/hugepages-default-1G-nodeset-2M.args @@ -0,0 +1,26 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/home/test \ +USER=test \ +LOGNAME=test \ +QEMU_AUDIO_DRV=none \ +/usr/bin/qemu-system-i686 \ +-name SomeDummyHugepagesGuest \ +-S \ +-machine pc,accel=tcg,usb=off,dump-guest-core=off \ +-m 1024 \ +-mem-prealloc \ +-mem-path /dev/hugepages1G/libvirt/qemu/-1-SomeDummyHugepagesGu \ +-smp 2,sockets=2,cores=1,threads=1 \ +-uuid ef1bdff4-27f3-4e85-a807-5fb4d58463cc \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=charmonitor,\ +path=/tmp/lib/domain--1-SomeDummyHugepagesGu/monitor.sock,server,nowait \ +-mon chardev=charmonitor,id=monitor,mode=control \ +-rtc base=utc \ +-no-shutdown \ +-no-acpi \ +-boot c \ +-usb diff --git a/tests/qemuxml2argvdata/hugepages-default-1G-nodeset-2M.xml b/tests/qemuxml2argvdata/hugepages-default-1G-nodeset-2M.xml new file mode 100644 index 0000000000..eb0943b105 --- /dev/null +++ b/tests/qemuxml2argvdata/hugepages-default-1G-nodeset-2M.xml @@ -0,0 +1,31 @@ +<domain type='qemu'> + <name>SomeDummyHugepagesGuest</name> + <uuid>ef1bdff4-27f3-4e85-a807-5fb4d58463cc</uuid> + <memory unit='KiB'>1048576</memory> + <currentMemory unit='KiB'>1048576</currentMemory> + <memoryBacking> + <hugepages> + <page size='1048576' unit='KiB'/> + <page size='2048' unit='KiB' nodeset='0'/> + </hugepages> + </memoryBacking> + <vcpu placement='static'>2</vcpu> + <os> + <type arch='i686' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <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> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 54bcfdf3f7..273be61db3 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -974,6 +974,7 @@ mymain(void) DO_TEST("hugepages-default", NONE); DO_TEST("hugepages-default-2M", NONE); DO_TEST("hugepages-default-system-size", NONE); + DO_TEST("hugepages-default-1G-nodeset-2M", NONE); DO_TEST_FAILURE("hugepages-nodeset-nonexist", QEMU_CAPS_DEVICE_PC_DIMM, QEMU_CAPS_OBJECT_MEMORY_FILE, diff --git a/tests/qemuxml2xmloutdata/hugepages-default-1G-nodeset-2M.xml b/tests/qemuxml2xmloutdata/hugepages-default-1G-nodeset-2M.xml new file mode 120000 index 0000000000..3d8eb7616e --- /dev/null +++ b/tests/qemuxml2xmloutdata/hugepages-default-1G-nodeset-2M.xml @@ -0,0 +1 @@ +../qemuxml2argvdata/hugepages-default-1G-nodeset-2M.xml \ No newline at end of file diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 0b965d3401..958b955810 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -335,6 +335,7 @@ mymain(void) DO_TEST("hugepages-default", NONE); DO_TEST("hugepages-default-2M", NONE); DO_TEST("hugepages-default-system-size", NONE); + DO_TEST("hugepages-default-1G-nodeset-2M", NONE); DO_TEST("hugepages-numa-default-2M", NONE); DO_TEST("hugepages-numa-default-dimm", NONE); DO_TEST("hugepages-numa-nodeset", NONE); -- 2.17.1

This use-case was broken by commit <fa6bdf6afa878b8d7c5ed71664ee72be8967cdc5>. We allowed this configuration and it was working as expected therefore we can consider it as regression. We should have never allowed such configuration so now the best solution is in case of non-numa guest silently ignore the 'nodeset' attribute if it's set to '0'. That will be fixed by following patches. Signed-off-by: Pavel Hrdina <phrdina@redhat.com> --- tests/qemuxml2argvdata/hugepages-nodeset.xml | 30 +++++++++++++++++++ tests/qemuxml2argvtest.c | 1 + .../qemuxml2xmloutdata/hugepages-nodeset.xml | 1 + tests/qemuxml2xmltest.c | 1 + 4 files changed, 33 insertions(+) create mode 100644 tests/qemuxml2argvdata/hugepages-nodeset.xml create mode 120000 tests/qemuxml2xmloutdata/hugepages-nodeset.xml diff --git a/tests/qemuxml2argvdata/hugepages-nodeset.xml b/tests/qemuxml2argvdata/hugepages-nodeset.xml new file mode 100644 index 0000000000..4a85ddffad --- /dev/null +++ b/tests/qemuxml2argvdata/hugepages-nodeset.xml @@ -0,0 +1,30 @@ +<domain type='qemu'> + <name>SomeDummyHugepagesGuest</name> + <uuid>ef1bdff4-27f3-4e85-a807-5fb4d58463cc</uuid> + <memory unit='KiB'>1048576</memory> + <currentMemory unit='KiB'>1048576</currentMemory> + <memoryBacking> + <hugepages> + <page size='2048' unit='KiB' nodeset='0'/> + </hugepages> + </memoryBacking> + <vcpu placement='static'>2</vcpu> + <os> + <type arch='i686' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <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> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 273be61db3..606f710f20 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -975,6 +975,7 @@ mymain(void) DO_TEST("hugepages-default-2M", NONE); DO_TEST("hugepages-default-system-size", NONE); DO_TEST("hugepages-default-1G-nodeset-2M", NONE); + DO_TEST_FAILURE("hugepages-nodeset", NONE); DO_TEST_FAILURE("hugepages-nodeset-nonexist", QEMU_CAPS_DEVICE_PC_DIMM, QEMU_CAPS_OBJECT_MEMORY_FILE, diff --git a/tests/qemuxml2xmloutdata/hugepages-nodeset.xml b/tests/qemuxml2xmloutdata/hugepages-nodeset.xml new file mode 120000 index 0000000000..b55838b780 --- /dev/null +++ b/tests/qemuxml2xmloutdata/hugepages-nodeset.xml @@ -0,0 +1 @@ +../qemuxml2argvdata/hugepages-nodeset.xml \ No newline at end of file diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 958b955810..8af023f6b7 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -336,6 +336,7 @@ mymain(void) DO_TEST("hugepages-default-2M", NONE); DO_TEST("hugepages-default-system-size", NONE); DO_TEST("hugepages-default-1G-nodeset-2M", NONE); + DO_TEST("hugepages-nodeset", NONE); DO_TEST("hugepages-numa-default-2M", NONE); DO_TEST("hugepages-numa-default-dimm", NONE); DO_TEST("hugepages-numa-nodeset", NONE); -- 2.17.1

We can safely validate the hugepage nodeset attribute at a define time. This validation is not done for already existing domains when the daemon is restarted. All the changes to the tests are necessary because we move the error from domain start into XML parse. Signed-off-by: Pavel Hrdina <phrdina@redhat.com> --- src/conf/domain_conf.c | 32 +++++++++++++++++ src/qemu/qemu_command.c | 34 ------------------- .../seclabel-dynamic-none-relabel.xml | 2 +- tests/qemuxml2argvtest.c | 18 +++++----- .../hugepages-default-1G-nodeset-2M.xml | 1 - .../qemuxml2xmloutdata/hugepages-nodeset.xml | 1 - .../hugepages-numa-nodeset-nonexist.xml | 1 - .../seclabel-dynamic-none-relabel.xml | 2 +- tests/qemuxml2xmltest.c | 3 -- 9 files changed, 43 insertions(+), 51 deletions(-) delete mode 120000 tests/qemuxml2xmloutdata/hugepages-default-1G-nodeset-2M.xml delete mode 120000 tests/qemuxml2xmloutdata/hugepages-nodeset.xml delete mode 120000 tests/qemuxml2xmloutdata/hugepages-numa-nodeset-nonexist.xml diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 8fd774b531..be9c08626a 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -6184,6 +6184,35 @@ virDomainDefLifecycleActionValidate(const virDomainDef *def) } +static int +virDomainDefMemtuneValidate(const virDomainDef *def) +{ + const virDomainMemtune *mem = &(def->mem); + size_t i; + ssize_t pos = virDomainNumaGetNodeCount(def->numa) - 1; + + for (i = 0; i < mem->nhugepages; i++) { + ssize_t nextBit; + + if (!mem->hugepages[i].nodemask) { + /* This is the master hugepage to use. Skip it as it has no + * nodemask anyway. */ + continue; + } + + nextBit = virBitmapNextSetBit(mem->hugepages[i].nodemask, pos); + if (nextBit >= 0) { + virReportError(VIR_ERR_XML_DETAIL, + _("hugepages: node %zd not found"), + nextBit); + return -1; + } + } + + return 0; +} + + static int virDomainDefValidateInternal(const virDomainDef *def) { @@ -6219,6 +6248,9 @@ virDomainDefValidateInternal(const virDomainDef *def) if (virDomainDefLifecycleActionValidate(def) < 0) return -1; + if (virDomainDefMemtuneValidate(def) < 0) + return -1; + return 0; } diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 9e8f2f4c9c..dbeb3a54f6 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -7489,16 +7489,6 @@ qemuBuildMemPathStr(virQEMUDriverConfigPtr cfg, if (!def->mem.nhugepages) return 0; - if (def->mem.hugepages[0].nodemask) { - ssize_t next_bit = virBitmapNextSetBit(def->mem.hugepages[0].nodemask, -1); - if (next_bit >= 0) { - virReportError(VIR_ERR_XML_DETAIL, - _("hugepages: node %zd not found"), - next_bit); - return -1; - } - } - /* There is one special case: if user specified "huge" * pages of regular system pages size. * And there is nothing to do in this case. @@ -7631,30 +7621,6 @@ qemuBuildNumaArgStr(virQEMUDriverConfigPtr cfg, if (!virDomainNumatuneNodesetIsAvailable(def->numa, priv->autoNodeset)) goto cleanup; - for (i = 0; i < def->mem.nhugepages; i++) { - ssize_t next_bit, pos = 0; - - if (!def->mem.hugepages[i].nodemask) { - /* This is the master hugepage to use. Skip it as it has no - * nodemask anyway. */ - continue; - } - - if (ncells) { - /* Fortunately, we allow only guest NUMA nodes to be continuous - * starting from zero. */ - pos = ncells - 1; - } - - next_bit = virBitmapNextSetBit(def->mem.hugepages[i].nodemask, pos); - if (next_bit >= 0) { - virReportError(VIR_ERR_XML_DETAIL, - _("hugepages: node %zd not found"), - next_bit); - goto cleanup; - } - } - if (VIR_ALLOC_N(nodeBackends, ncells) < 0) goto cleanup; diff --git a/tests/qemuxml2argvdata/seclabel-dynamic-none-relabel.xml b/tests/qemuxml2argvdata/seclabel-dynamic-none-relabel.xml index 47f253b5f7..e954250009 100644 --- a/tests/qemuxml2argvdata/seclabel-dynamic-none-relabel.xml +++ b/tests/qemuxml2argvdata/seclabel-dynamic-none-relabel.xml @@ -5,7 +5,7 @@ <currentMemory unit='KiB'>262144</currentMemory> <memoryBacking> <hugepages> - <page size='2048' unit='KiB' nodeset='0'/> + <page size='2048' unit='KiB'/> </hugepages> </memoryBacking> <vcpu placement='static'>4</vcpu> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 606f710f20..9e2e59ec44 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -974,12 +974,12 @@ mymain(void) DO_TEST("hugepages-default", NONE); DO_TEST("hugepages-default-2M", NONE); DO_TEST("hugepages-default-system-size", NONE); - DO_TEST("hugepages-default-1G-nodeset-2M", NONE); - DO_TEST_FAILURE("hugepages-nodeset", NONE); - DO_TEST_FAILURE("hugepages-nodeset-nonexist", - QEMU_CAPS_DEVICE_PC_DIMM, - QEMU_CAPS_OBJECT_MEMORY_FILE, - QEMU_CAPS_OBJECT_MEMORY_FILE_DISCARD); + DO_TEST_PARSE_ERROR("hugepages-default-1G-nodeset-2M", NONE); + DO_TEST_PARSE_ERROR("hugepages-nodeset", NONE); + DO_TEST_PARSE_ERROR("hugepages-nodeset-nonexist", + QEMU_CAPS_DEVICE_PC_DIMM, + QEMU_CAPS_OBJECT_MEMORY_FILE, + QEMU_CAPS_OBJECT_MEMORY_FILE_DISCARD); DO_TEST("hugepages-numa-default", QEMU_CAPS_OBJECT_MEMORY_FILE); DO_TEST("hugepages-numa-default-2M", @@ -994,9 +994,9 @@ mymain(void) DO_TEST("hugepages-numa-nodeset-part", QEMU_CAPS_OBJECT_MEMORY_RAM, QEMU_CAPS_OBJECT_MEMORY_FILE); - DO_TEST_FAILURE("hugepages-numa-nodeset-nonexist", - QEMU_CAPS_OBJECT_MEMORY_RAM, - QEMU_CAPS_OBJECT_MEMORY_FILE); + DO_TEST_PARSE_ERROR("hugepages-numa-nodeset-nonexist", + QEMU_CAPS_OBJECT_MEMORY_RAM, + QEMU_CAPS_OBJECT_MEMORY_FILE); DO_TEST("hugepages-shared", QEMU_CAPS_OBJECT_MEMORY_RAM, QEMU_CAPS_OBJECT_MEMORY_FILE); diff --git a/tests/qemuxml2xmloutdata/hugepages-default-1G-nodeset-2M.xml b/tests/qemuxml2xmloutdata/hugepages-default-1G-nodeset-2M.xml deleted file mode 120000 index 3d8eb7616e..0000000000 --- a/tests/qemuxml2xmloutdata/hugepages-default-1G-nodeset-2M.xml +++ /dev/null @@ -1 +0,0 @@ -../qemuxml2argvdata/hugepages-default-1G-nodeset-2M.xml \ No newline at end of file diff --git a/tests/qemuxml2xmloutdata/hugepages-nodeset.xml b/tests/qemuxml2xmloutdata/hugepages-nodeset.xml deleted file mode 120000 index b55838b780..0000000000 --- a/tests/qemuxml2xmloutdata/hugepages-nodeset.xml +++ /dev/null @@ -1 +0,0 @@ -../qemuxml2argvdata/hugepages-nodeset.xml \ No newline at end of file diff --git a/tests/qemuxml2xmloutdata/hugepages-numa-nodeset-nonexist.xml b/tests/qemuxml2xmloutdata/hugepages-numa-nodeset-nonexist.xml deleted file mode 120000 index d490edca69..0000000000 --- a/tests/qemuxml2xmloutdata/hugepages-numa-nodeset-nonexist.xml +++ /dev/null @@ -1 +0,0 @@ -../qemuxml2argvdata/hugepages-numa-nodeset-nonexist.xml \ No newline at end of file diff --git a/tests/qemuxml2xmloutdata/seclabel-dynamic-none-relabel.xml b/tests/qemuxml2xmloutdata/seclabel-dynamic-none-relabel.xml index 050967b4ee..bfa66b8deb 100644 --- a/tests/qemuxml2xmloutdata/seclabel-dynamic-none-relabel.xml +++ b/tests/qemuxml2xmloutdata/seclabel-dynamic-none-relabel.xml @@ -5,7 +5,7 @@ <currentMemory unit='KiB'>262144</currentMemory> <memoryBacking> <hugepages> - <page size='2048' unit='KiB' nodeset='0'/> + <page size='2048' unit='KiB'/> </hugepages> </memoryBacking> <vcpu placement='static'>4</vcpu> diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 8af023f6b7..92406c8eb8 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -335,13 +335,10 @@ mymain(void) DO_TEST("hugepages-default", NONE); DO_TEST("hugepages-default-2M", NONE); DO_TEST("hugepages-default-system-size", NONE); - DO_TEST("hugepages-default-1G-nodeset-2M", NONE); - DO_TEST("hugepages-nodeset", NONE); DO_TEST("hugepages-numa-default-2M", NONE); DO_TEST("hugepages-numa-default-dimm", NONE); DO_TEST("hugepages-numa-nodeset", NONE); DO_TEST("hugepages-numa-nodeset-part", NONE); - DO_TEST("hugepages-numa-nodeset-nonexist", NONE); DO_TEST("hugepages-shared", NONE); DO_TEST("hugepages-memaccess", NONE); DO_TEST("hugepages-memaccess2", NONE); -- 2.17.1

Signed-off-by: Pavel Hrdina <phrdina@redhat.com> --- src/conf/domain_conf.c | 75 ++++++++++++++++++++++-------------------- 1 file changed, 40 insertions(+), 35 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index be9c08626a..f88576b5cc 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -6191,9 +6191,49 @@ virDomainDefMemtuneValidate(const virDomainDef *def) size_t i; ssize_t pos = virDomainNumaGetNodeCount(def->numa) - 1; + if (mem->nhugepages == 0) + return 0; + + if (mem->allocation == VIR_DOMAIN_MEMORY_ALLOCATION_ONDEMAND) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("hugepages are not allowed with memory " + "allocation ondemand")); + return -1; + } + + if (mem->source == VIR_DOMAIN_MEMORY_SOURCE_ANONYMOUS) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("hugepages are not allowed with anonymous " + "memory source")); + return -1; + } + for (i = 0; i < mem->nhugepages; i++) { + size_t j; ssize_t nextBit; + for (j = 0; j < i; j++) { + if (mem->hugepages[i].nodemask && + mem->hugepages[j].nodemask && + virBitmapOverlaps(mem->hugepages[i].nodemask, + mem->hugepages[j].nodemask)) { + virReportError(VIR_ERR_XML_DETAIL, + _("nodeset attribute of hugepages " + "of sizes %llu and %llu intersect"), + mem->hugepages[i].size, + mem->hugepages[j].size); + return -1; + } else if (!mem->hugepages[i].nodemask && + !mem->hugepages[j].nodemask) { + virReportError(VIR_ERR_XML_DETAIL, + _("two master hugepages detected: " + "%llu and %llu"), + mem->hugepages[i].size, + mem->hugepages[j].size); + return -1; + } + } + if (!mem->hugepages[i].nodemask) { /* This is the master hugepage to use. Skip it as it has no * nodemask anyway. */ @@ -19466,19 +19506,6 @@ virDomainDefParseXML(xmlDocPtr xml, if (virXPathNode("./memoryBacking/hugepages", ctxt)) { /* hugepages will be used */ - - if (def->mem.allocation == VIR_DOMAIN_MEMORY_ALLOCATION_ONDEMAND) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("hugepages are not allowed with memory allocation ondemand")); - goto error; - } - - if (def->mem.source == VIR_DOMAIN_MEMORY_SOURCE_ANONYMOUS) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("hugepages are not allowed with anonymous memory source")); - goto error; - } - if ((n = virXPathNodeSet("./memoryBacking/hugepages/page", ctxt, &nodes)) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("cannot extract hugepages nodes")); @@ -19494,28 +19521,6 @@ virDomainDefParseXML(xmlDocPtr xml, &def->mem.hugepages[i]) < 0) goto error; def->mem.nhugepages++; - - for (j = 0; j < i; j++) { - if (def->mem.hugepages[i].nodemask && - def->mem.hugepages[j].nodemask && - virBitmapOverlaps(def->mem.hugepages[i].nodemask, - def->mem.hugepages[j].nodemask)) { - virReportError(VIR_ERR_XML_DETAIL, - _("nodeset attribute of hugepages " - "of sizes %llu and %llu intersect"), - def->mem.hugepages[i].size, - def->mem.hugepages[j].size); - goto error; - } else if (!def->mem.hugepages[i].nodemask && - !def->mem.hugepages[j].nodemask) { - virReportError(VIR_ERR_XML_DETAIL, - _("two master hugepages detected: " - "%llu and %llu"), - def->mem.hugepages[i].size, - def->mem.hugepages[j].size); - goto error; - } - } } VIR_FREE(nodes); -- 2.17.1

Previously we were ignoring "nodeset" attribute for hugepage pages if there was no guest NUMA topology configured in the domain XML. Commit <fa6bdf6afa878b8d7c5ed71664ee72be8967cdc5> partially fixed that issue but it introduced a somehow valid regression. In case that there is no guest NUMA topology configured and the "nodeset" attribute is set to "0" it was accepted and was working properly even though it was not completely valid XML. This patch introduces a workaround that it will ignore the nodeset="0" only in case that there is no guest NUMA topology in order not to hit the validation error. After this commit the following XML configuration is valid: <memoryBacking> <hugepages> <page size='2048' unit='KiB' nodeset='0'/> </hugepages> </memoryBacking> but this configuration remains invalid: <memoryBacking> <hugepages> <page size='2048' unit='KiB' nodeset='0'/> <page size='1048576' unit='KiB'/> </hugepages> </memoryBacking> The issue with the second configuration is that it was originally working, however changing the order of the <page> elements resolved into using different page size for the guest. The code is written in a way that it expect only one page configured and always uses only the first page in case that there is no guest NUMA topology configured. See qemuBuildMemPathStr() function for details. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1591235 Signed-off-by: Pavel Hrdina <phrdina@redhat.com> --- src/conf/domain_conf.c | 27 +++++++++++++++++ tests/qemuxml2argvdata/hugepages-nodeset.args | 26 ++++++++++++++++ tests/qemuxml2argvtest.c | 2 +- .../qemuxml2xmloutdata/hugepages-nodeset.xml | 30 +++++++++++++++++++ tests/qemuxml2xmltest.c | 1 + 5 files changed, 85 insertions(+), 1 deletion(-) create mode 100644 tests/qemuxml2argvdata/hugepages-nodeset.args create mode 100644 tests/qemuxml2xmloutdata/hugepages-nodeset.xml diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index f88576b5cc..f0d44bb75d 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -4088,6 +4088,31 @@ virDomainDefPostParseMemory(virDomainDefPtr def, } +static void +virDomainDefPostParseMemtune(virDomainDefPtr def) +{ + size_t i; + + if (virDomainNumaGetNodeCount(def->numa) == 0) { + /* If guest NUMA is not configured and any hugepage page has nodemask + * set to "0" free and clear that nodemas, otherwise we would rise + * an error that there is no guest NUMA node configured. */ + for (i = 0; i < def->mem.nhugepages; i++) { + ssize_t nextBit; + + if (!def->mem.hugepages[i].nodemask) + continue; + + nextBit = virBitmapNextSetBit(def->mem.hugepages[i].nodemask, 0); + if (nextBit < 0) { + virBitmapFree(def->mem.hugepages[i].nodemask); + def->mem.hugepages[i].nodemask = NULL; + } + } + } +} + + static int virDomainDefAddConsoleCompat(virDomainDefPtr def) { @@ -5145,6 +5170,8 @@ virDomainDefPostParseCommon(virDomainDefPtr def, if (virDomainDefPostParseMemory(def, data->parseFlags) < 0) return -1; + virDomainDefPostParseMemtune(def); + if (virDomainDefRejectDuplicateControllers(def) < 0) return -1; diff --git a/tests/qemuxml2argvdata/hugepages-nodeset.args b/tests/qemuxml2argvdata/hugepages-nodeset.args new file mode 100644 index 0000000000..d094be1252 --- /dev/null +++ b/tests/qemuxml2argvdata/hugepages-nodeset.args @@ -0,0 +1,26 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/home/test \ +USER=test \ +LOGNAME=test \ +QEMU_AUDIO_DRV=none \ +/usr/bin/qemu-system-i686 \ +-name SomeDummyHugepagesGuest \ +-S \ +-machine pc,accel=tcg,usb=off,dump-guest-core=off \ +-m 1024 \ +-mem-prealloc \ +-mem-path /dev/hugepages2M/libvirt/qemu/-1-SomeDummyHugepagesGu \ +-smp 2,sockets=2,cores=1,threads=1 \ +-uuid ef1bdff4-27f3-4e85-a807-5fb4d58463cc \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=charmonitor,\ +path=/tmp/lib/domain--1-SomeDummyHugepagesGu/monitor.sock,server,nowait \ +-mon chardev=charmonitor,id=monitor,mode=control \ +-rtc base=utc \ +-no-shutdown \ +-no-acpi \ +-boot c \ +-usb diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 9e2e59ec44..cec0fa5b33 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -975,7 +975,7 @@ mymain(void) DO_TEST("hugepages-default-2M", NONE); DO_TEST("hugepages-default-system-size", NONE); DO_TEST_PARSE_ERROR("hugepages-default-1G-nodeset-2M", NONE); - DO_TEST_PARSE_ERROR("hugepages-nodeset", NONE); + DO_TEST("hugepages-nodeset", NONE); DO_TEST_PARSE_ERROR("hugepages-nodeset-nonexist", QEMU_CAPS_DEVICE_PC_DIMM, QEMU_CAPS_OBJECT_MEMORY_FILE, diff --git a/tests/qemuxml2xmloutdata/hugepages-nodeset.xml b/tests/qemuxml2xmloutdata/hugepages-nodeset.xml new file mode 100644 index 0000000000..ac219a7800 --- /dev/null +++ b/tests/qemuxml2xmloutdata/hugepages-nodeset.xml @@ -0,0 +1,30 @@ +<domain type='qemu'> + <name>SomeDummyHugepagesGuest</name> + <uuid>ef1bdff4-27f3-4e85-a807-5fb4d58463cc</uuid> + <memory unit='KiB'>1048576</memory> + <currentMemory unit='KiB'>1048576</currentMemory> + <memoryBacking> + <hugepages> + <page size='2048' unit='KiB'/> + </hugepages> + </memoryBacking> + <vcpu placement='static'>2</vcpu> + <os> + <type arch='i686' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <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> diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 92406c8eb8..c71e781980 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -335,6 +335,7 @@ mymain(void) DO_TEST("hugepages-default", NONE); DO_TEST("hugepages-default-2M", NONE); DO_TEST("hugepages-default-system-size", NONE); + DO_TEST("hugepages-nodeset", NONE); DO_TEST("hugepages-numa-default-2M", NONE); DO_TEST("hugepages-numa-default-dimm", NONE); DO_TEST("hugepages-numa-nodeset", NONE); -- 2.17.1

Signed-off-by: Pavel Hrdina <phrdina@redhat.com> --- src/qemu/qemu_command.c | 4 +++- .../pages-discard-hugepages.args | 11 +++++++---- tests/qemuxml2argvdata/pages-discard.args | 18 ++++++++++++++---- 3 files changed, 24 insertions(+), 9 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index dbeb3a54f6..a7859feae6 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -3147,6 +3147,7 @@ qemuBuildMemoryBackendProps(virJSONValuePtr *backendProps, return -1; if (useHugepage || mem->nvdimmPath || memAccess || + discard == VIR_TRISTATE_BOOL_YES || def->mem.source == VIR_DOMAIN_MEMORY_SOURCE_FILE) { if (useHugepage) { @@ -3228,7 +3229,8 @@ qemuBuildMemoryBackendProps(virJSONValuePtr *backendProps, if (!needHugepage && !mem->sourceNodes && !nodeSpecified && !mem->nvdimmPath && memAccess == VIR_DOMAIN_MEMORY_ACCESS_DEFAULT && - def->mem.source != VIR_DOMAIN_MEMORY_SOURCE_FILE && !force) { + def->mem.source != VIR_DOMAIN_MEMORY_SOURCE_FILE && !force && + discard != VIR_TRISTATE_BOOL_YES) { /* report back that using the new backend is not necessary * to achieve the desired configuration */ ret = 1; diff --git a/tests/qemuxml2argvdata/pages-discard-hugepages.args b/tests/qemuxml2argvdata/pages-discard-hugepages.args index 2dfacefe4a..d859480c26 100644 --- a/tests/qemuxml2argvdata/pages-discard-hugepages.args +++ b/tests/qemuxml2argvdata/pages-discard-hugepages.args @@ -10,10 +10,13 @@ QEMU_AUDIO_DRV=none \ -machine pc,accel=tcg,usb=off,dump-guest-core=off \ -m 1024 \ -smp 2,sockets=2,cores=1,threads=1 \ --mem-prealloc \ --mem-path /dev/hugepages2M/libvirt/qemu/-1-SomeDummyHugepagesGu \ --numa node,nodeid=0,cpus=0,mem=256 \ --numa node,nodeid=1,cpus=1,mem=768 \ +-object memory-backend-file,id=ram-node0,prealloc=yes,\ +mem-path=/dev/hugepages2M/libvirt/qemu/-1-SomeDummyHugepagesGu,size=268435456 \ +-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-SomeDummyHugepagesGu,\ +discard-data=yes,size=805306368 \ +-numa node,nodeid=1,cpus=1,memdev=ram-node1 \ -uuid ef1bdff4-27f3-4e85-a807-5fb4d58463cc \ -display none \ -no-user-config \ diff --git a/tests/qemuxml2argvdata/pages-discard.args b/tests/qemuxml2argvdata/pages-discard.args index 9db8c72a22..4ae20f531f 100644 --- a/tests/qemuxml2argvdata/pages-discard.args +++ b/tests/qemuxml2argvdata/pages-discard.args @@ -10,10 +10,20 @@ QEMU_AUDIO_DRV=none \ -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 \ +-object memory-backend-file,id=ram-node0,\ +mem-path=/var/lib/libvirt/qemu/ram/libvirt/qemu/-1-QEMUGuest1/ram-node0,\ +discard-data=yes,size=1073741824 \ +-numa node,nodeid=0,cpus=0,memdev=ram-node0 \ +-object memory-backend-ram,id=ram-node1,size=1073741824 \ +-numa node,nodeid=1,cpus=1,memdev=ram-node1 \ +-object memory-backend-file,id=ram-node2,\ +mem-path=/var/lib/libvirt/qemu/ram/libvirt/qemu/-1-QEMUGuest1/ram-node2,\ +discard-data=yes,size=1073741824 \ +-numa node,nodeid=2,cpus=2,memdev=ram-node2 \ +-object memory-backend-file,id=ram-node3,\ +mem-path=/var/lib/libvirt/qemu/ram/libvirt/qemu/-1-QEMUGuest1/ram-node3,\ +discard-data=yes,size=1073741824 \ +-numa node,nodeid=3,cpus=3,memdev=ram-node3 \ -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ -display none \ -no-user-config \ -- 2.17.1

On 08/09/2018 02:38 PM, Pavel Hrdina wrote:
Signed-off-by: Pavel Hrdina <phrdina@redhat.com> --- src/qemu/qemu_command.c | 4 +++- .../pages-discard-hugepages.args | 11 +++++++---- tests/qemuxml2argvdata/pages-discard.args | 18 ++++++++++++++---- 3 files changed, 24 insertions(+), 9 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index dbeb3a54f6..a7859feae6 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -3147,6 +3147,7 @@ qemuBuildMemoryBackendProps(virJSONValuePtr *backendProps, return -1;
if (useHugepage || mem->nvdimmPath || memAccess || + discard == VIR_TRISTATE_BOOL_YES || def->mem.source == VIR_DOMAIN_MEMORY_SOURCE_FILE) {
if (useHugepage) { @@ -3228,7 +3229,8 @@ qemuBuildMemoryBackendProps(virJSONValuePtr *backendProps, if (!needHugepage && !mem->sourceNodes && !nodeSpecified && !mem->nvdimmPath && memAccess == VIR_DOMAIN_MEMORY_ACCESS_DEFAULT && - def->mem.source != VIR_DOMAIN_MEMORY_SOURCE_FILE && !force) { + def->mem.source != VIR_DOMAIN_MEMORY_SOURCE_FILE && !force && + discard != VIR_TRISTATE_BOOL_YES) { /* report back that using the new backend is not necessary * to achieve the desired configuration */ ret = 1; diff --git a/tests/qemuxml2argvdata/pages-discard-hugepages.args b/tests/qemuxml2argvdata/pages-discard-hugepages.args index 2dfacefe4a..d859480c26 100644 --- a/tests/qemuxml2argvdata/pages-discard-hugepages.args +++ b/tests/qemuxml2argvdata/pages-discard-hugepages.args @@ -10,10 +10,13 @@ QEMU_AUDIO_DRV=none \ -machine pc,accel=tcg,usb=off,dump-guest-core=off \ -m 1024 \ -smp 2,sockets=2,cores=1,threads=1 \ --mem-prealloc \ --mem-path /dev/hugepages2M/libvirt/qemu/-1-SomeDummyHugepagesGu \ --numa node,nodeid=0,cpus=0,mem=256 \ --numa node,nodeid=1,cpus=1,mem=768 \ +-object memory-backend-file,id=ram-node0,prealloc=yes,\ +mem-path=/dev/hugepages2M/libvirt/qemu/-1-SomeDummyHugepagesGu,size=268435456 \ +-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-SomeDummyHugepagesGu,\ +discard-data=yes,size=805306368 \ +-numa node,nodeid=1,cpus=1,memdev=ram-node1 \
This will break migration. But at the same time, it's very unlikely that anybody is using discard without hugepages. Michal

On Fri, Aug 10, 2018 at 09:26:27AM +0200, Michal Privoznik wrote:
On 08/09/2018 02:38 PM, Pavel Hrdina wrote:
Signed-off-by: Pavel Hrdina <phrdina@redhat.com> --- src/qemu/qemu_command.c | 4 +++- .../pages-discard-hugepages.args | 11 +++++++---- tests/qemuxml2argvdata/pages-discard.args | 18 ++++++++++++++---- 3 files changed, 24 insertions(+), 9 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index dbeb3a54f6..a7859feae6 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -3147,6 +3147,7 @@ qemuBuildMemoryBackendProps(virJSONValuePtr *backendProps, return -1;
if (useHugepage || mem->nvdimmPath || memAccess || + discard == VIR_TRISTATE_BOOL_YES || def->mem.source == VIR_DOMAIN_MEMORY_SOURCE_FILE) {
if (useHugepage) { @@ -3228,7 +3229,8 @@ qemuBuildMemoryBackendProps(virJSONValuePtr *backendProps, if (!needHugepage && !mem->sourceNodes && !nodeSpecified && !mem->nvdimmPath && memAccess == VIR_DOMAIN_MEMORY_ACCESS_DEFAULT && - def->mem.source != VIR_DOMAIN_MEMORY_SOURCE_FILE && !force) { + def->mem.source != VIR_DOMAIN_MEMORY_SOURCE_FILE && !force && + discard != VIR_TRISTATE_BOOL_YES) { /* report back that using the new backend is not necessary * to achieve the desired configuration */ ret = 1; diff --git a/tests/qemuxml2argvdata/pages-discard-hugepages.args b/tests/qemuxml2argvdata/pages-discard-hugepages.args index 2dfacefe4a..d859480c26 100644 --- a/tests/qemuxml2argvdata/pages-discard-hugepages.args +++ b/tests/qemuxml2argvdata/pages-discard-hugepages.args @@ -10,10 +10,13 @@ QEMU_AUDIO_DRV=none \ -machine pc,accel=tcg,usb=off,dump-guest-core=off \ -m 1024 \ -smp 2,sockets=2,cores=1,threads=1 \ --mem-prealloc \ --mem-path /dev/hugepages2M/libvirt/qemu/-1-SomeDummyHugepagesGu \ --numa node,nodeid=0,cpus=0,mem=256 \ --numa node,nodeid=1,cpus=1,mem=768 \ +-object memory-backend-file,id=ram-node0,prealloc=yes,\ +mem-path=/dev/hugepages2M/libvirt/qemu/-1-SomeDummyHugepagesGu,size=268435456 \ +-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-SomeDummyHugepagesGu,\ +discard-data=yes,size=805306368 \ +-numa node,nodeid=1,cpus=1,memdev=ram-node1 \
This will break migration. But at the same time, it's very unlikely that anybody is using discard without hugepages.
So there is different issue, with this patch guest without any hugepages will fail to start as the memory file is generated in /var/lib/libvirt/qemu/ram/libvirt/ and QEMU exits with: memory.c:2053: memory_region_get_ram_ptr: Assertion `mr->ram_block' failed. I'm dropping this patch :/. Pavel
Michal
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list

On 08/09/2018 02:38 PM, Pavel Hrdina wrote:
changes in v2: - renamed existing test cases to sensible names - split of some existing test cases - fixed uncovered issue with memory discard
v1: https://www.redhat.com/archives/libvir-list/2018-July/msg00667.html
Pavel Hrdina (20): tests: rename hugepages to hugepages-default tests: extract hugepages-numa-default-dimm out of hugepages-numa tests: rename hugepages-numa into hugepages-numa-default tests: remove unnecessary XML elements from hugepages-numa-default tests: extract pages-discard out of hugepages-pages tests: rename hugepages-pages into hugepages-numa-nodeset tests: rename hugepages-pages2 into hugepages-numa-default-2M tests: extract pages-discard-hugepages out of hugepages-pages3 tests: rename hugepages-pages3 into hugepages-numa-nodeset-part tests: rename hugepages-pages4 into hugepages-numa-nodeset-nonexist tests: rename hugepages-pages5 into hugepages-default-2M tests: rename hugepages-pages6 into hugepages-default-system-size tests: rename hugepages-pages7 into pages-dimm-discard tests: rename hugepages-pages8 into hugepages-nodeset-nonexist tests: introduce hugepages-default-1G-nodeset-2M tests: introduce hugepages-nodeset conf: Move hugepage XML validation check out of qemu_command conf: Move hugepages validation out of XML parser conf: Introduce virDomainDefPostParseMemtune qemu: ensure that memory 'discard' is used if specified in XML
src/conf/domain_conf.c | 134 +++++++++++++----- src/qemu/qemu_command.c | 38 +---- ...s => hugepages-default-1G-nodeset-2M.args} | 7 +- .../hugepages-default-1G-nodeset-2M.xml | 31 ++++ ...-pages5.args => hugepages-default-2M.args} | 5 +- ...es-pages5.xml => hugepages-default-2M.xml} | 13 +- .../hugepages-default-system-size.args | 24 ++++ ....xml => hugepages-default-system-size.xml} | 13 +- ...{hugepages.args => hugepages-default.args} | 2 - .../{hugepages.xml => hugepages-default.xml} | 5 - ...es8.xml => hugepages-nodeset-nonexist.xml} | 13 +- tests/qemuxml2argvdata/hugepages-nodeset.args | 26 ++++ tests/qemuxml2argvdata/hugepages-nodeset.xml | 30 ++++ ...s2.args => hugepages-numa-default-2M.args} | 5 +- ...ges2.xml => hugepages-numa-default-2M.xml} | 8 +- ....args => hugepages-numa-default-dimm.args} | 12 +- .../hugepages-numa-default-dimm.xml | 45 ++++++ .../hugepages-numa-default.args | 27 ++++ .../hugepages-numa-default.xml | 30 ++++ ...ml => hugepages-numa-nodeset-nonexist.xml} | 17 +-- ....args => hugepages-numa-nodeset-part.args} | 8 +- .../hugepages-numa-nodeset-part.xml | 34 +++++ ...pages.args => hugepages-numa-nodeset.args} | 17 +-- ...s-pages.xml => hugepages-numa-nodeset.xml} | 15 +- tests/qemuxml2argvdata/hugepages-numa.args | 63 -------- tests/qemuxml2argvdata/hugepages-numa.xml | 111 --------------- .../qemuxml2argvdata/pages-dimm-discard.args | 33 +++++ ...ages-pages7.xml => pages-dimm-discard.xml} | 18 +-- .../pages-discard-hugepages.args | 31 ++++ ...pages3.xml => pages-discard-hugepages.xml} | 16 +-- tests/qemuxml2argvdata/pages-discard.args | 38 +++++ tests/qemuxml2argvdata/pages-discard.xml | 36 +++++ .../seclabel-dynamic-none-relabel.xml | 2 +- tests/qemuxml2argvtest.c | 56 ++++---- .../hugepages-default-2M.xml | 1 + .../hugepages-default-system-size.xml | 1 + .../{hugepages.xml => hugepages-default.xml} | 6 - .../qemuxml2xmloutdata/hugepages-nodeset.xml | 30 ++++ ...ges2.xml => hugepages-numa-default-2M.xml} | 13 +- .../hugepages-numa-default-dimm.xml | 1 + .../hugepages-numa-nodeset-part.xml | 36 +++++ ...s-pages.xml => hugepages-numa-nodeset.xml} | 20 +-- tests/qemuxml2xmloutdata/hugepages-pages3.xml | 47 ------ tests/qemuxml2xmloutdata/hugepages-pages4.xml | 1 - tests/qemuxml2xmloutdata/hugepages-pages5.xml | 1 - tests/qemuxml2xmloutdata/hugepages-pages6.xml | 1 - tests/qemuxml2xmloutdata/hugepages-pages7.xml | 1 - .../qemuxml2xmloutdata/pages-dimm-discard.xml | 1 + .../pages-discard-hugepages.xml | 1 + tests/qemuxml2xmloutdata/pages-discard.xml | 1 + .../seclabel-dynamic-none-relabel.xml | 2 +- tests/qemuxml2xmltest.c | 19 +-- 52 files changed, 634 insertions(+), 512 deletions(-) rename tests/qemuxml2argvdata/{hugepages-pages6.args => hugepages-default-1G-nodeset-2M.args} (72%) create mode 100644 tests/qemuxml2argvdata/hugepages-default-1G-nodeset-2M.xml rename tests/qemuxml2argvdata/{hugepages-pages5.args => hugepages-default-2M.args} (75%) rename tests/qemuxml2argvdata/{hugepages-pages5.xml => hugepages-default-2M.xml} (63%) create mode 100644 tests/qemuxml2argvdata/hugepages-default-system-size.args rename tests/qemuxml2argvdata/{hugepages-pages6.xml => hugepages-default-system-size.xml} (63%) rename tests/qemuxml2argvdata/{hugepages.args => hugepages-default.args} (82%) rename tests/qemuxml2argvdata/{hugepages.xml => hugepages-default.xml} (79%) rename tests/qemuxml2argvdata/{hugepages-pages8.xml => hugepages-nodeset-nonexist.xml} (64%) create mode 100644 tests/qemuxml2argvdata/hugepages-nodeset.args create mode 100644 tests/qemuxml2argvdata/hugepages-nodeset.xml rename tests/qemuxml2argvdata/{hugepages-pages2.args => hugepages-numa-default-2M.args} (77%) rename tests/qemuxml2argvdata/{hugepages-pages2.xml => hugepages-numa-default-2M.xml} (77%) rename tests/qemuxml2argvdata/{hugepages-pages7.args => hugepages-numa-default-dimm.args} (66%) create mode 100644 tests/qemuxml2argvdata/hugepages-numa-default-dimm.xml create mode 100644 tests/qemuxml2argvdata/hugepages-numa-default.args create mode 100644 tests/qemuxml2argvdata/hugepages-numa-default.xml rename tests/qemuxml2argvdata/{hugepages-pages4.xml => hugepages-numa-nodeset-nonexist.xml} (66%) rename tests/qemuxml2argvdata/{hugepages-pages3.args => hugepages-numa-nodeset-part.args} (71%) create mode 100644 tests/qemuxml2argvdata/hugepages-numa-nodeset-part.xml rename tests/qemuxml2argvdata/{hugepages-pages.args => hugepages-numa-nodeset.args} (62%) rename tests/qemuxml2argvdata/{hugepages-pages.xml => hugepages-numa-nodeset.xml} (69%) delete mode 100644 tests/qemuxml2argvdata/hugepages-numa.args delete mode 100644 tests/qemuxml2argvdata/hugepages-numa.xml create mode 100644 tests/qemuxml2argvdata/pages-dimm-discard.args rename tests/qemuxml2argvdata/{hugepages-pages7.xml => pages-dimm-discard.xml} (73%) create mode 100644 tests/qemuxml2argvdata/pages-discard-hugepages.args rename tests/qemuxml2argvdata/{hugepages-pages3.xml => pages-discard-hugepages.xml} (68%) create mode 100644 tests/qemuxml2argvdata/pages-discard.args create mode 100644 tests/qemuxml2argvdata/pages-discard.xml create mode 120000 tests/qemuxml2xmloutdata/hugepages-default-2M.xml create mode 120000 tests/qemuxml2xmloutdata/hugepages-default-system-size.xml rename tests/qemuxml2xmloutdata/{hugepages.xml => hugepages-default.xml} (82%) create mode 100644 tests/qemuxml2xmloutdata/hugepages-nodeset.xml rename tests/qemuxml2xmloutdata/{hugepages-pages2.xml => hugepages-numa-default-2M.xml} (67%) create mode 120000 tests/qemuxml2xmloutdata/hugepages-numa-default-dimm.xml create mode 100644 tests/qemuxml2xmloutdata/hugepages-numa-nodeset-part.xml rename tests/qemuxml2xmloutdata/{hugepages-pages.xml => hugepages-numa-nodeset.xml} (62%) delete mode 100644 tests/qemuxml2xmloutdata/hugepages-pages3.xml delete mode 120000 tests/qemuxml2xmloutdata/hugepages-pages4.xml delete mode 120000 tests/qemuxml2xmloutdata/hugepages-pages5.xml delete mode 120000 tests/qemuxml2xmloutdata/hugepages-pages6.xml delete mode 120000 tests/qemuxml2xmloutdata/hugepages-pages7.xml create mode 120000 tests/qemuxml2xmloutdata/pages-dimm-discard.xml create mode 120000 tests/qemuxml2xmloutdata/pages-discard-hugepages.xml create mode 120000 tests/qemuxml2xmloutdata/pages-discard.xml
ACK series. Michal
participants (2)
-
Michal Privoznik
-
Pavel Hrdina