src/qemu/qemu_command.c | 10 ++-- .../hugepages-nvdimm.x86_64-latest.args | 38 ++++++++++++++ tests/qemuxml2argvdata/hugepages-nvdimm.xml | 59 ++++++++++++++++++++++ tests/qemuxml2argvtest.c | 1 + tests/qemuxml2xmloutdata/hugepages-nvdimm.xml | 1 + tests/qemuxml2xmltest.c | 1 + 6 files changed, 105 insertions(+), 5 deletions(-) create mode 100644 tests/qemuxml2argvdata/hugepages-nvdimm.x86_64-latest.args create mode 100644 tests/qemuxml2argvdata/hugepages-nvdimm.xml create mode 120000 tests/qemuxml2xmloutdata/hugepages-nvdimm.xml
If a domain has hugepages configured and we're currently building
memory-backend-file for a nvdimm device that domain has we will
put hugepages path onto the command line. It should have been
nvdimm path configured in the XML.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
src/qemu/qemu_command.c | 10 ++--
.../hugepages-nvdimm.x86_64-latest.args | 38 ++++++++++++++
tests/qemuxml2argvdata/hugepages-nvdimm.xml | 59 ++++++++++++++++++++++
tests/qemuxml2argvtest.c | 1 +
tests/qemuxml2xmloutdata/hugepages-nvdimm.xml | 1 +
tests/qemuxml2xmltest.c | 1 +
6 files changed, 105 insertions(+), 5 deletions(-)
create mode 100644 tests/qemuxml2argvdata/hugepages-nvdimm.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/hugepages-nvdimm.xml
create mode 120000 tests/qemuxml2xmloutdata/hugepages-nvdimm.xml
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index a3fadc505d..ddb90895e0 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -3148,14 +3148,14 @@ qemuBuildMemoryBackendProps(virJSONValuePtr *backendProps,
if (useHugepage || mem->nvdimmPath || memAccess ||
def->mem.source == VIR_DOMAIN_MEMORY_SOURCE_FILE) {
- if (useHugepage) {
- if (qemuGetDomainHupageMemPath(def, cfg, pagesize, &memPath) < 0)
- goto cleanup;
- prealloc = true;
- } else if (mem->nvdimmPath) {
+ if (mem->nvdimmPath) {
if (VIR_STRDUP(memPath, mem->nvdimmPath) < 0)
goto cleanup;
prealloc = true;
+ } else if (useHugepage) {
+ if (qemuGetDomainHupageMemPath(def, cfg, pagesize, &memPath) < 0)
+ goto cleanup;
+ prealloc = true;
} else {
/* We can have both pagesize and mem source. If that's the case,
* prefer hugepages as those are more specific. */
diff --git a/tests/qemuxml2argvdata/hugepages-nvdimm.x86_64-latest.args b/tests/qemuxml2argvdata/hugepages-nvdimm.x86_64-latest.args
new file mode 100644
index 0000000000..3a6dd364da
--- /dev/null
+++ b/tests/qemuxml2argvdata/hugepages-nvdimm.x86_64-latest.args
@@ -0,0 +1,38 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/home/test \
+USER=test \
+LOGNAME=test \
+QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-i686 \
+-name guest=QEMUGuest1,debug-threads=on \
+-S \
+-object secret,id=masterKey0,format=raw,\
+file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
+-machine pc,accel=tcg,usb=off,dump-guest-core=off,nvdimm=on \
+-m size=1048576k,slots=16,maxmem=1099511627776k \
+-realtime mlock=off \
+-smp 2,sockets=2,cores=1,threads=1 \
+-object memory-backend-file,id=ram-node0,prealloc=yes,\
+mem-path=/dev/hugepages2M/libvirt/qemu/-1-QEMUGuest1,share=yes,size=1073741824 \
+-numa node,nodeid=0,cpus=0-1,memdev=ram-node0 \
+-object memory-backend-file,id=memnvdimm0,prealloc=yes,mem-path=/tmp/nvdimm,\
+share=yes,size=536870912 \
+-device nvdimm,node=0,memdev=memnvdimm0,id=nvdimm0,slot=0 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-display none \
+-no-user-config \
+-nodefaults \
+-chardev socket,id=charmonitor,fd=1729,server,nowait \
+-mon chardev=charmonitor,id=monitor,mode=control \
+-rtc base=utc \
+-no-shutdown \
+-no-acpi \
+-boot strict=on \
+-device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \
+-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
+-device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 \
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 \
+-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
+resourcecontrol=deny \
+-msg timestamp=on
diff --git a/tests/qemuxml2argvdata/hugepages-nvdimm.xml b/tests/qemuxml2argvdata/hugepages-nvdimm.xml
new file mode 100644
index 0000000000..cdc409ff32
--- /dev/null
+++ b/tests/qemuxml2argvdata/hugepages-nvdimm.xml
@@ -0,0 +1,59 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <maxMemory slots='16' unit='KiB'>1099511627776</maxMemory>
+ <memory unit='KiB'>1267710</memory>
+ <currentMemory unit='KiB'>1267710</currentMemory>
+ <memoryBacking>
+ <hugepages>
+ <page size='2048' unit='KiB'/>
+ </hugepages>
+ <access mode='shared'/>
+ </memoryBacking>
+ <vcpu placement='static' cpuset='0-1'>2</vcpu>
+ <os>
+ <type arch='i686' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <cpu>
+ <topology sockets='2' cores='1' threads='1'/>
+ <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-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='ide' index='0'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+ </controller>
+ <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>
+ <memory model='nvdimm'>
+ <source>
+ <path>/tmp/nvdimm</path>
+ </source>
+ <target>
+ <size unit='KiB'>523264</size>
+ <node>0</node>
+ </target>
+ <address type='dimm' slot='0'/>
+ </memory>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 96482a84a1..8a7b82a1f2 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -994,6 +994,7 @@ mymain(void)
DO_TEST_FAILURE("hugepages-memaccess3",
QEMU_CAPS_OBJECT_MEMORY_RAM, QEMU_CAPS_OBJECT_MEMORY_FILE,
QEMU_CAPS_VIRTIO_SCSI);
+ DO_TEST_CAPS_LATEST("hugepages-nvdimm");
DO_TEST("nosharepages", QEMU_CAPS_MEM_MERGE);
DO_TEST("disk-cdrom", NONE);
DO_TEST_CAPS_LATEST("disk-cdrom");
diff --git a/tests/qemuxml2xmloutdata/hugepages-nvdimm.xml b/tests/qemuxml2xmloutdata/hugepages-nvdimm.xml
new file mode 120000
index 0000000000..8288d3c58f
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/hugepages-nvdimm.xml
@@ -0,0 +1 @@
+../qemuxml2argvdata/hugepages-nvdimm.xml
\ No newline at end of file
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 7fe5043519..8e58c7b844 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -339,6 +339,7 @@ mymain(void)
DO_TEST("hugepages-shared", NONE);
DO_TEST("hugepages-memaccess", NONE);
DO_TEST("hugepages-memaccess2", NONE);
+ DO_TEST("hugepages-nvdimm", NONE);
DO_TEST("nosharepages", NONE);
DO_TEST("restore-v2", NONE);
DO_TEST("migrate", NONE);
--
2.16.4
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
On Mon, Aug 13, 2018 at 04:13:31PM +0200, Michal Privoznik wrote: > If a domain has hugepages configured and we're currently building > memory-backend-file for a nvdimm device that domain has we will > put hugepages path onto the command line. It should have been > nvdimm path configured in the XML. > > Signed-off-by: Michal Privoznik <mprivozn@redhat.com> > --- > src/qemu/qemu_command.c | 10 ++-- > .../hugepages-nvdimm.x86_64-latest.args | 38 ++++++++++++++ > tests/qemuxml2argvdata/hugepages-nvdimm.xml | 59 ++++++++++++++++++++++ > tests/qemuxml2argvtest.c | 1 + > tests/qemuxml2xmloutdata/hugepages-nvdimm.xml | 1 + > tests/qemuxml2xmltest.c | 1 + > 6 files changed, 105 insertions(+), 5 deletions(-) > create mode 100644 tests/qemuxml2argvdata/hugepages-nvdimm.x86_64-latest.args > create mode 100644 tests/qemuxml2argvdata/hugepages-nvdimm.xml > create mode 120000 tests/qemuxml2xmloutdata/hugepages-nvdimm.xml > > diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c > index a3fadc505d..ddb90895e0 100644 > --- a/src/qemu/qemu_command.c > +++ b/src/qemu/qemu_command.c > @@ -3148,14 +3148,14 @@ qemuBuildMemoryBackendProps(virJSONValuePtr *backendProps, > if (useHugepage || mem->nvdimmPath || memAccess || > def->mem.source == VIR_DOMAIN_MEMORY_SOURCE_FILE) { > > - if (useHugepage) { > - if (qemuGetDomainHupageMemPath(def, cfg, pagesize, &memPath) < 0) > - goto cleanup; > - prealloc = true; > - } else if (mem->nvdimmPath) { > + if (mem->nvdimmPath) { > if (VIR_STRDUP(memPath, mem->nvdimmPath) < 0) > goto cleanup; > prealloc = true; > + } else if (useHugepage) { > + if (qemuGetDomainHupageMemPath(def, cfg, pagesize, &memPath) < 0) > + goto cleanup; > + prealloc = true; > } else { > /* We can have both pagesize and mem source. If that's the case, > * prefer hugepages as those are more specific. */ > diff --git a/tests/qemuxml2argvdata/hugepages-nvdimm.x86_64-latest.args b/tests/qemuxml2argvdata/hugepages-nvdimm.x86_64-latest.args > new file mode 100644 > index 0000000000..3a6dd364da > --- /dev/null > +++ b/tests/qemuxml2argvdata/hugepages-nvdimm.x86_64-latest.args > @@ -0,0 +1,38 @@ > +LC_ALL=C \ > +PATH=/bin \ > +HOME=/home/test \ > +USER=test \ > +LOGNAME=test \ > +QEMU_AUDIO_DRV=none \ > +/usr/bin/qemu-system-i686 \ > +-name guest=QEMUGuest1,debug-threads=on \ > +-S \ > +-object secret,id=masterKey0,format=raw,\ > +file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ > +-machine pc,accel=tcg,usb=off,dump-guest-core=off,nvdimm=on \ > +-m size=1048576k,slots=16,maxmem=1099511627776k \ > +-realtime mlock=off \ > +-smp 2,sockets=2,cores=1,threads=1 \ > +-object memory-backend-file,id=ram-node0,prealloc=yes,\ > +mem-path=/dev/hugepages2M/libvirt/qemu/-1-QEMUGuest1,share=yes,size=1073741824 \ > +-numa node,nodeid=0,cpus=0-1,memdev=ram-node0 \ > +-object memory-backend-file,id=memnvdimm0,prealloc=yes,mem-path=/tmp/nvdimm,\ > +share=yes,size=536870912 \ > +-device nvdimm,node=0,memdev=memnvdimm0,id=nvdimm0,slot=0 \ > +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ > +-display none \ > +-no-user-config \ > +-nodefaults \ > +-chardev socket,id=charmonitor,fd=1729,server,nowait \ > +-mon chardev=charmonitor,id=monitor,mode=control \ > +-rtc base=utc \ > +-no-shutdown \ > +-no-acpi \ > +-boot strict=on \ > +-device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \ > +-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \ > +-device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 \ > +-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 \ > +-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\ > +resourcecontrol=deny \ > +-msg timestamp=on > diff --git a/tests/qemuxml2argvdata/hugepages-nvdimm.xml b/tests/qemuxml2argvdata/hugepages-nvdimm.xml > new file mode 100644 > index 0000000000..cdc409ff32 > --- /dev/null > +++ b/tests/qemuxml2argvdata/hugepages-nvdimm.xml > @@ -0,0 +1,59 @@ > +<domain type='qemu'> > + <name>QEMUGuest1</name> > + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> > + <maxMemory slots='16' unit='KiB'>1099511627776</maxMemory> > + <memory unit='KiB'>1267710</memory> > + <currentMemory unit='KiB'>1267710</currentMemory> > + <memoryBacking> > + <hugepages> > + <page size='2048' unit='KiB'/> > + </hugepages> > + <access mode='shared'/> > + </memoryBacking> > + <vcpu placement='static' cpuset='0-1'>2</vcpu> > + <os> > + <type arch='i686' machine='pc'>hvm</type> > + <boot dev='hd'/> > + </os> > + <cpu> > + <topology sockets='2' cores='1' threads='1'/> > + <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-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='ide' index='0'> > + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> > + </controller> Remove the disk and ide controller. > + <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> Change the memballoon mode to none. We should try to keep the XML as minimal as possible and include only relevant devices. Reviewed-by: Pavel Hrdina <phrdina@redhat.com> -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
© 2016 - 2024 Red Hat, Inc.