From nobody Sat Feb 7 20:39:32 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1770044934; cv=none; d=zohomail.com; s=zohoarc; b=ORuW2mCMSmjD3aDMtaVSqMDxUTt4YLw24S0VF9qoZ/hXekYD3SVQunje8af2Mzyry4QNk/BWNsg7YwuchMSq0hlCBpSwxpte8HP2P3B4pRN3hpuoYLr/qG+9KtasA935AwmaTqt6PVQ0eydEVOzcVp21k607n4cdZnDSzfunTLQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770044934; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id:Cc; bh=76/wHdpCe0Xawi/xm6Cpv7UcGbliuIwFtWEjNUh06jg=; b=oGbAz4L9d5Gmb5pzRfEc3QOhox1GxX8Q2tfQgA7vZ79TqGd0lwFXON9Cbqzn7Dnbt/LzdkDmhK0LQGA2zG/iY/Wcl73hdR+piTfl4PxMxs05rXiWJHHw2bpWRYJcTEesU4ABV1KclhYSBa2/qeHAj7XBaaqkZkgJlFRAtOMg7WM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1770044934802113.33191956688847; Mon, 2 Feb 2026 07:08:54 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id 94A5C43E5E; Mon, 2 Feb 2026 10:08:53 -0500 (EST) Received: from [172.19.199.6] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 39EC643F18; Mon, 2 Feb 2026 10:07:01 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id 25C8D41B21; Mon, 2 Feb 2026 10:06:53 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 89F3041B52 for ; Mon, 2 Feb 2026 10:06:52 -0500 (EST) Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-671-iQJ5unhpNcuo9XaxuGUJFw-1; Mon, 02 Feb 2026 10:06:50 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 0C47D180035C for ; Mon, 2 Feb 2026 15:06:50 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.3]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 54EA018002A6 for ; Mon, 2 Feb 2026 15:06:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1770044812; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=76/wHdpCe0Xawi/xm6Cpv7UcGbliuIwFtWEjNUh06jg=; b=ii/H+86at+bXqFrtfabzw/tez2WCNgBLL1O//pDKGjCvqjgQPzp5NjqFfFeL1+Cv296nBk X1lXg4iM1meD75NGTY9ApNSDAi5t8uzR/ER/gEBI/dvlHG5N/3WDMUqq5DlHCKGq/J8qzh kDIK+h+9DtVLuKd0ymX+iSuUAszmltc= X-MC-Unique: iQJ5unhpNcuo9XaxuGUJFw-1 X-Mimecast-MFC-AGG-ID: iQJ5unhpNcuo9XaxuGUJFw_1770044810 To: devel@lists.libvirt.org Subject: [PATCH 1/9] qemu: Extract disk setup done via QMP into a separate helper Date: Mon, 2 Feb 2026 16:06:38 +0100 Message-ID: <99fa853e4cfffee168a9a8f81b8a2b50f87be8f3.1770044532.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: JE5Ah3cFxeK3G-CouurysrBTCBCjyeziC19Wj0WkOp0_1770044810 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: J2KTSA7EWJXGOHAN6RIRUOYELP5UN6BP X-Message-ID-Hash: J2KTSA7EWJXGOHAN6RIRUOYELP5UN6BP X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Peter Krempa via Devel Reply-To: Peter Krempa X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1770044938483158500 Content-Type: text/plain; charset="utf-8" From: Peter Krempa Introduce 'qemuProcessSetupDiskPropsRuntime' helper function which will collect all code used for runtime setup of a disk. This is currently old-style throttling. Signed-off-by: Peter Krempa --- src/qemu/qemu_hotplug.c | 23 +++++------------------ src/qemu/qemu_process.c | 37 +++++++++++++++++++++++++++---------- src/qemu/qemu_process.h | 3 +++ 3 files changed, 35 insertions(+), 28 deletions(-) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index f786248e70..ffd7795b66 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -567,13 +567,8 @@ qemuDomainChangeMediaBlockdev(virDomainObj *vm, } /* set throttling for the new image */ - if (rc =3D=3D 0 && - !virStorageSourceIsEmpty(newsrc) && - qemuDiskConfigBlkdeviotuneEnabled(disk)) { - rc =3D qemuMonitorSetBlockIoThrottle(priv->mon, - diskPriv->qomName, - &disk->blkdeviotune); - } + if (rc =3D=3D 0) + rc =3D qemuProcessSetupDiskPropsRuntime(priv->mon, disk); if (rc =3D=3D 0) rc =3D qemuMonitorBlockdevTrayClose(priv->mon, diskPriv->qomName); @@ -793,21 +788,13 @@ qemuDomainAttachDiskGeneric(virDomainObj *vm, if (rc =3D=3D 0) rc =3D qemuMonitorAddDeviceProps(priv->mon, &devprops); - /* Setup throttling of disk via block_set_io_throttle QMP command. This - * is a hack until the 'throttle' blockdev driver will support modific= ation - * of the trhottle group. See also qemuProcessSetupDiskThrottlingBlock= dev. - * As there isn't anything sane to do if this fails, let's just return - * success. - */ if (rc =3D=3D 0) { qemuDomainDiskPrivate *diskPriv =3D QEMU_DOMAIN_DISK_PRIVATE(disk); g_autoptr(GHashTable) blockinfo =3D NULL; - if (qemuDiskConfigBlkdeviotuneEnabled(disk)) { - if (qemuMonitorSetBlockIoThrottle(priv->mon, diskPriv->qomName, - &disk->blkdeviotune) < 0) - VIR_WARN("failed to set blkdeviotune for '%s' of '%s'", di= sk->dst, vm->def->name); - } + /* There isn't anything sane to do if this fails (rollback would + * require hot-unplug), let's just return success. */ + ignore_value(qemuProcessSetupDiskPropsRuntime(priv->mon, disk)); if ((blockinfo =3D qemuMonitorGetBlockInfo(priv->mon))) { struct qemuDomainDiskInfo *diskinfo; diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index c5b2a5fda8..8708c2d66b 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -7936,6 +7936,32 @@ qemuProcessGenID(virDomainObj *vm, } +/** + * qemuProcessSetupDiskPropsRuntime: + * @mon: qemu monitor object + * @disk: disk definition + * + * This function expects that caller already entered 'monitor' context. + * + * Sets up disk properties which are only possible to be set in runtime. + */ +int +qemuProcessSetupDiskPropsRuntime(qemuMonitor *mon, + virDomainDiskDef *disk) +{ + if (virStorageSourceIsEmpty(disk->src)) + return 0; + + if (qemuDiskConfigBlkdeviotuneEnabled(disk) && + qemuMonitorSetBlockIoThrottle(mon, + QEMU_DOMAIN_DISK_PRIVATE(disk)->qomN= ame, + &disk->blkdeviotune) < 0) + return -1; + + return 0; +} + + /** * qemuProcessSetupDiskThrottling: * @@ -7959,16 +7985,7 @@ qemuProcessSetupDiskThrottling(virDomainObj *vm, for (i =3D 0; i < vm->def->ndisks; i++) { virDomainDiskDef *disk =3D vm->def->disks[i]; - /* Setting throttling for empty drives fails */ - if (virStorageSourceIsEmpty(disk->src)) - continue; - - if (!qemuDiskConfigBlkdeviotuneEnabled(disk)) - continue; - - if (qemuMonitorSetBlockIoThrottle(qemuDomainGetMonitor(vm), - QEMU_DOMAIN_DISK_PRIVATE(disk)->= qomName, - &disk->blkdeviotune) < 0) + if (qemuProcessSetupDiskPropsRuntime(qemuDomainGetMonitor(vm), dis= k) < 0) goto cleanup; } diff --git a/src/qemu/qemu_process.h b/src/qemu/qemu_process.h index 426e11d79e..df78b00abb 100644 --- a/src/qemu/qemu_process.h +++ b/src/qemu/qemu_process.h @@ -146,6 +146,9 @@ int qemuProcessPrepareHostStorageSourceChain(virDomainO= bj *vm, int qemuProcessPrepareHostStorageDisk(virDomainObj *vm, virDomainDiskDef *disk); +int qemuProcessSetupDiskPropsRuntime(qemuMonitor *mon, + virDomainDiskDef *disk); + int qemuProcessDeleteThreadContext(virDomainObj *vm); int qemuProcessLaunch(virConnectPtr conn, --=20 2.52.0 From nobody Sat Feb 7 20:39:32 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1770044983; cv=none; d=zohomail.com; s=zohoarc; b=lKZj8P6Qqq2EBLKi5IxAMuQJ3O1AeucYz2DdzO8POCwrxYhsEgD//nxxQY2CDgSF3Fpx7aPC/A1tJAjh6DyMhA+9OF39nc+2tQfdo4iBXs6CZbn81incH/rpaoSVzpEL0s3GisAHBBiR9qWEXsIo/UVFwp0CHvyUQ3VNpfWfeOk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770044983; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id:Cc; bh=x44lq5bmj9Hc9A6ifDmN5r5/wNN7Gcz0NPG5hTmMVaQ=; b=TakHDQdrzwQbmDf0icvpAhJaFjrDPVfzZrI2okg2anC+TRZUWYM89KnCF0RH5kKhWiTeP+aNDShwLqfpaYBj5EyI9IKIjX6D6/8f606LC6BCNYlzQvWiO1rsdA4Oy2iEyr/607eS9yYHnUfY54yL4K2B+aKn01ENiLDceyjB/14= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1770044983434191.93318921557875; Mon, 2 Feb 2026 07:09:43 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id 55AA043F20; Mon, 2 Feb 2026 10:09:43 -0500 (EST) Received: from [172.19.199.6] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 1384743F62; Mon, 2 Feb 2026 10:07:03 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id 502C841B21; Mon, 2 Feb 2026 10:06:54 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id C500B41B43 for ; Mon, 2 Feb 2026 10:06:53 -0500 (EST) Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-78-8zB3p0mQPuuaK6llEQoYgA-1; Mon, 02 Feb 2026 10:06:51 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 2FA4C18003FD for ; Mon, 2 Feb 2026 15:06:51 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.3]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 7471818002A6 for ; Mon, 2 Feb 2026 15:06:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1770044813; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=x44lq5bmj9Hc9A6ifDmN5r5/wNN7Gcz0NPG5hTmMVaQ=; b=EtSKN6EZoneMwcC8FWf4w/ZhavCIfVTpOOTdrTgWTh+zQiDAKcYzCFQJb02G/vHvydEZA9 oaXxIi4ksvszqlnw+vYSRDtgAIbh5kCjxX5270VnBfCmox1cjxQM9Ly2d15Qrxn+QX/8y1 CkNX4mwKQ6UwSHUzBGEwNuhJXLDCgUY= X-MC-Unique: 8zB3p0mQPuuaK6llEQoYgA-1 X-Mimecast-MFC-AGG-ID: 8zB3p0mQPuuaK6llEQoYgA_1770044811 To: devel@lists.libvirt.org Subject: [PATCH 2/9] qemu: process: Rename 'qemuProcessSetupDiskThrottling' to 'qemuProcessSetupDisks' Date: Mon, 2 Feb 2026 16:06:39 +0100 Message-ID: <47b577d41cf5db34fa0ecdde87491d08e9dc01df.1770044532.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: MXtfJ3Emvx1M9PAa7wEypnPyzz1If_EWvkUuHw8bqRo_1770044811 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: N76HMNPBE2H5JFRFLASA4CANDR4A6WIS X-Message-ID-Hash: N76HMNPBE2H5JFRFLASA4CANDR4A6WIS X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Peter Krempa via Devel Reply-To: Peter Krempa X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1770044985408158500 Content-Type: text/plain; charset="utf-8" From: Peter Krempa Rename the runtime disk option setup function to be universal. Signed-off-by: Peter Krempa --- src/qemu/qemu_process.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 8708c2d66b..411c5b3b88 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -7963,21 +7963,19 @@ qemuProcessSetupDiskPropsRuntime(qemuMonitor *mon, /** - * qemuProcessSetupDiskThrottling: + * qemuProcessSetupDisks: * - * Sets up disk trottling for -blockdev via block_set_io_throttle monitor - * command. This hack should be replaced by proper use of the 'throttle' - * blockdev driver in qemu once it will support changing of the throttle g= roup. - * Same hack is done in qemuDomainAttachDiskGeneric. + * Sets up disk settings available only at runtime: + * - trottling for -blockdev via block_set_io_throttle QMP command */ static int -qemuProcessSetupDiskThrottling(virDomainObj *vm, - virDomainAsyncJob asyncJob) +qemuProcessSetupDisks(virDomainObj *vm, + virDomainAsyncJob asyncJob) { size_t i; int ret =3D -1; - VIR_DEBUG("Setting up disk throttling for -blockdev via block_set_io_t= hrottle"); + VIR_DEBUG("Setting up disk config via runtime commands"); if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) return -1; @@ -8574,7 +8572,7 @@ qemuProcessLaunch(virConnectPtr conn, if (qemuProcessSetupBalloon(vm, asyncJob) < 0) goto cleanup; - if (qemuProcessSetupDiskThrottling(vm, asyncJob) < 0) + if (qemuProcessSetupDisks(vm, asyncJob) < 0) goto cleanup; /* Since CPUs were not started yet, the balloon could not return the m= emory --=20 2.52.0 From nobody Sat Feb 7 20:39:32 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1770045041; cv=none; d=zohomail.com; s=zohoarc; b=ajmxWsKF+5c7wLQV4GQ4XTknDBXglb8tMhXjGh8WroXbt7NH5fJIofwQ5KjT8V0FUSGJbaCNPZdHL4aHsEUr3RNJM20GmbCx5H/3FLPib+ZSHKeobRhmSQyVahaQd4HMm/NKr5KGSrJIPcEFDrhKjARxLBlyHXL+B1xOg6gixY4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770045041; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id:Cc; bh=Up6d8wExd8zp1D6uKeT/8XM0/potH4aqMgu48rXKv20=; b=Im3uEepNrL9UDA7biBaIhRKuSHrMO2Zd+8ejz7n3GpiA3oIC+hh54NhR/9lOGn4oWtHFLuASVw22iz8dQ4xlOM+qsXWEn/GzPEasMndnRkGrOLcWaQ2r6B1t8taH6Ic0FbSs1NVraGJ2ne7E15anxYd7S2bPO0k4TMcxMgNOa2w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1770045041283561.0242414135419; Mon, 2 Feb 2026 07:10:41 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id 52B1F43EA0; Mon, 2 Feb 2026 10:10:40 -0500 (EST) Received: from [172.19.199.6] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id D2F2F43FC0; Mon, 2 Feb 2026 10:07:04 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id 7EDD241B72; Mon, 2 Feb 2026 10:06:55 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id D770041B43 for ; Mon, 2 Feb 2026 10:06:54 -0500 (EST) Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-693-KlcK9mepO4CjpP1FzLJ1vQ-1; Mon, 02 Feb 2026 10:06:53 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 5557C1954B0B for ; Mon, 2 Feb 2026 15:06:52 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.3]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 9EA3F18002A6 for ; Mon, 2 Feb 2026 15:06:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1770044814; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Up6d8wExd8zp1D6uKeT/8XM0/potH4aqMgu48rXKv20=; b=jJaXi/3GGOIHU5nyWqAffbSbhNv6+3Ww4Lbh0mH5yVQg2CsCwpshUk3sLvX7OMHrPyG3pt /oKoSoTV8gPkUdxeUuaSUO2eza5NhdAiMHosvUcoUpbGVkp1imlXLPDcbiqsLhuGD2y20b KSWUk41IoMXnxOcAH4+Yld+/yjHdV5A= X-MC-Unique: KlcK9mepO4CjpP1FzLJ1vQ-1 X-Mimecast-MFC-AGG-ID: KlcK9mepO4CjpP1FzLJ1vQ_1770044812 To: devel@lists.libvirt.org Subject: [PATCH 3/9] qemu: monitor: Extract block latency histogram stats into 'qemuBlockStats' Date: Mon, 2 Feb 2026 16:06:40 +0100 Message-ID: <2ea1490f0dee6a305df6decafcb48e847513b49e.1770044532.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: _KbIAn5Q5UpRDQL-mMCS9zwNLU1bSC-iaXXuQF9Vdgs_1770044812 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: 7H5VTJGMFEUM2JHZEKXDEAWEB2JY2FLW X-Message-ID-Hash: 7H5VTJGMFEUM2JHZEKXDEAWEB2JY2FLW X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Peter Krempa via Devel Reply-To: Peter Krempa X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1770045045143154100 Content-Type: text/plain; charset="utf-8" From: Peter Krempa Extract the 'rd_latency_histogram', 'wr_latency_histogram', 'zone_append_latency_histogram', and 'flush_latency_histogram' stats objects into our internal data. Rather than storing 'boundaries' between bins we store them as start points. Signed-off-by: Peter Krempa --- src/qemu/qemu_monitor.c | 20 +++++++++++++ src/qemu/qemu_monitor.h | 18 ++++++++++++ src/qemu/qemu_monitor_json.c | 55 ++++++++++++++++++++++++++++++++++++ 3 files changed, 93 insertions(+) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 504500c864..cdd08004fb 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -1986,6 +1986,26 @@ qemuBlockStatsFinalize(GObject *object) g_free(stats->limits); g_free(stats->timed_stats); + if (stats->histogram_read) { + g_free(stats->histogram_read->bins); + g_free(stats->histogram_read); + } + + if (stats->histogram_write) { + g_free(stats->histogram_write->bins); + g_free(stats->histogram_write); + } + + if (stats->histogram_zone) { + g_free(stats->histogram_zone->bins); + g_free(stats->histogram_zone); + } + + if (stats->histogram_flush) { + g_free(stats->histogram_flush->bins); + g_free(stats->histogram_flush); + } + G_OBJECT_CLASS(qemu_block_stats_parent_class)->finalize(object); } diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index d096f474c1..fb4fe2bc76 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -806,6 +806,18 @@ struct qemuBlockStatsLimits { }; +struct qemuBlockStatsLatencyHistogramBin { + unsigned long long start; + unsigned long long value; +}; + + +struct qemuBlockStatsLatencyHistogram { + struct qemuBlockStatsLatencyHistogramBin *bins; + size_t nbins; +}; + + struct qemuBlockStatsTimed { unsigned long long interval_length; @@ -858,6 +870,12 @@ struct _qemuBlockStats { /* block accounting/timed stats from qemu - one entry per interval con= figured */ size_t n_timed_stats; struct qemuBlockStatsTimed *timed_stats; + + /* latency histograms */ + struct qemuBlockStatsLatencyHistogram *histogram_read; + struct qemuBlockStatsLatencyHistogram *histogram_write; + struct qemuBlockStatsLatencyHistogram *histogram_zone; + struct qemuBlockStatsLatencyHistogram *histogram_flush; }; G_DECLARE_FINAL_TYPE(qemuBlockStats, qemu_block_stats, QEMU, BLOCK_STATS, = GObject); diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index a602b1e65b..5736546ec2 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -2425,6 +2425,52 @@ qemuMonitorJSONBlockStatsCollectDataTimed(virJSONVal= ue *timed_stats, } +static void +qemuMonitorJSONBlockStatsCollectDataLatencyHistogram(virJSONValue *stats, + const char *histogram= _field, + struct qemuBlockStats= LatencyHistogram **histogram_data) +{ + virJSONValue *hist; + virJSONValue *hist_bins; + virJSONValue *hist_bounds; + g_autofree struct qemuBlockStatsLatencyHistogramBin *bins =3D NULL; + size_t nbins =3D 0; + size_t i; + + if (!(hist =3D virJSONValueObjectGetObject(stats, histogram_field))) + return; + + if (!(hist_bins =3D virJSONValueObjectGetArray(hist, "bins")) || + !(hist_bounds =3D virJSONValueObjectGetArray(hist, "boundaries")) = || + virJSONValueArraySize(hist_bins) !=3D (virJSONValueArraySize(hist_= bounds) + 1)) { + VIR_DEBUG("malformed latency histogram container"); + return; + } + + nbins =3D virJSONValueArraySize(hist_bins); + bins =3D g_new0(struct qemuBlockStatsLatencyHistogramBin, nbins); + + for (i =3D 0; i < nbins; i++) { + virJSONValue *bin =3D virJSONValueArrayGet(hist_bins, i); + virJSONValue *bound =3D NULL; + + if (i > 0) + bound =3D virJSONValueArrayGet(hist_bounds, i - 1); + + if (!bin || + virJSONValueGetNumberUlong(bin, &(bins[i].value)) < 0 || + (bound && virJSONValueGetNumberUlong(bound, &(bins[i].start)) = < 0)) { + VIR_DEBUG("malformed latency histogram container"); + return; + } + } + + *histogram_data =3D g_new0(struct qemuBlockStatsLatencyHistogram, 1); + (*histogram_data)->bins =3D g_steal_pointer(&bins); + (*histogram_data)->nbins =3D nbins; +} + + static qemuBlockStats * qemuMonitorJSONBlockStatsCollectData(virJSONValue *dev, int *nstats) @@ -2469,6 +2515,15 @@ qemuMonitorJSONBlockStatsCollectData(virJSONValue *d= ev, bstats->wr_highest_offset_valid =3D true; } + qemuMonitorJSONBlockStatsCollectDataLatencyHistogram(stats, "rd_latenc= y_histogram", + &bstats->histogra= m_read); + qemuMonitorJSONBlockStatsCollectDataLatencyHistogram(stats, "wr_latenc= y_histogram", + &bstats->histogra= m_write); + qemuMonitorJSONBlockStatsCollectDataLatencyHistogram(stats, "zone_appe= nd_latency_histogram", + &bstats->histogra= m_zone); + qemuMonitorJSONBlockStatsCollectDataLatencyHistogram(stats, "flush_lat= ency_histogram", + &bstats->histogra= m_flush); + if ((timed_stats =3D virJSONValueObjectGetArray(stats, "timed_stats"))= && virJSONValueArraySize(timed_stats) > 0) qemuMonitorJSONBlockStatsCollectDataTimed(timed_stats, bstats); --=20 2.52.0 From nobody Sat Feb 7 20:39:32 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1770045148; cv=none; d=zohomail.com; s=zohoarc; b=IzsngXirQ4YAe5bUMZD2PJrIoZMyL0PYuQJO5ZjGh5VXF2X2aI+uLYwsyz2DnzhXrhuu40WaF7CIM5Au3E+oAM5lPPWurTBwgCj4ZOT0aZWvN7Mrt3u4iUNd21X5/xK40pUVok350/qW4Aa/zQmkgGj2dbht1/7Lig720gZF1q4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770045148; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id:Cc; bh=Ytk8lPag9xgR3tZ3E4DGpPU73kiM6MeFw0yIXe1abZY=; b=HhVpzBzkMSq9QnCfbxovPqnR+sn0/7oUBBZq1Hv7i/Ea17j4PjEVFuIw1MARatRJRECtTHqkchmwH8tEF/U+YuLuPGJ3DGY+PUV1Ja5vjVXKaVG581BSalUing2sG3WY4tbLgFshZmLCi2F+cWpK7QtIgFq0gXAPWuAhIVYP6hw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1770045148335732.4170127713762; Mon, 2 Feb 2026 07:12:28 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id B58E443DBC; Mon, 2 Feb 2026 10:12:27 -0500 (EST) Received: from [172.19.199.6] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 7216443E13; Mon, 2 Feb 2026 10:07:25 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id 2DA0043E7A; Mon, 2 Feb 2026 10:07:19 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id C804243E3F for ; Mon, 2 Feb 2026 10:06:57 -0500 (EST) Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-111-9KzORM-AO0CzDddA_AnNoQ-1; Mon, 02 Feb 2026 10:06:54 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 746C8195609D for ; Mon, 2 Feb 2026 15:06:53 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.3]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id BF07C18002A6 for ; Mon, 2 Feb 2026 15:06:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1770044817; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ytk8lPag9xgR3tZ3E4DGpPU73kiM6MeFw0yIXe1abZY=; b=fv6XBiHnqDSNdut5wZcjK+X2JhUdOjsr0IIZyGP+hFHCvMOoG/SjMnjKJV6QhSIRTzopBQ E1i18EBaNocbljLjg2Lv5nNRaQ265Zgvm4TJtF+Hf8CJ8jNvkoJkYCVl1WekWCDWjYnf3X c3zxx3pGJPvC9Q2i9QcrHDVYtg1qtko= X-MC-Unique: 9KzORM-AO0CzDddA_AnNoQ-1 X-Mimecast-MFC-AGG-ID: 9KzORM-AO0CzDddA_AnNoQ_1770044813 To: devel@lists.libvirt.org Subject: [PATCH 4/9] Expose latency histograms via 'virConnectGetAllDomainStats' Date: Mon, 2 Feb 2026 16:06:41 +0100 Message-ID: <51895450b434a08565fce95dfacdd03508cb53b5.1770044532.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: Q3whpHL3HyJsq3lriLqWzDUa6I2VCaZkspyG6nTWq9M_1770044813 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: FWQLWJPWL5ATVXBSMANDJP4HQECNAS2U X-Message-ID-Hash: FWQLWJPWL5ATVXBSMANDJP4HQECNAS2U X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Peter Krempa via Devel Reply-To: Peter Krempa X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1770045150759154100 Content-Type: text/plain; charset="utf-8" From: Peter Krempa Add documentation and constants for constructing the stats field names for latency histograms and expose them in the qemu driver: Example: block.1.latency_histogram.read.bin.count=3D9 block.1.latency_histogram.read.bin.0.start=3D0 block.1.latency_histogram.read.bin.0.value=3D0 block.1.latency_histogram.read.bin.1.start=3D10 block.1.latency_histogram.read.bin.1.value=3D0 block.1.latency_histogram.read.bin.2.start=3D100 block.1.latency_histogram.read.bin.2.value=3D0 block.1.latency_histogram.read.bin.3.start=3D1000 block.1.latency_histogram.read.bin.3.value=3D1047 block.1.latency_histogram.read.bin.4.start=3D10000 block.1.latency_histogram.read.bin.4.value=3D2131 block.1.latency_histogram.read.bin.5.start=3D100000 block.1.latency_histogram.read.bin.5.value=3D0 block.1.latency_histogram.read.bin.6.start=3D1000000 block.1.latency_histogram.read.bin.6.value=3D0 block.1.latency_histogram.read.bin.7.start=3D10000000 block.1.latency_histogram.read.bin.7.value=3D0 block.1.latency_histogram.read.bin.8.start=3D100000000 block.1.latency_histogram.read.bin.8.value=3D0 Signed-off-by: Peter Krempa --- docs/manpages/virsh.rst | 7 ++ include/libvirt/libvirt-domain.h | 113 +++++++++++++++++++++++++++++++ src/qemu/qemu_driver.c | 43 ++++++++++++ 3 files changed, 163 insertions(+) diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst index a9d691824e..ff0cf1a715 100644 --- a/docs/manpages/virsh.rst +++ b/docs/manpages/virsh.rst @@ -2811,6 +2811,13 @@ Information listed includes: pending write operations in the defined interval * ``block..timed_group..zone_append_queue_depth_avg`` - average = number of pending zone append operations in the defined interval +* ``block..latency_histogram..bin.count`` - number of bins in + latency histogram. is one of ``read``, ``write``, ``zone_append``= , or + ``flush`` +* ``block..latency_histogram..bin..start`` start boundary = of + a latency histogram bin in nanoseconds of given operation duration +* ``block..latency_histogram..bin..value`` current number = of + events corresponding to the given bin and type *--iothread* returns information about IOThreads on the running guest diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-dom= ain.h index 893359aaae..56c21dcf25 100644 --- a/include/libvirt/libvirt-domain.h +++ b/include/libvirt/libvirt-domain.h @@ -3896,6 +3896,119 @@ struct _virDomainStatsRecord { */ # define VIR_DOMAIN_STATS_BLOCK_SUFFIX_TIMED_GROUP_SUFFIX_ZONE_APPEND_QUEU= E_DEPTH_AVG ".zone_append_queue_depth_avg" +/** + * VIR_DOMAIN_STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_READ_PREFIX: + * + * The parameter name prefix to access 'read' latency histograms. Concaten= ate + * the prefix with either: + * - VIR_DOMAIN_STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_SUFFIX_BIN_COUNT + * to get the number of bins in given histogram + * - VIR_DOMAIN_STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_SUFFIX_BIN_PREFIX and + * entry number formatted as an unsigned integer and one of the latency + * histogram suffix parameters to compelte a full bin parameter name + * + * Since: 12.1.0 + */ +# define VIR_DOMAIN_STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_READ_PREFIX ".lat= ency_histogram.read." + +/** + * VIR_DOMAIN_STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_WRITE_PREFIX: + * + * The parameter name prefix to access 'write' latency histograms. Concate= nate + * the prefix with either: + * - VIR_DOMAIN_STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_SUFFIX_BIN_COUNT + * to get the number of bins in given histogram + * - VIR_DOMAIN_STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_SUFFIX_BIN_PREFIX and + * entry number formatted as an unsigned integer and one of the latency + * histogram suffix parameters to compelte a full bin parameter name + * + * Since: 12.1.0 + */ +# define VIR_DOMAIN_STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_WRITE_PREFIX ".la= tency_histogram.write." + +/** + * VIR_DOMAIN_STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_ZONE_APPEND_PREFIX: + * + * The parameter name prefix to access 'zone_append' latency histograms. C= oncatenate + * the prefix with either: + * - VIR_DOMAIN_STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_SUFFIX_BIN_COUNT + * to get the number of bins in given histogram + * - VIR_DOMAIN_STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_SUFFIX_BIN_PREFIX and + * entry number formatted as an unsigned integer and one of the latency + * histogram suffix parameters to compelte a full bin parameter name + * + * Since: 12.1.0 + */ +# define VIR_DOMAIN_STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_ZONE_APPEND_PREFI= X ".latency_histogram.zone_append." + +/** + * VIR_DOMAIN_STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_FLUSH_PREFIX: + * + * The parameter name prefix to access 'flush' latency histograms. Concate= nate + * the prefix with either: + * - VIR_DOMAIN_STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_SUFFIX_BIN_COUNT + * to get the number of bins in given histogram + * - VIR_DOMAIN_STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_SUFFIX_BIN_PREFIX and + * entry number formatted as an unsigned integer and one of the latency + * histogram suffix parameters to compelte a full bin parameter name + * + * Since: 12.1.0 + */ +# define VIR_DOMAIN_STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_FLUSH_PREFIX ".la= tency_histogram.flush." + +/** + * VIR_DOMAIN_STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_SUFFIX_BIN_COUNT: + * + * The parameter name suffix to access number of bins in one of the follow= ing + * latency histogram types: + * - VIR_DOMAIN_STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_READ_PREFIX + * - VIR_DOMAIN_STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_WRITE_PREFIX + * - VIR_DOMAIN_STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_ZONE_APPEND_PREFIX + * - VIR_DOMAIN_STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_FLUSH_PREFIX + * + * Number of bins in latency histogram as unsigned long long. + * + * Since: 12.1.0 + */ +# define VIR_DOMAIN_STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_SUFFIX_BIN_COUNT = "bin.count" + +/** + * VIR_DOMAIN_STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_SUFFIX_BIN_PREFIX: + * + * The parameter name suffix to access a latency histogram bin in one of t= he + * following latency histogram types: + * - VIR_DOMAIN_STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_READ_PREFIX + * - VIR_DOMAIN_STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_WRITE_PREFIX + * - VIR_DOMAIN_STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_ZONE_APPEND_PREFIX + * - VIR_DOMAIN_STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_FLUSH_PREFIX + * + * Concatenate with a bin number as unsigned int and one of the other field + * suffixes to access bin parameters. + * + * Since: 12.1.0 + */ +# define VIR_DOMAIN_STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_SUFFIX_BIN_PREFIX= "bin." + +/** + * VIR_DOMAIN_STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_SUFFIX_BIN_SUFFIX_START: + * + * Start of the current latency histogram bin in nanoseconds as unsigned l= ong long. + * + * Since: 12.1.0 + */ +# define VIR_DOMAIN_STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_SUFFIX_BIN_SUFFIX= _START ".start" + +/** + * VIR_DOMAIN_STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_SUFFIX_BIN_SUFFIX_VALUE: + * + * Current value of the number of occurences of the latency within this bin + * as unsigned long long. + * + * Since: 12.1.0 + */ +# define VIR_DOMAIN_STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_SUFFIX_BIN_SUFFIX= _VALUE ".value" + + /** * VIR_DOMAIN_STATS_PERF_CMT: * diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index cdd333c882..d8cc32eee8 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -17606,6 +17606,36 @@ qemuDomainGetStatsBlockExportBackendStorage(const = char *entryname, } +static void +qemuDomainGetStatsBlockExportFrontendLatencyHistogram(struct qemuBlockStat= sLatencyHistogram *h, + size_t disk_idx, + const char *prefix_h= ist, + virTypedParamList *p= ar) +{ + size_t i; + + if (!h) + return; + + virTypedParamListAddULLong(par, h->nbins, + VIR_DOMAIN_STATS_BLOCK_PREFIX "%zu%s" VIR_D= OMAIN_STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_SUFFIX_BIN_COUNT, + disk_idx, prefix_hist); + + for (i =3D 0; i < h->nbins; i++) { + virTypedParamListAddULLong(par, h->bins[i].start, + VIR_DOMAIN_STATS_BLOCK_PREFIX "%zu%s" + VIR_DOMAIN_STATS_BLOCK_SUFFIX_LATENCY_H= ISTOGRAM_SUFFIX_BIN_PREFIX "%zu" + VIR_DOMAIN_STATS_BLOCK_SUFFIX_LATENCY_H= ISTOGRAM_SUFFIX_BIN_SUFFIX_START, + disk_idx, prefix_hist, i); + virTypedParamListAddULLong(par, h->bins[i].value, + VIR_DOMAIN_STATS_BLOCK_PREFIX "%zu%s" + VIR_DOMAIN_STATS_BLOCK_SUFFIX_LATENCY_H= ISTOGRAM_SUFFIX_BIN_PREFIX "%zu" + VIR_DOMAIN_STATS_BLOCK_SUFFIX_LATENCY_H= ISTOGRAM_SUFFIX_BIN_SUFFIX_VALUE, + disk_idx, prefix_hist, i); + } +} + + static void qemuDomainGetStatsBlockExportFrontend(const char *frontendname, GHashTable *stats, @@ -17730,6 +17760,19 @@ qemuDomainGetStatsBlockExportFrontend(const char *= frontendname, idx, i); } } + + qemuDomainGetStatsBlockExportFrontendLatencyHistogram(en->histogram_re= ad, idx, + VIR_DOMAIN_STATS= _BLOCK_SUFFIX_LATENCY_HISTOGRAM_READ_PREFIX, + par); + qemuDomainGetStatsBlockExportFrontendLatencyHistogram(en->histogram_wr= ite, idx, + VIR_DOMAIN_STATS= _BLOCK_SUFFIX_LATENCY_HISTOGRAM_WRITE_PREFIX, + par); + qemuDomainGetStatsBlockExportFrontendLatencyHistogram(en->histogram_zo= ne, idx, + VIR_DOMAIN_STATS= _BLOCK_SUFFIX_LATENCY_HISTOGRAM_ZONE_APPEND_PREFIX, + par); + qemuDomainGetStatsBlockExportFrontendLatencyHistogram(en->histogram_fl= ush, idx, + VIR_DOMAIN_STATS= _BLOCK_SUFFIX_LATENCY_HISTOGRAM_FLUSH_PREFIX, + par); } --=20 2.52.0 From nobody Sat Feb 7 20:39:32 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1770045092; cv=none; d=zohomail.com; s=zohoarc; b=dH6vw8rNQrKMURvMhCaM+VAsMVreS4LJHQVD/8VaSTmB268vRhpH5JlJFMlWVQr3PvPmjI5zU975r4+3MdyZYNJgyjLQRkYvHIe6kkiAUhEyaWdjatPopR9v7CUyDRqlp0ttTid+5S4TMe1ujOQbwZHRtGEkTP+yoRYr4kUqlX0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770045092; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id:Cc; bh=/2leTciyJyNnT7pqB3q1KOetTRY8phS9Msa2BF7bwnY=; b=QWIO2cd5JrBsNc0YcAuBVUhCMHKQv/IwGQYAXztaNhosRRW8NQWYiwbNqLZJWw43SPbm9yZLsSIHJLdlPQM+Bka7Y/VT1F9oba78R1VilcFJJrgQv94iODuZ7UR2zGqONqZ+lLpAEyNHxuggqUCP0zVa0evc5R+hAGqS01znbaM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1770045092961365.5982574031498; Mon, 2 Feb 2026 07:11:32 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id 1A14743E5E; Mon, 2 Feb 2026 10:11:32 -0500 (EST) Received: from [172.19.199.6] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 0C79F44011; Mon, 2 Feb 2026 10:07:21 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id D3EDF43E5D; Mon, 2 Feb 2026 10:07:15 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 5194A43DF3 for ; Mon, 2 Feb 2026 10:06:57 -0500 (EST) Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-175-mEPW0wm7MsuAw0Lu597Fyw-1; Mon, 02 Feb 2026 10:06:55 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 92F08195606C for ; Mon, 2 Feb 2026 15:06:54 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.3]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id DD1B718002A6 for ; Mon, 2 Feb 2026 15:06:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1770044816; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/2leTciyJyNnT7pqB3q1KOetTRY8phS9Msa2BF7bwnY=; b=DZRpAnKJkiT2/fxLAwquA/T5nZEuUR1O2J/ftRUomm6I89ShkfNX6lFaGB2d5dw/ok9S7n iTe+8ik2pmXXowyL4l7JzX8mQ2zgVXbLo8MPyCosLxiPa8ZiWybSH7LCDH7UC9nQuQaEJp iyXOLYvWY8hKrjm9bxXb5/Gm4kcNZFs= X-MC-Unique: mEPW0wm7MsuAw0Lu597Fyw-1 X-Mimecast-MFC-AGG-ID: mEPW0wm7MsuAw0Lu597Fyw_1770044814 To: devel@lists.libvirt.org Subject: [PATCH 5/9] qemu: monitor: Add handlers for 'block-latency-histogram-set' Date: Mon, 2 Feb 2026 16:06:42 +0100 Message-ID: <78fea48ee9a71e93aa0c49a7493cfb318517b974.1770044532.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: Z0yz17AHVBucEc_IeqmayfJ6r6K3fagZuRQHFG6E-OA_1770044814 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: W33PSUVAKCVOMCV7JN3QJPENK4LUCC5L X-Message-ID-Hash: W33PSUVAKCVOMCV7JN3QJPENK4LUCC5L X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Peter Krempa via Devel Reply-To: Peter Krempa X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1770045095850154100 Content-Type: text/plain; charset="utf-8" From: Peter Krempa Add QMP monitor code for setting up latency histogram configuration. Signed-off-by: Peter Krempa --- src/qemu/qemu_monitor.c | 21 +++++++++++++ src/qemu/qemu_monitor.h | 9 ++++++ src/qemu/qemu_monitor_json.c | 60 ++++++++++++++++++++++++++++++++++++ src/qemu/qemu_monitor_json.h | 9 ++++++ tests/qemumonitorjsontest.c | 9 ++++++ 5 files changed, 108 insertions(+) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index cdd08004fb..3d7477c01c 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -4612,3 +4612,24 @@ qemuMonitorBlockdevSetActive(qemuMonitor *mon, return qemuMonitorJSONBlockdevSetActive(mon, nodename, active); } + + +int +qemuMonitorBlockLatencyHistogramSet(qemuMonitor *mon, + const char *id, + unsigned int *boundaries, + unsigned int *boundaries_read, + unsigned int *boundaries_write, + unsigned int *boundaries_zone, + unsigned int *boundaries_flush) +{ + QEMU_CHECK_MONITOR(mon); + VIR_DEBUG("id=3D'%s'", id); + + return qemuMonitorJSONBlockLatencyHistogramSet(mon, id, + boundaries, + boundaries_read, + boundaries_write, + boundaries_zone, + boundaries_flush); +} diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index fb4fe2bc76..128b0fa2ce 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -1984,3 +1984,12 @@ int qemuMonitorBlockdevSetActive(qemuMonitor *mon, const char *nodename, bool active); + +int +qemuMonitorBlockLatencyHistogramSet(qemuMonitor *mon, + const char *id, + unsigned int *boundaries, + unsigned int *boundaries_read, + unsigned int *boundaries_write, + unsigned int *boundaries_zone, + unsigned int *boundaries_flush); diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 5736546ec2..8c930ca1bb 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -9113,3 +9113,63 @@ qemuMonitorJSONBlockdevSetActive(qemuMonitor *mon, return qemuMonitorJSONCheckError(cmd, reply); } + + +static virJSONValue * +qemuMonitorJSONBlockLatencyHistogramBoundary(unsigned int *bound) +{ + g_autoptr(virJSONValue) ret =3D virJSONValueNewArray(); + + if (!bound) + return NULL; + + for (; *bound > 0; bound++) { + g_autoptr(virJSONValue) val =3D virJSONValueNewNumberUint(*bound); + + /* the only error is if the first argument is not an array */ + ignore_value(virJSONValueArrayAppend(ret, &val)); + } + + return g_steal_pointer(&ret); +} + + +int +qemuMonitorJSONBlockLatencyHistogramSet(qemuMonitor *mon, + const char *id, + unsigned int *boundaries, + unsigned int *boundaries_read, + unsigned int *boundaries_write, + unsigned int *boundaries_zone, + unsigned int *boundaries_flush) +{ + g_autoptr(virJSONValue) cmd =3D NULL; + g_autoptr(virJSONValue) reply =3D NULL; + + g_autoptr(virJSONValue) bound =3D NULL; + g_autoptr(virJSONValue) bound_read =3D NULL; + g_autoptr(virJSONValue) bound_write =3D NULL; + g_autoptr(virJSONValue) bound_zone =3D NULL; + g_autoptr(virJSONValue) bound_flush =3D NULL; + + bound =3D qemuMonitorJSONBlockLatencyHistogramBoundary(boundaries); + bound_read =3D qemuMonitorJSONBlockLatencyHistogramBoundary(boundaries= _read); + bound_write =3D qemuMonitorJSONBlockLatencyHistogramBoundary(boundarie= s_write); + bound_zone =3D qemuMonitorJSONBlockLatencyHistogramBoundary(boundaries= _zone); + bound_flush =3D qemuMonitorJSONBlockLatencyHistogramBoundary(boundarie= s_flush); + + if (!(cmd =3D qemuMonitorJSONMakeCommand("block-latency-histogram-set", + "s:id", id, + "A:boundaries", &bound, + "A:boundaries-read", &bound_rea= d, + "A:boundaries-write", &bound_wr= ite, + "A:boundaries-zap", &bound_zone, + "A:boundaries-flush", &bound_fl= ush, + NULL))) + return -1; + + if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0) + return -1; + + return qemuMonitorJSONCheckError(cmd, reply); +} diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index db9160eb68..b418f70048 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -815,3 +815,12 @@ int qemuMonitorJSONBlockdevSetActive(qemuMonitor *mon, const char *nodename, bool active); + +int +qemuMonitorJSONBlockLatencyHistogramSet(qemuMonitor *mon, + const char *id, + unsigned int *boundaries, + unsigned int *boundaries_read, + unsigned int *boundaries_write, + unsigned int *boundaries_zone, + unsigned int *boundaries_flush); diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index bfe81739a7..1c1aaaa586 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -1130,6 +1130,14 @@ GEN_TEST_FUNC(qemuMonitorJSONSetAction, GEN_TEST_FUNC(qemuMonitorJSONSetLaunchSecurityState, "sev_secret_header", "sev_secret", 0, true) +unsigned int testHistogramBoundaries[] =3D {10, 30, 50, 0}; +GEN_TEST_FUNC(qemuMonitorJSONBlockLatencyHistogramSet, "devid", + testHistogramBoundaries, + testHistogramBoundaries, + testHistogramBoundaries, + testHistogramBoundaries, + testHistogramBoundaries) + static int testQemuMonitorJSONqemuMonitorJSONNBDServerStart(const void *opaque) { @@ -2958,6 +2966,7 @@ mymain(void) DO_TEST_GEN(qemuMonitorJSONBlockJobCancel); DO_TEST_GEN(qemuMonitorJSONSetAction); DO_TEST_GEN(qemuMonitorJSONSetLaunchSecurityState); + DO_TEST_GEN(qemuMonitorJSONBlockLatencyHistogramSet); DO_TEST(qemuMonitorJSONGetBalloonInfo); DO_TEST(qemuMonitorJSONGetBlockInfo); DO_TEST(qemuMonitorJSONGetAllBlockStatsInfo); --=20 2.52.0 From nobody Sat Feb 7 20:39:32 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1770045220; cv=none; d=zohomail.com; s=zohoarc; b=kyC6Lf0vtgDzpj3+6WdMK0CEh75Wu/ZxG7JRnj6GgaY+aUU/h8ZTwmH27y+pcrpyZqilqtCSCGDH3Lc1/7kXoEuRqaNTIh60vljsxX1UKW+x1ocZ7WYRmHlPxHbfTZNeWHBrXd/mXO4l2lcFFORF7JwAGPGa2GPH5PwuMUs8KlE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770045220; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id:Cc; bh=CtSG1JxIh5VUHoL1M3N+ikuwhCQOHEe+WN+/b/30F18=; b=FkBIxm9W25H6WpcxAk0tcoY8HACMDiKkFEoO0o5ffVw9ha8Kx+a+6c7qWMl3EInjuzwFE8R8tZyaJQAtjXMsWbimRvmernxlQ0u+fU1/LPJp5W1jCba3YbsfobTEAiZotpM+vPiMkx3iR+2Be1GtvfeHj2Qu8ccNJOvC99KOQFA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1770045220684699.2024332334076; Mon, 2 Feb 2026 07:13:40 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id BED8F43E6C; Mon, 2 Feb 2026 10:13:39 -0500 (EST) Received: from [172.19.199.6] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id BAE48440AA; Mon, 2 Feb 2026 10:07:29 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id 06D8D44039; Mon, 2 Feb 2026 10:07:25 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 2881443E43 for ; Mon, 2 Feb 2026 10:06:58 -0500 (EST) Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-662-PDMscZ4uOgCwzEgtLv-yGQ-1; Mon, 02 Feb 2026 10:06:56 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id C186B1956080 for ; Mon, 2 Feb 2026 15:06:55 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.3]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 12AA51801766 for ; Mon, 2 Feb 2026 15:06:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1770044817; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CtSG1JxIh5VUHoL1M3N+ikuwhCQOHEe+WN+/b/30F18=; b=dVvroOEiNXxk4OdJEwgncrai0k6bf7gKP474lL9btq4tZbsc7HOc8Qfmtwb/dhmYQVfDZ9 BI+xW79/opeCuCz1iL1PM83uwax8+zrCe2yy/5c4w32H1/JaHqtjVMuVe2RBdAerme9gvl 1wP/3g+3ugZMN6DOSXRphm7t7cGo1iU= X-MC-Unique: PDMscZ4uOgCwzEgtLv-yGQ-1 X-Mimecast-MFC-AGG-ID: PDMscZ4uOgCwzEgtLv-yGQ_1770044815 To: devel@lists.libvirt.org Subject: [PATCH 6/9] docs: formatdomain: Fix indentation of docs for element Date: Mon, 2 Feb 2026 16:06:43 +0100 Message-ID: <97ea0053239352c50b7156c5e5213d2bf94f7ed4.1770044532.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: qpm--fB7zeJfS5YtmlhPpBU1cMi2TOaRk2T9G2JOXaE_1770044815 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: 6ON4A3FW6L7AOM24UPINDCYXVYQY4B6R X-Message-ID-Hash: 6ON4A3FW6L7AOM24UPINDCYXVYQY4B6R X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Peter Krempa via Devel Reply-To: Peter Krempa X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1770045221441158500 Content-Type: text/plain; charset="utf-8" From: Peter Krempa All other paragraphs in this section use 2 spaces after hyphen, fix the recently added section. Signed-off-by: Peter Krempa --- docs/formatdomain.rst | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst index 0fa9d2e08b..b5a8f7b714 100644 --- a/docs/formatdomain.rst +++ b/docs/formatdomain.rst @@ -3619,22 +3619,22 @@ paravirtualized driver is specified via the ``disk`= ` element. - - The optional ``statistics`` sub-element allows configuring statistics - collection in configurable intervals for the given disk. Intervals are - configured by ```` sub-elements with ``interval`` attribute - configuring the collection window duration in seconds. The statistics - are available via the bulk statistics API. - - Example:: - - - - - - - + - The optional ``statistics`` sub-element allows configuring statistics + collection in configurable intervals for the given disk. Intervals a= re + configured by ```` sub-elements with ``interval`` attribu= te + configuring the collection window duration in seconds. The statistics + are available via the bulk statistics API. + + Example:: + + + + + + + - :since:`Since 11.9.0 (QEMU 10.2, virtio, ide, scsi disks only)`. + :since:`Since 11.9.0 (QEMU 10.2, virtio, ide, scsi disks only)`. - The optional ``queues`` attribute specifies the number of virt queue= s for virtio-blk ( :since:`Since 3.9.0` ) or vhost-user-blk --=20 2.52.0 From nobody Sat Feb 7 20:39:32 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1770045259; cv=none; d=zohomail.com; s=zohoarc; b=k6RRgkEP+dHHCH+mKO3tYAIRyrENC3FoJzQSYNWDvB02fMbj7/EkfuQUBRFP96dF5YYrsEG3l/je28w1ZJW5HAz17YhcYGk8257uiVMGTFrvSYabBnnwzaqShHOtX47iGM0psmPMmZD0/D/ny1Kyx1wiKbeWlmyRwg5A02w+1O0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770045259; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id:Cc; bh=SfkY8+OK5CHbz6QeDgRAz0qXr4+CO5lphZd1eKa4Ugs=; b=EC3BmE1PgdYZ0+9c+SfJDi145ca+POw5Y2NcWQR/jdIeeLwR80ONtxlt25uiBr5x+gAFDENeisZZIH71ZVvGQLoU9TqZqI/5CAHr+GmSYi32b1xPKJV/Mitme9tS2tPjus1n7naf3WthXiNGkEFLD/RMwl+U3z0tEELBW+BMWFE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1770045259861934.3788409449586; Mon, 2 Feb 2026 07:14:19 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id 54EC043FD4; Mon, 2 Feb 2026 10:14:19 -0500 (EST) Received: from [172.19.199.6] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id C5D6A44093; Mon, 2 Feb 2026 10:08:24 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id D437343EA9; Mon, 2 Feb 2026 10:08:19 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 59D1043ECA for ; Mon, 2 Feb 2026 10:07:00 -0500 (EST) Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-301-bhqfnMRcMJGAX6S7QZAG4A-1; Mon, 02 Feb 2026 10:06:58 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id EF42E19541A7 for ; Mon, 2 Feb 2026 15:06:56 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.3]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 3F3A918002A6 for ; Mon, 2 Feb 2026 15:06:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1770044820; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SfkY8+OK5CHbz6QeDgRAz0qXr4+CO5lphZd1eKa4Ugs=; b=AovRdlqczgW/8N6NF6KZ5Jqt1bp3LSOnPGoSiEoOLMz6v4AaxLmMkfC9+q4SyGCR2x1CaV tPV7Lv0xR7Q9/o2e/JuOyXRYLg2zrt56rROk9G5Qedj5stArxYnlZek6HqfC8IWnt40DvV oPRNF0eFRJ0ejWghLCqdXjTv9tJE1kU= X-MC-Unique: bhqfnMRcMJGAX6S7QZAG4A-1 X-Mimecast-MFC-AGG-ID: bhqfnMRcMJGAX6S7QZAG4A_1770044817 To: devel@lists.libvirt.org Subject: [PATCH 7/9] docs: formatdomain: Reword section about the '' element under disk driver Date: Mon, 2 Feb 2026 16:06:44 +0100 Message-ID: <64fb109f5a15e61c29bbbb25ce8d1c6f8aef73c8.1770044532.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: K6VJEDDqp7f7htZx9lAM2_vNKWDBE-U463w2yZAB98A_1770044817 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: M66YRO5ZOWFI44HHS3YDMDIRQ2A4RULF X-Message-ID-Hash: M66YRO5ZOWFI44HHS3YDMDIRQ2A4RULF X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Peter Krempa via Devel Reply-To: Peter Krempa X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1770045260641154100 Content-Type: text/plain; charset="utf-8" From: Peter Krempa Separate the timed statistics group and link to the fields which are returned by it. Prepare the wording for more statistics configs in the future. Signed-off-by: Peter Krempa --- docs/formatdomain.rst | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst index b5a8f7b714..3c7dbf97db 100644 --- a/docs/formatdomain.rst +++ b/docs/formatdomain.rst @@ -3619,11 +3619,17 @@ paravirtualized driver is specified via the ``disk`= ` element. - - The optional ``statistics`` sub-element allows configuring statistics - collection in configurable intervals for the given disk. Intervals a= re - configured by ```` sub-elements with ``interval`` attribu= te - configuring the collection window duration in seconds. The statistics - are available via the bulk statistics API. + - The optional ``statistics`` sub-element allows configuring various o= ptional + statistics collection. + + Statistic values returned under + `VIR_DOMAIN_STATS_BLOCK_SUFFIX_TIMED_GROUP_PREFIX `__ + typed parameter prefix returned by the + `virConnectGetAllDomainStats `__ + API are collected based on one or more configurable intervals. An in= terval + of collection is configured by ```` sub-elements with + ``interval`` attribute configuring the collection window duration in + seconds. Example:: --=20 2.52.0 From nobody Sat Feb 7 20:39:32 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1770045332; cv=none; d=zohomail.com; s=zohoarc; b=XlPPhoAok19yUJZ85dG6ES/joW/wB599BzfLHkN3YO6ZCoz17xXm2Fhh5D4B9q5qLWUnQEYv5nde08RI/eTeQfg4bW7ZzfS8GkwTpI/kYJ93IZgoLRq6htwh5a3C7INcgCSZx4l4zT+Ga/QbEOf+MNlU83PTp8vuCOogUvqt46U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770045332; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id:Cc; bh=QadH9ErMG0XLDFJzHm6CPA8COo1VCcireRX4tJR2yFI=; b=mkRVqmau7PCyGfQR9noV5hfffu4NRmK5xf94Rm9tonBMUFu7h0xvAHwLg6GX5fCAWx9rX7Ov/dWvtM2T6qO8ezWGQnAO5+q31sQBLoSeAAt5p29qeYTvJdRLtqtJLHeK7zYu40Drfzec3uPIolBIPjRjolG9vrXQAOXBJRHEGK0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1770045332701895.070799113225; Mon, 2 Feb 2026 07:15:32 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id CB7B243FC7; Mon, 2 Feb 2026 10:15:31 -0500 (EST) Received: from [172.19.199.6] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 9193C44108; Mon, 2 Feb 2026 10:08:35 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id 741A441B4F; Mon, 2 Feb 2026 10:08:29 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 8ED0843E61 for ; Mon, 2 Feb 2026 10:07:00 -0500 (EST) Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-389-wEIQ3j1dNtSXJn1eqCI4CQ-1; Mon, 02 Feb 2026 10:06:58 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 1AB7B19560B4 for ; Mon, 2 Feb 2026 15:06:58 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.3]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 647CE18002A6 for ; Mon, 2 Feb 2026 15:06:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1770044820; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QadH9ErMG0XLDFJzHm6CPA8COo1VCcireRX4tJR2yFI=; b=LoA3bBwdKW7hEgqQ7FGlVt1pyBktkL8v3gaNw3TQPnqQn9rU5dqbAW+KNJp5ds3zS8v0kS AwV8wg413k84lo+Y9FehVKBFXXXZhZd/oRUs4nKNoMxdUMJwLpYnSvhU8nBiEiaBwekrig jB6wzPjXd6CjL9CQUGgChAbP8P8L80o= X-MC-Unique: wEIQ3j1dNtSXJn1eqCI4CQ-1 X-Mimecast-MFC-AGG-ID: wEIQ3j1dNtSXJn1eqCI4CQ_1770044818 To: devel@lists.libvirt.org Subject: [PATCH 8/9] Introduce support for disk operation latency histogram collection Date: Mon, 2 Feb 2026 16:06:45 +0100 Message-ID: <00a0c9323f02d61e15463aa69122f56b1e78b561.1770044532.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: LKQbOIhavVJW2AxLo_koKmb8HNzRAM6oWi74g13pVKg_1770044818 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: FLJK2G7QHVLGSLRZRJTJMRDSKFYOFQ3Z X-Message-ID-Hash: FLJK2G7QHVLGSLRZRJTJMRDSKFYOFQ3Z X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Peter Krempa via Devel Reply-To: Peter Krempa X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1770045334160158500 Content-Type: text/plain; charset="utf-8" From: Peter Krempa Add config and docs allowing enabling latency histogram collection for block device operations. This patch sets up the docs, schema and XML infrastructure. Signed-off-by: Peter Krempa --- docs/formatdomain.rst | 41 ++++++ src/conf/domain_conf.c | 133 +++++++++++++++++- src/conf/domain_conf.h | 7 + src/conf/schemas/domaincommon.rng | 37 ++++- ...isk-statistics-intervals.x86_64-latest.xml | 29 ++++ .../disk-statistics-intervals.xml | 25 ++++ 6 files changed, 262 insertions(+), 10 deletions(-) diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst index 3c7dbf97db..799c648980 100644 --- a/docs/formatdomain.rst +++ b/docs/formatdomain.rst @@ -3642,6 +3642,47 @@ paravirtualized driver is specified via the ``disk``= element. :since:`Since 11.9.0 (QEMU 10.2, virtio, ide, scsi disks only)`. + Block operation latency histogram collection can be configured using + ```` sub-element. The histogram is collected for + the whole runtime of the VM, but can be re-started or reconfigured u= sing + the `virDomainUpdateDeviceFlags `__ + API. Using the same config re-starts histogram collection. + + The optional ``type`` attribute configures specific operation to col= lect + the histogram for. Supported types are ``read``, ``write``, ``zone``= , and + ``flush``. If the ``type`` attribute is omitted the histogram collec= tion + bins bins apply to all of the aforementioned types, which can be ove= rriden + with specific config. + + The ```` has multiple mandatory ```` sub-ele= ments + with mandatory ``start`` attribute configuring the starting boundary= of + the histogram bin configured in nanosecods of the operation duration= and + the intervals must be properly ordered and non-duplicate. + + Example:: + + + + + + + + + + + [or for specific operation types] + + + + + + + + + + + :since:`Since 12.1.0`. + - The optional ``queues`` attribute specifies the number of virt queue= s for virtio-blk ( :since:`Since 3.9.0` ) or vhost-user-blk ( :since:`Since 7.1.0` ) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 02e23f7866..1fc3ef966d 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -2446,6 +2446,11 @@ virDomainDiskDefFree(virDomainDiskDef *def) virObjectUnref(def->privateData); g_slist_free_full(def->iothreads, (GDestroyNotify) virDomainIothreadMa= ppingDefFree); g_free(def->statistics); + g_free(def->histogram_boundaries); + g_free(def->histogram_boundaries_read); + g_free(def->histogram_boundaries_write); + g_free(def->histogram_boundaries_zone); + g_free(def->histogram_boundaries_flush); if (def->throttlefilters) { size_t i; @@ -8311,6 +8316,91 @@ virDomainIothreadMappingDefParse(xmlNodePtr driverNo= de, } +static int +virDomainDiskDefDriverParseXMLHistogramOne(virDomainDiskDef *def, + xmlNodePtr cur) +{ + g_autofree char *histogram_type =3D NULL; + unsigned int **histogram_config =3D NULL; + g_autoptr(GPtrArray) binNodes =3D virXMLNodeGetSubelementList(cur, "bi= n"); + size_t nbins =3D 0; + size_t i; + + if ((histogram_type =3D virXMLPropString(cur, "type"))) { + if (STREQ(histogram_type, "read")) { + histogram_config =3D &def->histogram_boundaries_read; + } else if (STREQ(histogram_type, "write")) { + histogram_config =3D &def->histogram_boundaries_write; + } else if (STREQ(histogram_type, "zone")) { + histogram_config =3D &def->histogram_boundaries_zone; + } else if (STREQ(histogram_type, "flush")) { + histogram_config =3D &def->histogram_boundaries_flush; + } else { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unknown latency_histogram type '%1$s'"), + histogram_type); + return -1; + } + } else { + histogram_config =3D &def->histogram_boundaries; + } + + if (*histogram_config) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("only one latency-histogram of a given type is su= pported")); + return -1; + } + + if (binNodes->len =3D=3D 0) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("missing 'bin' elements for 'latency-histogram'")= ); + return -1; + } + + *histogram_config =3D g_new0(unsigned int, binNodes->len + 1); + + for (i =3D 0; i < binNodes->len; i++) { + unsigned int val; + + if (virXMLPropUInt(g_ptr_array_index(binNodes, i), + "start", 10, + VIR_XML_PROP_REQUIRED, + &val) < 0) + return -1; + + if (nbins > 0 && + (val =3D=3D 0 || + val <=3D (*histogram_config)[nbins-1])) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("the values of 'start' attribute of a 'latenc= y-histogram' 'bin' configuration must be sorted and non-overlapping")); + return -1; + } + + if (val > 0) + (*histogram_config)[nbins++] =3D val; + } + + return 0; +} + + +static int +virDomainDiskDefDriverParseXMLHistograms(virDomainDiskDef *def, + xmlNodePtr cur) +{ + g_autoptr(GPtrArray) histogramNodes =3D virXMLNodeGetSubelementList(cu= r, "latency-histogram"); + size_t i; + + for (i =3D 0; i < histogramNodes->len; i++) { + if (virDomainDiskDefDriverParseXMLHistogramOne(def, + g_ptr_array_index(h= istogramNodes, i)) < 0) + return -1; + } + + return 0; +} + + static int virDomainDiskDefDriverParseXML(virDomainDiskDef *def, xmlNodePtr cur) @@ -8384,6 +8474,9 @@ virDomainDiskDefDriverParseXML(virDomainDiskDef *def, return -1; } } + + if (virDomainDiskDefDriverParseXMLHistograms(def, statisticsNode) = < 0) + return -1; } if (virXMLPropEnum(cur, "detect_zeroes", @@ -23987,12 +24080,37 @@ virDomainDiskDefFormatThrottleFilters(virBuffer *= buf, } +static void +virDomainDiskDefFormatDriverHistogram(virBuffer *buf, + const char *type, + unsigned int *bins) +{ + g_auto(virBuffer) histogramAttrBuf =3D VIR_BUFFER_INITIALIZER; + g_auto(virBuffer) histogramChildBuf =3D VIR_BUFFER_INIT_CHILD(buf); + + if (!bins || bins[0] =3D=3D 0) + return; + + if (type) + virBufferAsprintf(&histogramAttrBuf, " type=3D'%s'", type); + + /* we dont store the start boundary of the first bin but it's always t= here */ + virBufferAddLit(&histogramChildBuf, "\n"); + + for (; *bins > 0; bins++) + virBufferAsprintf(&histogramChildBuf, "\n", *bi= ns); + + virXMLFormatElement(buf, "latency-histogram", &histogramAttrBuf, &hist= ogramChildBuf); +} + + static void virDomainDiskDefFormatDriver(virBuffer *buf, virDomainDiskDef *disk) { g_auto(virBuffer) attrBuf =3D VIR_BUFFER_INITIALIZER; g_auto(virBuffer) childBuf =3D VIR_BUFFER_INIT_CHILD(buf); + g_auto(virBuffer) statisticsChildBuf =3D VIR_BUFFER_INIT_CHILD(&childB= uf); virBufferEscapeString(&attrBuf, " name=3D'%s'", virDomainDiskGetDriver= (disk)); @@ -24064,16 +24182,25 @@ virDomainDiskDefFormatDriver(virBuffer *buf, virDomainIothreadMappingDefFormat(&childBuf, disk->iothreads); if (disk->statistics) { - g_auto(virBuffer) statisticsChildBuf =3D VIR_BUFFER_INIT_CHILD(&ch= ildBuf); size_t i; for (i =3D 0; disk->statistics[i] > 0; i++) virBufferAsprintf(&statisticsChildBuf, "\n", disk->statistics[i]); - - virXMLFormatElement(&childBuf, "statistics", NULL, &statisticsChil= dBuf); } + virDomainDiskDefFormatDriverHistogram(&statisticsChildBuf, NULL, + disk->histogram_boundaries); + virDomainDiskDefFormatDriverHistogram(&statisticsChildBuf, "read", + disk->histogram_boundaries_read); + virDomainDiskDefFormatDriverHistogram(&statisticsChildBuf, "write", + disk->histogram_boundaries_write= ); + virDomainDiskDefFormatDriverHistogram(&statisticsChildBuf, "zone", + disk->histogram_boundaries_zone); + virDomainDiskDefFormatDriverHistogram(&statisticsChildBuf, "flush", + disk->histogram_boundaries_flush= ); + + virXMLFormatElement(&childBuf, "statistics", NULL, &statisticsChildBuf= ); virXMLFormatElement(buf, "driver", &attrBuf, &childBuf); } diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 66dc4e3417..b59aca1d6d 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -596,6 +596,13 @@ struct _virDomainDiskDef { GSList *iothreads; /* List of virDomainIothreadMappingDef */ unsigned int *statistics; /* Optional, zero terminated list of interva= ls to collect statistics for */ + /* optional zero terminated lists of bin boundaries for latency histog= rams */ + unsigned int *histogram_boundaries; + unsigned int *histogram_boundaries_read; + unsigned int *histogram_boundaries_write; + unsigned int *histogram_boundaries_zone; + unsigned int *histogram_boundaries_flush; + virDomainDiskDetectZeroes detect_zeroes; virTristateSwitch discard_no_unref; char *domain_name; /* backend domain name */ diff --git a/src/conf/schemas/domaincommon.rng b/src/conf/schemas/domaincom= mon.rng index 8669d8f791..47b087a1d4 100644 --- a/src/conf/schemas/domaincommon.rng +++ b/src/conf/schemas/domaincommon.rng @@ -2741,13 +2741,36 @@ - - - - - - - + + + + + + + + + + + + + + read + write + zone + flush + + + + + + + + + + + + + diff --git a/tests/qemuxmlconfdata/disk-statistics-intervals.x86_64-latest.= xml b/tests/qemuxmlconfdata/disk-statistics-intervals.x86_64-latest.xml index 4c55c50ef5..d02f954073 100644 --- a/tests/qemuxmlconfdata/disk-statistics-intervals.x86_64-latest.xml +++ b/tests/qemuxmlconfdata/disk-statistics-intervals.x86_64-latest.xml @@ -22,6 +22,11 @@ + + + + + @@ -33,6 +38,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/qemuxmlconfdata/disk-statistics-intervals.xml b/tests/qe= muxmlconfdata/disk-statistics-intervals.xml index f5e801f5a8..5f9e9470d7 100644 --- a/tests/qemuxmlconfdata/disk-statistics-intervals.xml +++ b/tests/qemuxmlconfdata/disk-statistics-intervals.xml @@ -19,6 +19,11 @@ + + + + + @@ -29,6 +34,26 @@ + + + + + + + + + + + + + + + + + + + + --=20 2.52.0 From nobody Sat Feb 7 20:39:32 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1770045465; cv=none; d=zohomail.com; s=zohoarc; b=lg+tbllKPLqQ5aNk5VPZbe/HeS1Lms3adoVkgQG/900ceuPJOZ14q/bJUj8FxPxoXccA4xW0s07mvBARJzqClvTRvpFQThJDQ+Ab1/bbuilzdNceJLtUI/tGrYQ4Zx9NSqV3JX88FVmoKruAWhTJmxYvGlbmSGOzE+q+vsWVCV8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770045465; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id:Cc; bh=ytJgmYhHfqgelHegBx9wemEyJQKSpbJ/9yQwYyZ1l1U=; b=SAGtAc/cLYR5fBgIDQ6WYaYekAKxI70TSOhKgbkBtQoUN2z0qhBfObXkNm5lsT/WER09FZJ8TGx3jIBlnMiZbPW/NPDC9ixO/S1DI2XqvGgxumCxqcyfxTezU4TpgBJhln3p9ZZ5vFIkecFVtpPEj2yLG2gg/RxxRIFrUCpSqhw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 177004546596636.14706367800659; Mon, 2 Feb 2026 07:17:45 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id 7F14641B59; Mon, 2 Feb 2026 10:17:45 -0500 (EST) Received: from [172.19.199.6] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 8257943E59; Mon, 2 Feb 2026 10:09:55 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id 0D28743F2C; Mon, 2 Feb 2026 10:09:51 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 53DE643F6E for ; Mon, 2 Feb 2026 10:07:03 -0500 (EST) Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-668-p3l2NhRLOHirhSc3tssjHg-1; Mon, 02 Feb 2026 10:07:00 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 3B2841956095 for ; Mon, 2 Feb 2026 15:06:59 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.3]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 858331801760 for ; Mon, 2 Feb 2026 15:06:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1770044823; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ytJgmYhHfqgelHegBx9wemEyJQKSpbJ/9yQwYyZ1l1U=; b=cTQff4g5AXjBoAQKGuFr2/CLp9xK+jr6/io2XtWLr8wvOXmG//tRvE2WxNWyYbpBCBP3DM 2IfGMGm5uaHFrJQbB7yWxQw4HvvsMU8wsgn0AIUj1HSywSDOXWmrKYpvHeQceT9yXMED3V OfAkguG8LocieZ9L2jFcpTIgnkiDqjA= X-MC-Unique: p3l2NhRLOHirhSc3tssjHg-1 X-Mimecast-MFC-AGG-ID: p3l2NhRLOHirhSc3tssjHg_1770044819 To: devel@lists.libvirt.org Subject: [PATCH 9/9] qemu: Setup disk latency histograms on startup/hotplug/update Date: Mon, 2 Feb 2026 16:06:46 +0100 Message-ID: <0700b662fcc3b4dd04a9d053a427d3df2e614225.1770044532.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: q8feqBNyfsdVUd2cljivaupixDaGtWa2_kzfPE_zAKI_1770044819 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: 7MUKQGPFW2YJ4DEG23VR4DPGVIWFKHFB X-Message-ID-Hash: 7MUKQGPFW2YJ4DEG23VR4DPGVIWFKHFB X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Peter Krempa via Devel Reply-To: Peter Krempa X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1770045467753154100 Content-Type: text/plain; charset="utf-8" From: Peter Krempa Setup the histograms on startup and hotplug of devices via 'qemuProcessSetupDiskPropsRuntime' and facilitate update/reset/disable of histogram collection via 'qemuDomainChangeDiskLive'. The latter allows to use the update device API to either clear the bins or select new bin configuration or disable the histogram altogether without the need for a specific API. Signed-off-by: Peter Krempa --- src/qemu/qemu_domain.c | 17 +++++++++++++++++ src/qemu/qemu_domain.h | 3 +++ src/qemu/qemu_hotplug.c | 29 +++++++++++++++++++++++++++++ src/qemu/qemu_process.c | 10 ++++++++++ 4 files changed, 59 insertions(+) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 8e1ebe7799..bdab117e96 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -10463,6 +10463,23 @@ qemuDomainInitializePflashStorageSource(virDomainO= bj *vm, } +/** + * qemuDomainDiskHasLatencyHistogram: + * @disk: disk definition + * + * Returns whether @disk has any latency histogram settings configured. + */ +bool +qemuDomainDiskHasLatencyHistogram(virDomainDiskDef *disk) +{ + return disk->histogram_boundaries || + disk->histogram_boundaries_read || + disk->histogram_boundaries_write || + disk->histogram_boundaries_zone || + disk->histogram_boundaries_flush; +} + + /** * qemuDomainDiskBlockJobIsSupported: * diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index 3361e97315..30ca67bf76 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -1078,6 +1078,9 @@ int qemuDomainInitializePflashStorageSource(virDomainObj *vm, virQEMUDriverConfig *cfg); +bool +qemuDomainDiskHasLatencyHistogram(virDomainDiskDef *disk); + bool qemuDomainDiskBlockJobIsSupported(virDomainDiskDef *disk); diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index ffd7795b66..df61f17723 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -7327,6 +7327,35 @@ qemuDomainChangeDiskLive(virDomainObj *vm, dev->data.disk->src =3D NULL; } + if (qemuDomainDiskHasLatencyHistogram(disk) || + qemuDomainDiskHasLatencyHistogram(orig_disk)) { + int rc; + + qemuDomainObjEnterMonitor(vm); + rc =3D qemuMonitorBlockLatencyHistogramSet(qemuDomainGetMonitor(vm= ), + QEMU_DOMAIN_DISK_PRIVATE(= orig_disk)->qomName, + disk->histogram_boundarie= s, + disk->histogram_boundarie= s_read, + disk->histogram_boundarie= s_write, + disk->histogram_boundarie= s_zone, + disk->histogram_boundarie= s_flush); + qemuDomainObjExitMonitor(vm); + + if (rc < 0) + return -1; + + g_clear_pointer(&orig_disk->histogram_boundaries, g_free); + g_clear_pointer(&orig_disk->histogram_boundaries_read, g_free); + g_clear_pointer(&orig_disk->histogram_boundaries_write, g_free); + g_clear_pointer(&orig_disk->histogram_boundaries_zone, g_free); + g_clear_pointer(&orig_disk->histogram_boundaries_flush, g_free); + orig_disk->histogram_boundaries =3D g_steal_pointer(&disk->histogr= am_boundaries); + orig_disk->histogram_boundaries_read =3D g_steal_pointer(&disk->hi= stogram_boundaries_read); + orig_disk->histogram_boundaries_write =3D g_steal_pointer(&disk->h= istogram_boundaries_write); + orig_disk->histogram_boundaries_zone =3D g_steal_pointer(&disk->hi= stogram_boundaries_zone); + orig_disk->histogram_boundaries_flush =3D g_steal_pointer(&disk->h= istogram_boundaries_flush); + } + /* in case when we aren't updating disk source we update startup polic= y here */ orig_disk->startupPolicy =3D dev->data.disk->startupPolicy; orig_disk->snapshot =3D dev->data.disk->snapshot; diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 411c5b3b88..3d9db188fc 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -7958,6 +7958,16 @@ qemuProcessSetupDiskPropsRuntime(qemuMonitor *mon, &disk->blkdeviotune) < 0) return -1; + if (qemuDomainDiskHasLatencyHistogram(disk) && + qemuMonitorBlockLatencyHistogramSet(mon, + QEMU_DOMAIN_DISK_PRIVATE(disk)= ->qomName, + disk->histogram_boundaries, + disk->histogram_boundaries_rea= d, + disk->histogram_boundaries_wri= te, + disk->histogram_boundaries_zon= e, + disk->histogram_boundaries_flu= sh) < 0) + return -1; + return 0; } --=20 2.52.0