When generating memory for memory devices memory-backend-* might
be used. This means, we may need to generate thread-context
objects too.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/qemu/qemu_command.c | 9 +++++++++
.../hugepages-memaccess.x86_64-latest.args | 3 ++-
.../hugepages-memaccess2.x86_64-latest.args | 3 ++-
.../hugepages-numa-default-dimm.x86_64-latest.args | 3 ++-
.../memfd-memory-numa.x86_64-latest.args | 3 ++-
.../memory-hotplug-dimm-addr.x86_64-latest.args | 3 ++-
.../memory-hotplug-virtio-mem.x86_64-latest.args | 3 ++-
.../pages-dimm-discard.x86_64-latest.args | 3 ++-
8 files changed, 23 insertions(+), 7 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index a0f2644ba1..49ecd91300 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -3503,6 +3503,7 @@ qemuBuildMemoryDimmBackendStr(virCommand *cmd,
qemuDomainObjPrivate *priv)
{
g_autoptr(virJSONValue) props = NULL;
+ g_autoptr(virJSONValue) tcProps = NULL;
g_autofree char *alias = NULL;
if (!mem->info.alias) {
@@ -3517,6 +3518,14 @@ qemuBuildMemoryDimmBackendStr(virCommand *cmd,
priv, def, mem, true, false) < 0)
return -1;
+ if (qemuBuildThreadContextProps(&tcProps, &props, priv) < 0)
+ return -1;
+
+ if (tcProps &&
+ qemuBuildObjectCommandlineFromJSON(cmd, tcProps,
+ priv->qemuCaps) < 0)
+ return -1;
+
if (qemuBuildObjectCommandlineFromJSON(cmd, props, priv->qemuCaps) < 0)
return -1;
diff --git a/tests/qemuxml2argvdata/hugepages-memaccess.x86_64-latest.args
b/tests/qemuxml2argvdata/hugepages-memaccess.x86_64-latest.args
index 9db085fd1d..8342a30c86 100644
--- a/tests/qemuxml2argvdata/hugepages-memaccess.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/hugepages-memaccess.x86_64-latest.args
@@ -39,7 +39,8 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
-no-acpi \
-boot strict=on \
-device
'{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}'
\
--object
'{"qom-type":"memory-backend-file","id":"memdimm0","mem-path":"/dev/hugepages2M/libvirt/qemu/-1-QEMUGuest1","share":true,"prealloc":true,"size":536870912,"host-nodes":[0,1,2,3],"policy":"bind"}'
\
+-object
'{"qom-type":"thread-context","id":"tc-memdimm0","node-affinity":[0,1,2,3]}'
\
+-object
'{"qom-type":"memory-backend-file","id":"memdimm0","mem-path":"/dev/hugepages2M/libvirt/qemu/-1-QEMUGuest1","share":true,"prealloc":true,"size":536870912,"host-nodes":[0,1,2,3],"policy":"bind","prealloc-context":"tc-memdimm0"}'
\
-device
'{"driver":"pc-dimm","node":1,"memdev":"memdimm0","id":"dimm0","slot":0,"addr":4294967296}'
\
-blockdev
'{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}'
\
-blockdev
'{"node-name":"libvirt-1-format","read-only":false,"driver":"raw","file":"libvirt-1-storage"}'
\
diff --git a/tests/qemuxml2argvdata/hugepages-memaccess2.x86_64-latest.args
b/tests/qemuxml2argvdata/hugepages-memaccess2.x86_64-latest.args
index 37f6dfabe9..f73da5865d 100644
--- a/tests/qemuxml2argvdata/hugepages-memaccess2.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/hugepages-memaccess2.x86_64-latest.args
@@ -39,7 +39,8 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
-no-acpi \
-boot strict=on \
-device
'{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}'
\
--object
'{"qom-type":"memory-backend-file","id":"memdimm0","mem-path":"/dev/hugepages2M/libvirt/qemu/-1-QEMUGuest1","share":true,"prealloc":true,"size":536870912,"host-nodes":[0,1,2,3],"policy":"bind"}'
\
+-object
'{"qom-type":"thread-context","id":"tc-memdimm0","node-affinity":[0,1,2,3]}'
\
+-object
'{"qom-type":"memory-backend-file","id":"memdimm0","mem-path":"/dev/hugepages2M/libvirt/qemu/-1-QEMUGuest1","share":true,"prealloc":true,"size":536870912,"host-nodes":[0,1,2,3],"policy":"bind","prealloc-context":"tc-memdimm0"}'
\
-device
'{"driver":"pc-dimm","node":1,"memdev":"memdimm0","id":"dimm0","slot":0,"addr":4294967296}'
\
-blockdev
'{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}'
\
-blockdev
'{"node-name":"libvirt-1-format","read-only":false,"driver":"raw","file":"libvirt-1-storage"}'
\
diff --git a/tests/qemuxml2argvdata/hugepages-numa-default-dimm.x86_64-latest.args
b/tests/qemuxml2argvdata/hugepages-numa-default-dimm.x86_64-latest.args
index 015464bded..3b8dfeea16 100644
--- a/tests/qemuxml2argvdata/hugepages-numa-default-dimm.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/hugepages-numa-default-dimm.x86_64-latest.args
@@ -29,7 +29,8 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-fedora/.config \
-no-acpi \
-boot strict=on \
-device
'{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}'
\
--object
'{"qom-type":"memory-backend-file","id":"memdimm0","mem-path":"/dev/hugepages1G/libvirt/qemu/-1-fedora","prealloc":true,"size":1073741824,"host-nodes":[1,2,3],"policy":"bind"}'
\
+-object
'{"qom-type":"thread-context","id":"tc-memdimm0","node-affinity":[1,2,3]}'
\
+-object
'{"qom-type":"memory-backend-file","id":"memdimm0","mem-path":"/dev/hugepages1G/libvirt/qemu/-1-fedora","prealloc":true,"size":1073741824,"host-nodes":[1,2,3],"policy":"bind","prealloc-context":"tc-memdimm0"}'
\
-device
'{"driver":"pc-dimm","node":0,"memdev":"memdimm0","id":"dimm0","slot":0}'
\
-audiodev
'{"id":"audio1","driver":"none"}' \
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
diff --git a/tests/qemuxml2argvdata/memfd-memory-numa.x86_64-latest.args
b/tests/qemuxml2argvdata/memfd-memory-numa.x86_64-latest.args
index c51bb6f828..4748f0fbb2 100644
--- a/tests/qemuxml2argvdata/memfd-memory-numa.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/memfd-memory-numa.x86_64-latest.args
@@ -30,7 +30,8 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-instance-00000092/.config \
-no-acpi \
-boot strict=on \
-device
'{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}'
\
--object
'{"qom-type":"memory-backend-file","id":"memnvdimm0","mem-path":"/tmp/nvdimm","share":true,"prealloc":true,"prealloc-threads":8,"size":536870912,"host-nodes":[3],"policy":"preferred"}'
\
+-object
'{"qom-type":"thread-context","id":"tc-memnvdimm0","node-affinity":[3]}'
\
+-object
'{"qom-type":"memory-backend-file","id":"memnvdimm0","mem-path":"/tmp/nvdimm","share":true,"prealloc":true,"prealloc-threads":8,"size":536870912,"host-nodes":[3],"policy":"preferred","prealloc-context":"tc-memnvdimm0"}'
\
-device
'{"driver":"nvdimm","node":0,"memdev":"memnvdimm0","id":"nvdimm0","slot":0}'
\
-audiodev
'{"id":"audio1","driver":"none"}' \
-device
'{"driver":"virtio-balloon-pci","id":"balloon0","bus":"pci.0","addr":"0x3"}'
\
diff --git a/tests/qemuxml2argvdata/memory-hotplug-dimm-addr.x86_64-latest.args
b/tests/qemuxml2argvdata/memory-hotplug-dimm-addr.x86_64-latest.args
index ac24c77a2b..4e9bbde448 100644
--- a/tests/qemuxml2argvdata/memory-hotplug-dimm-addr.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/memory-hotplug-dimm-addr.x86_64-latest.args
@@ -29,7 +29,8 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
-no-acpi \
-boot strict=on \
-device
'{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}'
\
--object
'{"qom-type":"memory-backend-file","id":"memdimm0","mem-path":"/dev/hugepages2M/libvirt/qemu/-1-QEMUGuest1","prealloc":true,"size":536870912,"host-nodes":[1,2,3],"policy":"bind"}'
\
+-object
'{"qom-type":"thread-context","id":"tc-memdimm0","node-affinity":[1,2,3]}'
\
+-object
'{"qom-type":"memory-backend-file","id":"memdimm0","mem-path":"/dev/hugepages2M/libvirt/qemu/-1-QEMUGuest1","prealloc":true,"size":536870912,"host-nodes":[1,2,3],"policy":"bind","prealloc-context":"tc-memdimm0"}'
\
-device
'{"driver":"pc-dimm","node":0,"memdev":"memdimm0","id":"dimm0","slot":0,"addr":4294967296}'
\
-object
'{"qom-type":"memory-backend-ram","id":"memdimm2","size":536870912}'
\
-device
'{"driver":"pc-dimm","node":0,"memdev":"memdimm2","id":"dimm2","slot":2}'
\
diff --git a/tests/qemuxml2argvdata/memory-hotplug-virtio-mem.x86_64-latest.args
b/tests/qemuxml2argvdata/memory-hotplug-virtio-mem.x86_64-latest.args
index 5aa8110aeb..04876fc044 100644
--- a/tests/qemuxml2argvdata/memory-hotplug-virtio-mem.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/memory-hotplug-virtio-mem.x86_64-latest.args
@@ -32,7 +32,8 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
-device
'{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}'
\
-object
'{"qom-type":"memory-backend-ram","id":"memvirtiomem0","reserve":false,"size":1073741824}'
\
-device
'{"driver":"virtio-mem-pci","node":0,"block-size":2097152,"requested-size":536870912,"memdev":"memvirtiomem0","id":"virtiomem0","bus":"pci.0","addr":"0x2"}'
\
--object
'{"qom-type":"memory-backend-file","id":"memvirtiomem1","mem-path":"/dev/hugepages2M/libvirt/qemu/-1-QEMUGuest1","reserve":false,"size":2147483648,"host-nodes":[1,2,3],"policy":"bind"}'
\
+-object
'{"qom-type":"thread-context","id":"tc-memvirtiomem1","node-affinity":[1,2,3]}'
\
+-object
'{"qom-type":"memory-backend-file","id":"memvirtiomem1","mem-path":"/dev/hugepages2M/libvirt/qemu/-1-QEMUGuest1","reserve":false,"size":2147483648,"host-nodes":[1,2,3],"policy":"bind","prealloc-context":"tc-memvirtiomem1"}'
\
-device
'{"driver":"virtio-mem-pci","node":0,"block-size":2097152,"requested-size":1073741824,"memdev":"memvirtiomem1","prealloc":true,"id":"virtiomem1","bus":"pci.1","addr":"0x1"}'
\
-blockdev
'{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}'
\
-blockdev
'{"node-name":"libvirt-1-format","read-only":false,"driver":"raw","file":"libvirt-1-storage"}'
\
diff --git a/tests/qemuxml2argvdata/pages-dimm-discard.x86_64-latest.args
b/tests/qemuxml2argvdata/pages-dimm-discard.x86_64-latest.args
index 19ed3928de..2418133aa0 100644
--- a/tests/qemuxml2argvdata/pages-dimm-discard.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/pages-dimm-discard.x86_64-latest.args
@@ -29,7 +29,8 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-fedora/.config \
-no-acpi \
-boot strict=on \
-device
'{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}'
\
--object
'{"qom-type":"memory-backend-file","id":"memdimm0","mem-path":"/dev/hugepages1G/libvirt/qemu/-1-fedora","discard-data":false,"prealloc":true,"size":1073741824,"host-nodes":[1,2,3],"policy":"bind"}'
\
+-object
'{"qom-type":"thread-context","id":"tc-memdimm0","node-affinity":[1,2,3]}'
\
+-object
'{"qom-type":"memory-backend-file","id":"memdimm0","mem-path":"/dev/hugepages1G/libvirt/qemu/-1-fedora","discard-data":false,"prealloc":true,"size":1073741824,"host-nodes":[1,2,3],"policy":"bind","prealloc-context":"tc-memdimm0"}'
\
-device
'{"driver":"pc-dimm","node":0,"memdev":"memdimm0","id":"dimm0","slot":0}'
\
-object
'{"qom-type":"memory-backend-file","id":"memdimm1","mem-path":"/var/lib/libvirt/qemu/ram/-1-fedora/dimm1","discard-data":true,"share":false,"size":536870912}'
\
-device
'{"driver":"pc-dimm","node":0,"memdev":"memdimm1","id":"dimm1","slot":1}'
\
--
2.37.4