From nobody Mon Feb 9 13:59:03 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 1644970482698689.9899368021548; Tue, 15 Feb 2022 16:14:42 -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-418-mVOlWMxgMPiNGpYp2UQhig-1; Tue, 15 Feb 2022 19:14:39 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3861D83DD26; Wed, 16 Feb 2022 00:14:34 +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 17187105B207; Wed, 16 Feb 2022 00:14:34 +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 DC7144A700; Wed, 16 Feb 2022 00:14:33 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 21G0CxT8022558 for ; Tue, 15 Feb 2022 19:12:59 -0500 Received: by smtp.corp.redhat.com (Postfix) id 5CC9376C2; Wed, 16 Feb 2022 00:12:59 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 24B4B76F0 for ; Wed, 16 Feb 2022 00:12:55 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (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 A9A53811E78 for ; Wed, 16 Feb 2022 00:12:55 +0000 (UTC) Received: from chinatelecom.cn (prt-mail.chinatelecom.cn [42.123.76.222]) by relay.mimecast.com with ESMTP id us-mta-526-yBY9ELkwO-SzjjCeZqWthQ-1; Tue, 15 Feb 2022 19:12:53 -0500 Received: from clientip-171.223.98.212 (unknown [172.18.0.218]) by chinatelecom.cn (HERMES) with SMTP id EB015280029; Wed, 16 Feb 2022 08:12:49 +0800 (CST) Received: from ([172.18.0.218]) by app0025 with ESMTP id a7eed601d06147bab66d42d149a8d622 for libvir-list@redhat.com; Wed, 16 Feb 2022 08:12:51 CST X-MC-Unique: mVOlWMxgMPiNGpYp2UQhig-1 X-MC-Unique: yBY9ELkwO-SzjjCeZqWthQ-1 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: a7eed601d06147bab66d42d149a8d622 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 7/9] qemu_driver: Extend flags parameter of virDomainStartDirtyRateCalc Date: Wed, 16 Feb 2022 08:12:19 +0800 Message-Id: <70f17de2bab7eb4d222657f4103c1fbc8e8035b4.1644970010.git.huangy81@chinatelecom.cn> 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.79 on 10.11.54.5 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 21G0CxT8022558 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.84 on 10.5.11.22 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: 1644970484807100005 From: Hyman Huang(=E9=BB=84=E5=8B=87) Extend flags parameter of virDomainStartDirtyRateCalc as a superset of virDomainDirtyRateCalcFlags, parse the flags and handle it correspondingly in qemuDomainStartDirtyRateCalc. Signed-off-by: Hyman Huang(=E9=BB=84=E5=8B=87) --- src/qemu/qemu_driver.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 2f4415e..3ac5f01 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -20674,7 +20674,9 @@ qemuDomainStartDirtyRateCalc(virDomainPtr dom, qemuMonitorDirtyRateCalcMode mode =3D QEMU_MONITOR_DIRTYRATE_CALC_MODE= _PAGE_SAMPLING; int ret =3D -1; =20 - virCheckFlags(0, -1); + virCheckFlags(VIR_DOMAIN_DIRTYRATE_MODE_PAGE_SAMPLING | + VIR_DOMAIN_DIRTYRATE_MODE_DIRTY_BITMAP | + VIR_DOMAIN_DIRTYRATE_MODE_DIRTY_RING, -1); =20 if (seconds < MIN_DIRTYRATE_CALC_PERIOD || seconds > MAX_DIRTYRATE_CALC_PERIOD) { @@ -20699,6 +20701,25 @@ qemuDomainStartDirtyRateCalc(virDomainPtr dom, goto cleanup; } =20 + if (flags & VIR_DOMAIN_DIRTYRATE_MODE_DIRTY_BITMAP) { + mode =3D QEMU_MONITOR_DIRTYRATE_CALC_MODE_DIRTY_BITMAP; + } else if (flags & VIR_DOMAIN_DIRTYRATE_MODE_DIRTY_RING) { + if (vm->def->features[VIR_DOMAIN_FEATURE_KVM] !=3D VIR_TRISTATE_SW= ITCH_ON || + vm->def->kvm_features->features[VIR_DOMAIN_KVM_DIRTY_RING] != =3D VIR_TRISTATE_SWITCH_ON) { + virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", + _("dirty-ring calculation mode requires dirty-r= ing feature enabled.")); + goto cleanup; + } + mode =3D QEMU_MONITOR_DIRTYRATE_CALC_MODE_DIRTY_RING; + } + + if (mode !=3D QEMU_MONITOR_DIRTYRATE_CALC_MODE_PAGE_SAMPLING && + !virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DIRTYRATE_MODE)) { + virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", + _("QEMU does not support dirty page rate calculatio= n mode.")); + goto cleanup; + } + if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) goto cleanup; =20 --=20 1.8.3.1