[PATCH 01/11] qemu: Check for and return IOThread polling values if available

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

 



If there are IOThread polling values in the query-iothreads return
buffer, then fill them in and set a bool indicating their presence.
This will allow for displaying in a domain stats output eventually.

Note that the QEMU values are managed a bit differently (as int's
stored in int64_t's) than we will manage them (as unsigned long and
int values). This is intentional to allow for value validation
checking when it comes time to provide the values to QEMU.

Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
---
 src/qemu/qemu_monitor.h      |  4 ++++
 src/qemu/qemu_monitor_json.c | 15 +++++++++++++++
 2 files changed, 19 insertions(+)

diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index 48b142a4f4..c2991e2b16 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -1116,6 +1116,10 @@ typedef qemuMonitorIOThreadInfo *qemuMonitorIOThreadInfoPtr;
 struct _qemuMonitorIOThreadInfo {
     unsigned int iothread_id;
     int thread_id;
+    bool poll_valid;
+    unsigned long long poll_max_ns;
+    unsigned int poll_grow;
+    unsigned int poll_shrink;
 };
 int qemuMonitorGetIOThreads(qemuMonitorPtr mon,
                             qemuMonitorIOThreadInfoPtr **iothreads);
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 3de298c9e2..2e92984b44 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -7441,6 +7441,21 @@ qemuMonitorJSONGetIOThreads(qemuMonitorPtr mon,
                              "'thread-id' data"));
             goto cleanup;
         }
+
+        /* Fetch poll values (since QEMU 2.9 ) if available. QEMU
+         * stores these values as int64_t's; however, the qapi type
+         * is an int. The qapi/misc.json also mis-describes the grow
+         * and shrink values as pure add/remove values. The source
+         * util/aio-posix.c function aio_poll uses them as a factor
+         * or divisor in it's calculation. We will fetch and store
+         * them as defined in our structures. */
+        if (virJSONValueObjectGetNumberUlong(child, "poll-max-ns",
+                                             &info->poll_max_ns) == 0 &&
+            virJSONValueObjectGetNumberUint(child, "poll-grow",
+                                            &info->poll_grow) == 0 &&
+            virJSONValueObjectGetNumberUint(child, "poll-shrink",
+                                            &info->poll_shrink) == 0)
+            info->poll_valid = true;
     }
 
     ret = n;
-- 
2.17.1

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

  Powered by Linux