[PATCH 6/7] qemu_command: Generate thread-context object for main guest memory

Michal Privoznik mprivozn at redhat.com
Mon Nov 14 15:35:34 UTC 2022


When generating memory for main guest memory memory-backend-*
might be used. This means, we may need to generate thread-context
objects too.

Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
---
 src/qemu/qemu_command.c                                  | 9 +++++++++
 .../numatune-system-memory.x86_64-latest.args            | 3 ++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 49ecd91300..b8aafd39c8 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -7009,6 +7009,7 @@ qemuBuildMemCommandLineMemoryDefaultBackend(virCommand *cmd,
 {
     g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(priv->driver);
     g_autoptr(virJSONValue) props = NULL;
+    g_autoptr(virJSONValue) tcProps = NULL;
     virDomainMemoryDef mem = { 0 };
 
     mem.size = virDomainDefGetMemoryInitial(def);
@@ -7019,6 +7020,14 @@ qemuBuildMemCommandLineMemoryDefaultBackend(virCommand *cmd,
                                     priv, def, &mem, false, true) < 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/numatune-system-memory.x86_64-latest.args b/tests/qemuxml2argvdata/numatune-system-memory.x86_64-latest.args
index fd93abe3eb..125dc43153 100644
--- a/tests/qemuxml2argvdata/numatune-system-memory.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/numatune-system-memory.x86_64-latest.args
@@ -14,7 +14,8 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
 -accel tcg \
 -cpu qemu64 \
 -m 214 \
--object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264,"host-nodes":[0],"policy":"bind"}' \
+-object '{"qom-type":"thread-context","id":"tc-pc.ram","node-affinity":[0]}' \
+-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264,"host-nodes":[0],"policy":"bind","prealloc-context":"tc-pc.ram"}' \
 -overcommit mem-lock=off \
 -smp 2,sockets=2,cores=1,threads=1 \
 -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
-- 
2.37.4



More information about the libvir-list mailing list