[PATCH 2/3] qemu: Use configured iothread poll parameters on startup

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

 



Implement the support for the persisted poll parameters and remove
restrictions on saving config when modifying them during runtime.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/qemu/qemu_command.c                       | 18 +++++++++++
 src/qemu/qemu_driver.c                        | 30 ++++++++++---------
 ...othreads-ids-pool-sizes.x86_64-latest.args |  6 ++--
 3 files changed, 37 insertions(+), 17 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 7e75354902..0693369faa 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -7300,6 +7300,24 @@ qemuBuildIOThreadCommandLine(virCommand *cmd,
                                          NULL) < 0)
             return -1;

+        if (iothread->set_poll_max_ns &&
+            virJSONValueObjectAdd(&props,
+                                  "U:poll-max-ns", iothread->poll_max_ns,
+                                  NULL) < 0)
+            return -1;
+
+        if (iothread->set_poll_grow &&
+            virJSONValueObjectAdd(&props,
+                                  "u:poll-grow", iothread->poll_grow,
+                                  NULL) < 0)
+            return -1;
+
+        if (iothread->set_poll_shrink &&
+            virJSONValueObjectAdd(&props,
+                                  "U:poll-shrink", iothread->poll_shrink,
+                                  NULL) < 0)
+            return -1;
+
         if (qemuBuildObjectCommandlineFromJSON(cmd, props, qemuCaps) < 0)
             return -1;
     }
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 09ae893daf..3412c5d6f2 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -5071,23 +5071,30 @@ qemuDomainHotplugModIOThread(virDomainObj *vm,
 }


-static int
+static void
 qemuDomainHotplugModIOThreadIDDef(virDomainIOThreadIDDef *def,
                                   qemuMonitorIOThreadInfo mondef)
 {
-    /* These have no representation in domain XML */
-    if (mondef.set_poll_grow ||
-        mondef.set_poll_max_ns ||
-        mondef.set_poll_shrink)
-        return -1;
+    if (mondef.set_poll_max_ns) {
+        def->poll_max_ns = mondef.poll_max_ns;
+        def->set_poll_max_ns = true;
+    }
+
+    if (mondef.set_poll_grow) {
+        def->poll_grow = mondef.poll_grow;
+        def->set_poll_grow = true;
+    }
+
+    if (mondef.set_poll_shrink) {
+        def->poll_shrink = mondef.poll_shrink;
+        def->set_poll_shrink = true;
+    }

     if (mondef.set_thread_pool_min)
         def->thread_pool_min = mondef.thread_pool_min;

     if (mondef.set_thread_pool_max)
         def->thread_pool_max = mondef.thread_pool_max;
-
-    return 0;
 }


@@ -5406,12 +5413,7 @@ qemuDomainChgIOThread(virQEMUDriver *driver,
             if (qemuDomainIOThreadValidate(iothreaddef, iothread, false) < 0)
                 goto endjob;

-            if (qemuDomainHotplugModIOThreadIDDef(iothreaddef, iothread) < 0) {
-                virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
-                               _("configuring persistent polling values is not supported"));
-                goto endjob;
-            }
-
+            qemuDomainHotplugModIOThreadIDDef(iothreaddef, iothread);
             break;
         }
     }
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 4f5a11aab1..1422e94e35 100644
--- a/tests/qemuxml2argvdata/iothreads-ids-pool-sizes.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/iothreads-ids-pool-sizes.x86_64-latest.args
@@ -18,9 +18,9 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
 -overcommit mem-lock=off \
 -smp 6,sockets=6,cores=1,threads=1 \
 -object '{"qom-type":"iothread","id":"iothread2","thread-pool-min":0,"thread-pool-max":60}' \
--object '{"qom-type":"iothread","id":"iothread4","thread-pool-min":1,"thread-pool-max":1}' \
--object '{"qom-type":"iothread","id":"iothread1"}' \
--object '{"qom-type":"iothread","id":"iothread3"}' \
+-object '{"qom-type":"iothread","id":"iothread4","thread-pool-min":1,"thread-pool-max":1,"poll-max-ns":123}' \
+-object '{"qom-type":"iothread","id":"iothread1","poll-grow":456,"poll-shrink":789}' \
+-object '{"qom-type":"iothread","id":"iothread3","poll-max-ns":123000,"poll-grow":456,"poll-shrink":789}' \
 -object '{"qom-type":"iothread","id":"iothread5"}' \
 -object '{"qom-type":"main-loop","id":"main-loop","thread-pool-min":8,"thread-pool-max":16}' \
 -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
-- 
2.39.2




[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]

  Powered by Linux