[PATCH v2 05/10] qemu: Implement memAccess for <memory/> banks

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

 



Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 src/qemu/qemu_command.c                            | 11 +++++++--
 src/qemu/qemu_command.h                            |  1 +
 src/qemu/qemu_hotplug.c                            |  3 ++-
 ...muxml2argv-memory-hotplug-nvdimm-memAccess.args | 26 ++++++++++++++++++++++
 tests/qemuxml2argvtest.c                           |  2 ++
 5 files changed, 40 insertions(+), 3 deletions(-)
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-memory-hotplug-nvdimm-memAccess.args

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 6b83d1c..f888de3 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -3062,6 +3062,7 @@ qemuBuildControllerDevCommandLine(virCommandPtr cmd,
  * @hostNodes: map of host nodes to alloc the memory in, NULL for default
  * @autoNodeset: fallback nodeset in case of automatic numa placement
  * @memPath: request memory-backend-file with specific mem-path
+ * @memAccessReq: specifically requested memAccess mode
  * @def: domain definition object
  * @qemuCaps: qemu capabilities object
  * @cfg: qemu driver config object
@@ -3084,6 +3085,7 @@ qemuBuildMemoryBackendStr(unsigned long long size,
                           virBitmapPtr userNodeset,
                           virBitmapPtr autoNodeset,
                           const char *memPath,
+                          virNumaMemAccess memAccessReq,
                           virDomainDefPtr def,
                           virQEMUCapsPtr qemuCaps,
                           virQEMUDriverConfigPtr cfg,
@@ -3119,6 +3121,9 @@ qemuBuildMemoryBackendStr(unsigned long long size,
         memAccess = virDomainNumaGetNodeMemoryAccessMode(def->numa, guestNode);
     }
 
+    if (memAccessReq)
+        memAccess = memAccessReq;
+
     if (virDomainNumatuneGetMode(def->numa, guestNode, &mode) < 0 &&
         virDomainNumatuneGetMode(def->numa, -1, &mode) < 0)
         mode = VIR_DOMAIN_NUMATUNE_MEM_STRICT;
@@ -3318,7 +3323,8 @@ qemuBuildMemoryCellBackendStr(virDomainDefPtr def,
         goto cleanup;
 
     if ((rc = qemuBuildMemoryBackendStr(memsize, 0, cell, NULL, auto_nodeset,
-                                        NULL, def, qemuCaps, cfg, &backendType,
+                                        NULL, VIR_NUMA_MEM_ACCESS_DEFAULT,
+                                        def, qemuCaps, cfg, &backendType,
                                         &props, false)) < 0)
         goto cleanup;
 
@@ -3360,7 +3366,8 @@ qemuBuildMemoryDimmBackendStr(virDomainMemoryDefPtr mem,
 
     if (qemuBuildMemoryBackendStr(mem->size, mem->pagesize,
                                   mem->targetNode, mem->sourceNodes, auto_nodeset,
-                                  mem->path, def, qemuCaps, cfg,
+                                  mem->path, mem->memAccess,
+                                  def, qemuCaps, cfg,
                                   &backendType, &props, true) < 0)
         goto cleanup;
 
diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h
index 003a5d7..29c0f58 100644
--- a/src/qemu/qemu_command.h
+++ b/src/qemu/qemu_command.h
@@ -119,6 +119,7 @@ int qemuBuildMemoryBackendStr(unsigned long long size,
                               virBitmapPtr userNodeset,
                               virBitmapPtr autoNodeset,
                               const char *memPath,
+                              virNumaMemAccess memAccessReq,
                               virDomainDefPtr def,
                               virQEMUCapsPtr qemuCaps,
                               virQEMUDriverConfigPtr cfg,
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index bf22b0a..6ba0b8e 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -1878,7 +1878,8 @@ qemuDomainAttachMemory(virQEMUDriverPtr driver,
 
     if (qemuBuildMemoryBackendStr(mem->size, mem->pagesize,
                                   mem->targetNode, mem->sourceNodes, NULL,
-                                  mem->path, vm->def, priv->qemuCaps, cfg,
+                                  mem->path, mem->memAccess, vm->def,
+                                  priv->qemuCaps, cfg,
                                   &backendType, &props, true) < 0)
         goto cleanup;
 
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-memory-hotplug-nvdimm-memAccess.args b/tests/qemuxml2argvdata/qemuxml2argv-memory-hotplug-nvdimm-memAccess.args
new file mode 100644
index 0000000..9446259
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-memory-hotplug-nvdimm-memAccess.args
@@ -0,0 +1,26 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/home/test \
+USER=test \
+LOGNAME=test \
+QEMU_AUDIO_DRV=none \
+/usr/bin/qemu \
+-name QEMUGuest1 \
+-S \
+-machine pc,accel=tcg,nvdimm=on \
+-m size=219136k,slots=16,maxmem=1099511627776k \
+-smp 2,sockets=2,cores=1,threads=1 \
+-numa node,nodeid=0,cpus=0-1,mem=214 \
+-object memory-backend-file,id=memnvdimm0,mem-path=/tmp/nvdimm,share=no,\
+size=536870912 \
+-device nvdimm,node=0,memdev=memnvdimm0,id=nvdimm0 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-nographic \
+-nodefaults \
+-monitor unix:/tmp/lib/domain--1-QEMUGuest1/monitor.sock,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/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 1995ccc..985412c 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1987,6 +1987,8 @@ mymain(void)
             QEMU_CAPS_OBJECT_MEMORY_RAM, QEMU_CAPS_OBJECT_MEMORY_FILE);
     DO_TEST("memory-hotplug-nvdimm", QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_DEVICE_NVDIMM,
             QEMU_CAPS_NUMA, QEMU_CAPS_OBJECT_MEMORY_RAM, QEMU_CAPS_OBJECT_MEMORY_FILE);
+    DO_TEST("memory-hotplug-nvdimm-memAccess", QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_DEVICE_NVDIMM,
+            QEMU_CAPS_NUMA, QEMU_CAPS_OBJECT_MEMORY_RAM, QEMU_CAPS_OBJECT_MEMORY_FILE);
 
     DO_TEST("machine-aeskeywrap-on-caps",
             QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_AES_KEY_WRAP,
-- 
2.8.4

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



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