|
|
d759b5 |
From 52c101b96262131e4ed94aacff24f826db7302c4 Mon Sep 17 00:00:00 2001
|
|
|
d759b5 |
Message-Id: <52c101b96262131e4ed94aacff24f826db7302c4@dist-git>
|
|
|
d759b5 |
From: Michal Privoznik <mprivozn@redhat.com>
|
|
|
d759b5 |
Date: Fri, 28 Jun 2019 17:12:41 +0200
|
|
|
d759b5 |
Subject: [PATCH] qemu: Prefer nvdimmPath over hugepages for
|
|
|
d759b5 |
memory-backend-file
|
|
|
d759b5 |
MIME-Version: 1.0
|
|
|
d759b5 |
Content-Type: text/plain; charset=UTF-8
|
|
|
d759b5 |
Content-Transfer-Encoding: 8bit
|
|
|
d759b5 |
|
|
|
d759b5 |
If a domain has hugepages configured and we're currently building
|
|
|
d759b5 |
memory-backend-file for a nvdimm device that domain has we will
|
|
|
d759b5 |
put hugepages path onto the command line. It should have been
|
|
|
d759b5 |
nvdimm path configured in the XML.
|
|
|
d759b5 |
|
|
|
d759b5 |
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
|
|
d759b5 |
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
|
|
|
d759b5 |
(cherry picked from commit 9eae8398edde9446ecc99f4f393bea94652fb6a2)
|
|
|
d759b5 |
|
|
|
d759b5 |
https://bugzilla.redhat.com/show_bug.cgi?id=1724980
|
|
|
d759b5 |
|
|
|
d759b5 |
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
|
|
d759b5 |
Message-Id: <349f7180359c4b9e447602a760f639b7030d9c57.1561734747.git.mprivozn@redhat.com>
|
|
|
d759b5 |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
d759b5 |
---
|
|
|
d759b5 |
src/qemu/qemu_command.c | 8 ++--
|
|
|
d759b5 |
.../hugepages-nvdimm.x86_64-latest.args | 35 ++++++++++++++
|
|
|
d759b5 |
tests/qemuxml2argvdata/hugepages-nvdimm.xml | 48 +++++++++++++++++++
|
|
|
d759b5 |
tests/qemuxml2argvtest.c | 1 +
|
|
|
d759b5 |
tests/qemuxml2xmloutdata/hugepages-nvdimm.xml | 1 +
|
|
|
d759b5 |
tests/qemuxml2xmltest.c | 1 +
|
|
|
d759b5 |
6 files changed, 90 insertions(+), 4 deletions(-)
|
|
|
d759b5 |
create mode 100644 tests/qemuxml2argvdata/hugepages-nvdimm.x86_64-latest.args
|
|
|
d759b5 |
create mode 100644 tests/qemuxml2argvdata/hugepages-nvdimm.xml
|
|
|
d759b5 |
create mode 120000 tests/qemuxml2xmloutdata/hugepages-nvdimm.xml
|
|
|
d759b5 |
|
|
|
d759b5 |
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
|
|
|
d759b5 |
index 929f549a69..08660abbe4 100644
|
|
|
d759b5 |
--- a/src/qemu/qemu_command.c
|
|
|
d759b5 |
+++ b/src/qemu/qemu_command.c
|
|
|
d759b5 |
@@ -3113,12 +3113,12 @@ qemuBuildMemoryBackendProps(virJSONValuePtr *backendProps,
|
|
|
d759b5 |
if (useHugepage || mem->nvdimmPath || memAccess ||
|
|
|
d759b5 |
def->mem.source == VIR_DOMAIN_MEMORY_SOURCE_FILE) {
|
|
|
d759b5 |
|
|
|
d759b5 |
- if (useHugepage) {
|
|
|
d759b5 |
- if (qemuGetDomainHupageMemPath(def, cfg, pagesize, &memPath) < 0)
|
|
|
d759b5 |
+ if (mem->nvdimmPath) {
|
|
|
d759b5 |
+ if (VIR_STRDUP(memPath, mem->nvdimmPath) < 0)
|
|
|
d759b5 |
goto cleanup;
|
|
|
d759b5 |
prealloc = true;
|
|
|
d759b5 |
- } else if (mem->nvdimmPath) {
|
|
|
d759b5 |
- if (VIR_STRDUP(memPath, mem->nvdimmPath) < 0)
|
|
|
d759b5 |
+ } else if (useHugepage) {
|
|
|
d759b5 |
+ if (qemuGetDomainHupageMemPath(def, cfg, pagesize, &memPath) < 0)
|
|
|
d759b5 |
goto cleanup;
|
|
|
d759b5 |
prealloc = true;
|
|
|
d759b5 |
} else {
|
|
|
d759b5 |
diff --git a/tests/qemuxml2argvdata/hugepages-nvdimm.x86_64-latest.args b/tests/qemuxml2argvdata/hugepages-nvdimm.x86_64-latest.args
|
|
|
d759b5 |
new file mode 100644
|
|
|
d759b5 |
index 0000000000..bc3e64948a
|
|
|
d759b5 |
--- /dev/null
|
|
|
d759b5 |
+++ b/tests/qemuxml2argvdata/hugepages-nvdimm.x86_64-latest.args
|
|
|
d759b5 |
@@ -0,0 +1,35 @@
|
|
|
d759b5 |
+LC_ALL=C \
|
|
|
d759b5 |
+PATH=/bin \
|
|
|
d759b5 |
+HOME=/home/test \
|
|
|
d759b5 |
+USER=test \
|
|
|
d759b5 |
+LOGNAME=test \
|
|
|
d759b5 |
+QEMU_AUDIO_DRV=none \
|
|
|
d759b5 |
+/usr/bin/qemu-system-i686 \
|
|
|
d759b5 |
+-name guest=QEMUGuest1,debug-threads=on \
|
|
|
d759b5 |
+-S \
|
|
|
d759b5 |
+-object secret,id=masterKey0,format=raw,\
|
|
|
d759b5 |
+file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
|
|
|
d759b5 |
+-machine pc,accel=tcg,usb=off,dump-guest-core=off,nvdimm=on \
|
|
|
d759b5 |
+-m size=1048576k,slots=16,maxmem=1099511627776k \
|
|
|
d759b5 |
+-realtime mlock=off \
|
|
|
d759b5 |
+-smp 2,sockets=2,cores=1,threads=1 \
|
|
|
d759b5 |
+-object memory-backend-file,id=ram-node0,prealloc=yes,\
|
|
|
d759b5 |
+mem-path=/dev/hugepages2M/libvirt/qemu/-1-QEMUGuest1,share=yes,size=1073741824 \
|
|
|
d759b5 |
+-numa node,nodeid=0,cpus=0-1,memdev=ram-node0 \
|
|
|
d759b5 |
+-object memory-backend-file,id=memnvdimm0,prealloc=yes,mem-path=/tmp/nvdimm,\
|
|
|
d759b5 |
+share=yes,size=536870912 \
|
|
|
d759b5 |
+-device nvdimm,node=0,memdev=memnvdimm0,id=nvdimm0,slot=0 \
|
|
|
d759b5 |
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
|
|
|
d759b5 |
+-display none \
|
|
|
d759b5 |
+-no-user-config \
|
|
|
d759b5 |
+-nodefaults \
|
|
|
d759b5 |
+-chardev socket,id=charmonitor,fd=1729,server,nowait \
|
|
|
d759b5 |
+-mon chardev=charmonitor,id=monitor,mode=control \
|
|
|
d759b5 |
+-rtc base=utc \
|
|
|
d759b5 |
+-no-shutdown \
|
|
|
d759b5 |
+-no-acpi \
|
|
|
d759b5 |
+-boot strict=on \
|
|
|
d759b5 |
+-device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \
|
|
|
d759b5 |
+-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
|
|
|
d759b5 |
+resourcecontrol=deny \
|
|
|
d759b5 |
+-msg timestamp=on
|
|
|
d759b5 |
diff --git a/tests/qemuxml2argvdata/hugepages-nvdimm.xml b/tests/qemuxml2argvdata/hugepages-nvdimm.xml
|
|
|
d759b5 |
new file mode 100644
|
|
|
d759b5 |
index 0000000000..babb3a6179
|
|
|
d759b5 |
--- /dev/null
|
|
|
d759b5 |
+++ b/tests/qemuxml2argvdata/hugepages-nvdimm.xml
|
|
|
d759b5 |
@@ -0,0 +1,48 @@
|
|
|
d759b5 |
+<domain type='qemu'>
|
|
|
d759b5 |
+ <name>QEMUGuest1</name>
|
|
|
d759b5 |
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
|
|
d759b5 |
+ <maxMemory slots='16' unit='KiB'>1099511627776</maxMemory>
|
|
|
d759b5 |
+ <memory unit='KiB'>1267710</memory>
|
|
|
d759b5 |
+ <currentMemory unit='KiB'>1267710</currentMemory>
|
|
|
d759b5 |
+ <memoryBacking>
|
|
|
d759b5 |
+ <hugepages>
|
|
|
d759b5 |
+ <page size='2048' unit='KiB'/>
|
|
|
d759b5 |
+ </hugepages>
|
|
|
d759b5 |
+ <access mode='shared'/>
|
|
|
d759b5 |
+ </memoryBacking>
|
|
|
d759b5 |
+ <vcpu placement='static' cpuset='0-1'>2</vcpu>
|
|
|
d759b5 |
+ <os>
|
|
|
d759b5 |
+ <type arch='i686' machine='pc'>hvm</type>
|
|
|
d759b5 |
+ <boot dev='hd'/>
|
|
|
d759b5 |
+ </os>
|
|
|
d759b5 |
+ <cpu>
|
|
|
d759b5 |
+ <topology sockets='2' cores='1' threads='1'/>
|
|
|
d759b5 |
+ <numa>
|
|
|
d759b5 |
+ <cell id='0' cpus='0-1' memory='1048576' unit='KiB'/>
|
|
|
d759b5 |
+ </numa>
|
|
|
d759b5 |
+ </cpu>
|
|
|
d759b5 |
+ <clock offset='utc'/>
|
|
|
d759b5 |
+ <on_poweroff>destroy</on_poweroff>
|
|
|
d759b5 |
+ <on_reboot>restart</on_reboot>
|
|
|
d759b5 |
+ <on_crash>destroy</on_crash>
|
|
|
d759b5 |
+ <devices>
|
|
|
d759b5 |
+ <emulator>/usr/bin/qemu-system-i686</emulator>
|
|
|
d759b5 |
+ <controller type='usb' index='0'>
|
|
|
d759b5 |
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
|
|
|
d759b5 |
+ </controller>
|
|
|
d759b5 |
+ <controller type='pci' index='0' model='pci-root'/>
|
|
|
d759b5 |
+ <input type='mouse' bus='ps2'/>
|
|
|
d759b5 |
+ <input type='keyboard' bus='ps2'/>
|
|
|
d759b5 |
+ <memballoon model='none'/>
|
|
|
d759b5 |
+ <memory model='nvdimm'>
|
|
|
d759b5 |
+ <source>
|
|
|
d759b5 |
+ <path>/tmp/nvdimm</path>
|
|
|
d759b5 |
+ </source>
|
|
|
d759b5 |
+ <target>
|
|
|
d759b5 |
+ <size unit='KiB'>523264</size>
|
|
|
d759b5 |
+ <node>0</node>
|
|
|
d759b5 |
+ </target>
|
|
|
d759b5 |
+ <address type='dimm' slot='0'/>
|
|
|
d759b5 |
+ </memory>
|
|
|
d759b5 |
+ </devices>
|
|
|
d759b5 |
+</domain>
|
|
|
d759b5 |
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
|
|
|
d759b5 |
index 9933e4bde1..6c09c6bb4a 100644
|
|
|
d759b5 |
--- a/tests/qemuxml2argvtest.c
|
|
|
d759b5 |
+++ b/tests/qemuxml2argvtest.c
|
|
|
d759b5 |
@@ -994,6 +994,7 @@ mymain(void)
|
|
|
d759b5 |
DO_TEST_FAILURE("hugepages-memaccess3",
|
|
|
d759b5 |
QEMU_CAPS_OBJECT_MEMORY_RAM, QEMU_CAPS_OBJECT_MEMORY_FILE,
|
|
|
d759b5 |
QEMU_CAPS_VIRTIO_SCSI);
|
|
|
d759b5 |
+ DO_TEST_CAPS_LATEST("hugepages-nvdimm");
|
|
|
d759b5 |
DO_TEST("nosharepages", QEMU_CAPS_MEM_MERGE);
|
|
|
d759b5 |
DO_TEST("disk-cdrom", NONE);
|
|
|
d759b5 |
DO_TEST("disk-iscsi", NONE);
|
|
|
d759b5 |
diff --git a/tests/qemuxml2xmloutdata/hugepages-nvdimm.xml b/tests/qemuxml2xmloutdata/hugepages-nvdimm.xml
|
|
|
d759b5 |
new file mode 120000
|
|
|
d759b5 |
index 0000000000..8288d3c58f
|
|
|
d759b5 |
--- /dev/null
|
|
|
d759b5 |
+++ b/tests/qemuxml2xmloutdata/hugepages-nvdimm.xml
|
|
|
d759b5 |
@@ -0,0 +1 @@
|
|
|
d759b5 |
+../qemuxml2argvdata/hugepages-nvdimm.xml
|
|
|
d759b5 |
\ No newline at end of file
|
|
|
d759b5 |
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
|
|
|
d759b5 |
index 1f67d74797..341b7cbcc6 100644
|
|
|
d759b5 |
--- a/tests/qemuxml2xmltest.c
|
|
|
d759b5 |
+++ b/tests/qemuxml2xmltest.c
|
|
|
d759b5 |
@@ -344,6 +344,7 @@ mymain(void)
|
|
|
d759b5 |
DO_TEST("hugepages-shared", NONE);
|
|
|
d759b5 |
DO_TEST("hugepages-memaccess", NONE);
|
|
|
d759b5 |
DO_TEST("hugepages-memaccess2", NONE);
|
|
|
d759b5 |
+ DO_TEST("hugepages-nvdimm", NONE);
|
|
|
d759b5 |
DO_TEST("nosharepages", NONE);
|
|
|
d759b5 |
DO_TEST("restore-v2", NONE);
|
|
|
d759b5 |
DO_TEST("migrate", NONE);
|
|
|
d759b5 |
--
|
|
|
d759b5 |
2.22.1
|
|
|
d759b5 |
|