From nobody Sun Feb 8 18:43:11 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.24 as permitted sender) client-ip=209.132.183.24; envelope-from=libvir-list-bounces@redhat.com; helo=mx3-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.24 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx3-phx2.redhat.com (mx3-phx2.redhat.com [209.132.183.24]) by mx.zohomail.com with SMTPS id 1487679621402673.5508675125633; Tue, 21 Feb 2017 04:20:21 -0800 (PST) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx3-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v1LCGHhc006182; Tue, 21 Feb 2017 07:16:17 -0500 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v1LCFHns022603 for ; Tue, 21 Feb 2017 07:15:17 -0500 Received: from antique-work.brq.redhat.com (dhcp129-175.brq.redhat.com [10.34.129.175]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1LCF9hL031008 for ; Tue, 21 Feb 2017 07:15:16 -0500 From: Pavel Hrdina To: libvir-list@redhat.com Date: Tue, 21 Feb 2017 13:15:04 +0100 Message-Id: <6d4a02e683b53aebf069eaf45d7e6e73fe4f31de.1487678590.git.phrdina@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 08/12] qemu_monitor: extend qemuMonitorGetIOThreads to fetch polling data X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Pavel Hrdina --- src/qemu/qemu_driver.c | 6 +++--- src/qemu/qemu_monitor.c | 6 ++++-- src/qemu/qemu_monitor.h | 6 +++++- src/qemu/qemu_monitor_json.c | 19 ++++++++++++++++++- src/qemu/qemu_monitor_json.h | 3 ++- src/qemu/qemu_process.c | 2 +- tests/qemumonitorjsontest.c | 2 +- 7 files changed, 34 insertions(+), 10 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index da9f10e65e..ff610a7692 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -5284,7 +5284,7 @@ qemuDomainGetIOThreadsLive(virQEMUDriverPtr driver, } =20 qemuDomainObjEnterMonitor(driver, vm); - niothreads =3D qemuMonitorGetIOThreads(priv->mon, &iothreads); + niothreads =3D qemuMonitorGetIOThreads(priv->mon, &iothreads, false); if (qemuDomainObjExitMonitor(driver, vm) < 0) goto endjob; if (niothreads < 0) @@ -5599,7 +5599,7 @@ qemuDomainHotplugAddIOThread(virQEMUDriverPtr driver, * and add the thread_id to the vm->def->iothreadids list. */ if ((new_niothreads =3D qemuMonitorGetIOThreads(priv->mon, - &new_iothreads)) < 0) + &new_iothreads, false)) = < 0) goto exit_monitor; =20 if (qemuDomainObjExitMonitor(driver, vm) < 0) @@ -5681,7 +5681,7 @@ qemuDomainHotplugDelIOThread(virQEMUDriverPtr driver, goto exit_monitor; =20 if ((new_niothreads =3D qemuMonitorGetIOThreads(priv->mon, - &new_iothreads)) < 0) + &new_iothreads, false)) = < 0) goto exit_monitor; =20 if (qemuDomainObjExitMonitor(driver, vm) < 0) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index b15207a693..7633e6fc07 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -4025,6 +4025,7 @@ qemuMonitorRTCResetReinjection(qemuMonitorPtr mon) * qemuMonitorGetIOThreads: * @mon: Pointer to the monitor * @iothreads: Location to return array of IOThreadInfo data + * @supportPolling: Whether require polling data in QEMU reply * * Issue query-iothreads command. * Retrieve the list of iothreads defined/running for the machine @@ -4034,7 +4035,8 @@ qemuMonitorRTCResetReinjection(qemuMonitorPtr mon) */ int qemuMonitorGetIOThreads(qemuMonitorPtr mon, - qemuMonitorIOThreadInfoPtr **iothreads) + qemuMonitorIOThreadInfoPtr **iothreads, + bool supportPolling) { =20 VIR_DEBUG("iothreads=3D%p", iothreads); @@ -4047,7 +4049,7 @@ qemuMonitorGetIOThreads(qemuMonitorPtr mon, return 0; } =20 - return qemuMonitorJSONGetIOThreads(mon, iothreads); + return qemuMonitorJSONGetIOThreads(mon, iothreads, supportPolling); } =20 =20 diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 8811d85017..eeae18e5b0 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -1005,9 +1005,13 @@ typedef qemuMonitorIOThreadInfo *qemuMonitorIOThread= InfoPtr; struct _qemuMonitorIOThreadInfo { unsigned int iothread_id; int thread_id; + int poll_max_ns; + int poll_grow; + int poll_shrink; }; int qemuMonitorGetIOThreads(qemuMonitorPtr mon, - qemuMonitorIOThreadInfoPtr **iothreads); + qemuMonitorIOThreadInfoPtr **iothreads, + bool supportPolling); =20 typedef struct _qemuMonitorMemoryDeviceInfo qemuMonitorMemoryDeviceInfo; typedef qemuMonitorMemoryDeviceInfo *qemuMonitorMemoryDeviceInfoPtr; diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 1d281af48e..ab73f7aaf6 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -6738,7 +6738,8 @@ qemuMonitorJSONRTCResetReinjection(qemuMonitorPtr mon) */ int qemuMonitorJSONGetIOThreads(qemuMonitorPtr mon, - qemuMonitorIOThreadInfoPtr **iothreads) + qemuMonitorIOThreadInfoPtr **iothreads, + bool supportPolling) { int ret =3D -1; virJSONValuePtr cmd; @@ -6804,6 +6805,22 @@ qemuMonitorJSONGetIOThreads(qemuMonitorPtr mon, "'thread-id' data")); goto cleanup; } + +#define VIR_IOTHREAD_GET_POLL_DATA(prop, store) = \ + if (supportPolling && = \ + virJSONValueObjectGetNumberInt(child, prop, &store) < 0) { = \ + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", = \ + _("query-iothreads reply has malformed " = \ + "'" prop "' data")); = \ + goto cleanup; = \ + } + + VIR_IOTHREAD_GET_POLL_DATA("poll-max-ns", info->poll_max_ns) + VIR_IOTHREAD_GET_POLL_DATA("poll-grow", info->poll_grow) + VIR_IOTHREAD_GET_POLL_DATA("poll-shrink", info->poll_shrink) + +#undef VIR_IOTHREAD_GET_DATA + } =20 ret =3D n; diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index 79688c82f7..0f557a2991 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -480,7 +480,8 @@ int qemuMonitorJSONGetGuestCPU(qemuMonitorPtr mon, int qemuMonitorJSONRTCResetReinjection(qemuMonitorPtr mon); =20 int qemuMonitorJSONGetIOThreads(qemuMonitorPtr mon, - qemuMonitorIOThreadInfoPtr **iothreads) + qemuMonitorIOThreadInfoPtr **iothreads, + bool supportPolling) ATTRIBUTE_NONNULL(2); =20 int qemuMonitorJSONGetMemoryDeviceInfo(qemuMonitorPtr mon, diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 522f49d8b7..9eb4dfd5fa 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -2104,7 +2104,7 @@ qemuProcessDetectIOThreadPIDs(virQEMUDriverPtr driver, /* Get the list of IOThreads from qemu */ if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) goto cleanup; - niothreads =3D qemuMonitorGetIOThreads(priv->mon, &iothreads); + niothreads =3D qemuMonitorGetIOThreads(priv->mon, &iothreads, false); if (qemuDomainObjExitMonitor(driver, vm) < 0) goto cleanup; if (niothreads < 0) diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index 5b2d6bb343..c9c1f2cada 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -2488,7 +2488,7 @@ testQemuMonitorJSONGetIOThreads(const void *data) goto cleanup; =20 if ((ninfo =3D qemuMonitorGetIOThreads(qemuMonitorTestGetMonitor(test), - &info)) < 0) + &info, false)) < 0) goto cleanup; =20 if (ninfo !=3D 2) { --=20 2.11.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list