From nobody Mon Feb 9 06:48:50 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 164497040127128.935386019240582; Tue, 15 Feb 2022 16:13:21 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-484-TBPQY4kqMlOH5FH8ybPkaA-1; Tue, 15 Feb 2022 19:13:18 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7FC541006AA0; Wed, 16 Feb 2022 00:13:13 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3CCA8519D9; Wed, 16 Feb 2022 00:13:13 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id D8DCE4BB7C; Wed, 16 Feb 2022 00:13:12 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 21G0Cqho022510 for ; Tue, 15 Feb 2022 19:12:52 -0500 Received: by smtp.corp.redhat.com (Postfix) id 33CD241136EA; Wed, 16 Feb 2022 00:12:52 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2F4E641136E0 for ; Wed, 16 Feb 2022 00:12:52 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 18885800B24 for ; Wed, 16 Feb 2022 00:12:52 +0000 (UTC) Received: from chinatelecom.cn (prt-mail.chinatelecom.cn [42.123.76.222]) by relay.mimecast.com with ESMTP id us-mta-613-oYZC__BFN8a70AZz2QhUng-3; Tue, 15 Feb 2022 19:12:49 -0500 Received: from clientip-171.223.98.212 (unknown [172.18.0.218]) by chinatelecom.cn (HERMES) with SMTP id CB8FD280029; Wed, 16 Feb 2022 08:12:48 +0800 (CST) Received: from ([172.18.0.218]) by app0025 with ESMTP id ad648103ac1041a0a0e571d4d880b597 for libvir-list@redhat.com; Wed, 16 Feb 2022 08:12:48 CST X-MC-Unique: TBPQY4kqMlOH5FH8ybPkaA-1 X-MC-Unique: oYZC__BFN8a70AZz2QhUng-3 HMM_SOURCE_IP: 172.18.0.218:48928.781884105 HMM_ATTACHE_NUM: 0000 HMM_SOURCE_TYPE: SMTP X-189-SAVE-TO-SEND: +huangy81@chinatelecom.cn X-Transaction-ID: ad648103ac1041a0a0e571d4d880b597 X-Real-From: huangy81@chinatelecom.cn X-Receive-IP: 172.18.0.218 X-MEDUSA-Status: 0 From: huangy81@chinatelecom.cn To: libvir-list@redhat.com Subject: [PATCH v4 6/9] qemu_driver: Add mode parameter to qemuDomainStartDirtyRateCalc Date: Wed, 16 Feb 2022 08:12:18 +0800 Message-Id: In-Reply-To: References: In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Mimecast-Spam-Signature: yes X-Scanned-By: MIMEDefang 2.84 on 10.11.54.1 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 21G0Cqho022510 X-loop: libvir-list@redhat.com Cc: huangy81@chinatelecom.cn X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1644970402240100001 From: Hyman Huang(=E9=BB=84=E5=8B=87) Add mode parameter to qemuDomainStartDirtyRateCalc API, 'mode' option of 'calc-dirty-rate' command was introduced since qemu >=3D 6.2. Signed-off-by: Hyman Huang(=E9=BB=84=E5=8B=87) --- src/qemu/qemu_driver.c | 3 ++- src/qemu/qemu_monitor.c | 5 +++-- src/qemu/qemu_monitor.h | 17 ++++++++++++++++- src/qemu/qemu_monitor_json.c | 16 ++++++++++++++-- src/qemu/qemu_monitor_json.h | 3 ++- 5 files changed, 37 insertions(+), 7 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 18775e7..2f4415e 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -20671,6 +20671,7 @@ qemuDomainStartDirtyRateCalc(virDomainPtr dom, virQEMUDriver *driver =3D dom->conn->privateData; virDomainObj *vm =3D NULL; qemuDomainObjPrivate *priv; + qemuMonitorDirtyRateCalcMode mode =3D QEMU_MONITOR_DIRTYRATE_CALC_MODE= _PAGE_SAMPLING; int ret =3D -1; =20 virCheckFlags(0, -1); @@ -20710,7 +20711,7 @@ qemuDomainStartDirtyRateCalc(virDomainPtr dom, VIR_DEBUG("Calculate dirty rate in next %d seconds", seconds); =20 qemuDomainObjEnterMonitor(driver, vm); - ret =3D qemuMonitorStartDirtyRateCalc(priv->mon, seconds); + ret =3D qemuMonitorStartDirtyRateCalc(priv->mon, seconds, mode); =20 qemuDomainObjExitMonitor(driver, vm); =20 diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index dc81e41..0ff938a 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -4475,13 +4475,14 @@ qemuMonitorTransactionBackup(virJSONValue *actions, =20 int qemuMonitorStartDirtyRateCalc(qemuMonitor *mon, - int seconds) + int seconds, + qemuMonitorDirtyRateCalcMode mode) { VIR_DEBUG("seconds=3D%d", seconds); =20 QEMU_CHECK_MONITOR(mon); =20 - return qemuMonitorJSONStartDirtyRateCalc(mon, seconds); + return qemuMonitorJSONStartDirtyRateCalc(mon, seconds, mode); } =20 =20 diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 817391c..efdecba 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -1534,9 +1534,24 @@ qemuMonitorTransactionBackup(virJSONValue *actions, const char *bitmap, qemuMonitorTransactionBackupSyncMode syncmode= ); =20 +/** + * qemuMonitorDirtyRateCalcMode: + * + * Dirty page rate calculation mode used during measurement. + */ +typedef enum { + QEMU_MONITOR_DIRTYRATE_CALC_MODE_PAGE_SAMPLING =3D 0, + QEMU_MONITOR_DIRTYRATE_CALC_MODE_DIRTY_BITMAP, + QEMU_MONITOR_DIRTYRATE_CALC_MODE_DIRTY_RING, + QEMU_MONITOR_DIRTYRATE_CALC_MODE_LAST, +} qemuMonitorDirtyRateCalcMode; + +VIR_ENUM_DECL(qemuMonitorDirtyRateCalcMode); + int qemuMonitorStartDirtyRateCalc(qemuMonitor *mon, - int seconds); + int seconds, + qemuMonitorDirtyRateCalcMode mode); =20 /** * qemuMonitorDirtyRateStatus: diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index b09ef12..93288ab 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -8740,18 +8740,30 @@ qemuMonitorJSONGetCPUMigratable(qemuMonitor *mon, migratable); } =20 +VIR_ENUM_IMPL(qemuMonitorDirtyRateCalcMode, + QEMU_MONITOR_DIRTYRATE_CALC_MODE_LAST, + "page-sampling", + "dirty-bitmap", + "dirty-ring"); =20 int qemuMonitorJSONStartDirtyRateCalc(qemuMonitor *mon, - int seconds) + int seconds, + qemuMonitorDirtyRateCalcMode mode) { g_autoptr(virJSONValue) cmd =3D NULL; g_autoptr(virJSONValue) reply =3D NULL; + const char *modestr =3D NULL; + + if (mode !=3D QEMU_MONITOR_DIRTYRATE_CALC_MODE_PAGE_SAMPLING) + modestr =3D qemuMonitorDirtyRateCalcModeTypeToString(mode); =20 if (!(cmd =3D qemuMonitorJSONMakeCommand("calc-dirty-rate", "i:calc-time", seconds, - NULL))) + "S:mode", modestr, + NULL))) { return -1; + } =20 if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0) return -1; diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index eea3478..8e34f3b 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -853,7 +853,8 @@ qemuMonitorJSONGetCPUMigratable(qemuMonitor *mon, =20 int qemuMonitorJSONStartDirtyRateCalc(qemuMonitor *mon, - int seconds); + int seconds, + qemuMonitorDirtyRateCalcMode mode); =20 int qemuMonitorJSONQueryDirtyRate(qemuMonitor *mon, --=20 1.8.3.1