[PATCH 16/16] qemu: Generate command line for main-loop pool size

Michal Privoznik mprivozn at redhat.com
Thu Jun 2 07:18:06 UTC 2022


Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2059511
Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
---
 src/qemu/qemu_command.c                       | 33 +++++++++++++++++++
 ...othreads-ids-pool-sizes.x86_64-latest.args |  1 +
 2 files changed, 34 insertions(+)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 86b5193651..9a9e9699e5 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -7463,6 +7463,36 @@ qemuBuildIOThreadCommandLine(virCommand *cmd,
 }
 
 
+static int
+qemuBuildMainLoopCommandLine(virCommand *cmd,
+                             const virDomainDef *def,
+                             virQEMUCaps *qemuCaps)
+{
+    g_autoptr(virJSONValue) props = NULL;
+
+    if (!def->mainLoop)
+        return 0;
+
+    if (qemuMonitorCreateObjectProps(&props, "main-loop", "main-loop", NULL) < 0)
+        return -1;
+
+    if (def->mainLoop->pool_min >= 0 &&
+        virJSONValueObjectAppendNumberLong(props, "thread-pool-min",
+                                           def->mainLoop->pool_min) < 0)
+        return -1;
+
+    if (def->mainLoop->pool_max >= 0 &&
+        virJSONValueObjectAppendNumberLong(props, "thread-pool-max",
+                                           def->mainLoop->pool_max) < 0)
+        return -1;
+
+    if (qemuBuildObjectCommandlineFromJSON(cmd, props, qemuCaps) < 0)
+        return -1;
+
+    return 0;
+}
+
+
 static int
 qemuBuildNumaCellCache(virCommand *cmd,
                        const virDomainDef *def,
@@ -10556,6 +10586,9 @@ qemuBuildCommandLine(virDomainObj *vm,
     if (qemuBuildIOThreadCommandLine(cmd, def, qemuCaps) < 0)
         return NULL;
 
+    if (qemuBuildMainLoopCommandLine(cmd, def, qemuCaps) < 0)
+        return NULL;
+
     if (virDomainNumaGetNodeCount(def->numa) &&
         qemuBuildNumaCommandLine(cfg, def, cmd, priv) < 0)
         return NULL;
diff --git a/tests/qemuxml2argvdata/iothreads-ids-pool-sizes.x86_64-latest.args b/tests/qemuxml2argvdata/iothreads-ids-pool-sizes.x86_64-latest.args
index 32517e3d29..5f88ec2ed9 100644
--- a/tests/qemuxml2argvdata/iothreads-ids-pool-sizes.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/iothreads-ids-pool-sizes.x86_64-latest.args
@@ -22,6 +22,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
 -object '{"qom-type":"iothread","id":"iothread1"}' \
 -object '{"qom-type":"iothread","id":"iothread3"}' \
 -object '{"qom-type":"iothread","id":"iothread5"}' \
+-object '{"qom-type":"main-loop","id":"main-loop","thread-pool-min":10,"thread-pool-max":120}' \
 -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
 -display none \
 -no-user-config \
-- 
2.35.1



More information about the libvir-list mailing list