From nobody Sat May 11 07:24:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1626364405599339.2639632953966; Thu, 15 Jul 2021 08:53:25 -0700 (PDT) Received: from localhost ([::1]:33724 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m43fu-0004gV-Mr for importer@patchew.org; Thu, 15 Jul 2021 11:53:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42888) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m43eg-0002ho-AY for qemu-devel@nongnu.org; Thu, 15 Jul 2021 11:52:06 -0400 Received: from prt-mail.chinatelecom.cn ([42.123.76.228]:35921 helo=chinatelecom.cn) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m43ed-0002YX-Vr for qemu-devel@nongnu.org; Thu, 15 Jul 2021 11:52:05 -0400 Received: from clientip-171.223.97.37?logid-5ad577dca6294f93a78c774e52779d08 (unknown [172.18.0.48]) by chinatelecom.cn (HERMES) with SMTP id B40BC2800C3; Thu, 15 Jul 2021 23:51:54 +0800 (CST) Received: from ([172.18.0.48]) by app0024 with ESMTP id 92fcea882ba14cf2a1eefca3dbc1ef6d for qemu-devel@nongnu.org; Thu Jul 15 23:51:55 2021 HMM_SOURCE_IP: 172.18.0.48:41252.1306426439 HMM_ATTACHE_NUM: 0000 HMM_SOURCE_TYPE: SMTP X-189-SAVE-TO-SEND: +huangy81@chinatelecom.cn X-Transaction-ID: 92fcea882ba14cf2a1eefca3dbc1ef6d X-filter-score: X-Real-From: huangy81@chinatelecom.cn X-Receive-IP: 172.18.0.48 X-MEDUSA-Status: 0 From: huangy81@chinatelecom.cn To: qemu-devel@nongnu.org Subject: [PATCH v3 1/3] KVM: introduce kvm_get_manual_dirty_log_protect Date: Thu, 15 Jul 2021 23:51:31 +0800 Message-Id: X-Mailer: git-send-email 1.8.3.1 In-Reply-To: References: In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=42.123.76.228; envelope-from=huangy81@chinatelecom.cn; helo=chinatelecom.cn X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eduardo Habkost , Juan Quintela , Hyman , "Dr. David Alan Gilbert" , Peter Xu , Chuan Zheng , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1626364410967100001 From: Hyman Huang(=E9=BB=84=E5=8B=87) introduce kvm_get_manual_dirty_log_protect for measureing dirtyrate via dirty bitmap. calculation of dirtyrate need to sync dirty log and depends on the features of dirty log. Signed-off-by: Hyman Huang(=E9=BB=84=E5=8B=87) --- accel/kvm/kvm-all.c | 6 ++++++ include/sysemu/kvm.h | 1 + 2 files changed, 7 insertions(+) diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index e0e88a2..f7d9ae0 100644 --- a/accel/kvm/kvm-all.c +++ b/accel/kvm/kvm-all.c @@ -245,6 +245,12 @@ int kvm_get_max_memslots(void) return s->nr_slots; } =20 +uint64_t kvm_get_manual_dirty_log_protect(void) +{ + KVMState *s =3D KVM_STATE(current_accel()); + return s->manual_dirty_log_protect; +} + /* Called with KVMMemoryListener.slots_lock held */ static KVMSlot *kvm_get_free_slot(KVMMemoryListener *kml) { diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h index 7b22aeb..b668d49 100644 --- a/include/sysemu/kvm.h +++ b/include/sysemu/kvm.h @@ -533,6 +533,7 @@ int kvm_set_one_reg(CPUState *cs, uint64_t id, void *so= urce); int kvm_get_one_reg(CPUState *cs, uint64_t id, void *target); struct ppc_radix_page_info *kvm_get_radix_page_info(void); int kvm_get_max_memslots(void); +uint64_t kvm_get_manual_dirty_log_protect(void); =20 /* Notify resamplefd for EOI of specific interrupts. */ void kvm_resample_fd_notify(int gsi); --=20 1.8.3.1 From nobody Sat May 11 07:24:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1626364500901427.7076232920746; Thu, 15 Jul 2021 08:55:00 -0700 (PDT) Received: from localhost ([::1]:39982 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m43hT-0000P9-St for importer@patchew.org; Thu, 15 Jul 2021 11:54:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42958) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m43ep-000309-SP for qemu-devel@nongnu.org; Thu, 15 Jul 2021 11:52:15 -0400 Received: from prt-mail.chinatelecom.cn ([42.123.76.228]:35930 helo=chinatelecom.cn) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m43eo-0002ai-4r for qemu-devel@nongnu.org; Thu, 15 Jul 2021 11:52:15 -0400 Received: from clientip-171.223.97.37?logid-5ad577dca6294f93a78c774e52779d08 (unknown [172.18.0.48]) by chinatelecom.cn (HERMES) with SMTP id C32462800C5; Thu, 15 Jul 2021 23:52:00 +0800 (CST) Received: from ([172.18.0.48]) by app0024 with ESMTP id 666ee4b855de41d6816d509752fb1126 for qemu-devel@nongnu.org; Thu Jul 15 23:52:00 2021 HMM_SOURCE_IP: 172.18.0.48:41252.1306426439 HMM_ATTACHE_NUM: 0000 HMM_SOURCE_TYPE: SMTP X-189-SAVE-TO-SEND: +huangy81@chinatelecom.cn X-Transaction-ID: 666ee4b855de41d6816d509752fb1126 X-filter-score: X-Real-From: huangy81@chinatelecom.cn X-Receive-IP: 172.18.0.48 X-MEDUSA-Status: 0 From: huangy81@chinatelecom.cn To: qemu-devel@nongnu.org Subject: [PATCH v3 2/3] memory: introduce DirtyRateDirtyPages and util function Date: Thu, 15 Jul 2021 23:51:32 +0800 Message-Id: <316de737c2fee577cbf75a47dc7537ce38844a63.1626364220.git.huangy81@chinatelecom.cn> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: References: In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=42.123.76.228; envelope-from=huangy81@chinatelecom.cn; helo=chinatelecom.cn X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eduardo Habkost , Juan Quintela , Hyman , "Dr. David Alan Gilbert" , Peter Xu , Chuan Zheng , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1626364502520100001 From: Hyman Huang(=E9=BB=84=E5=8B=87) introduce DirtyRateDirtyPages and use it to the dirty pages along with memory_global_dirty_log_sync. introduce cpu_physical_memory_dirtyrate_reset_protect to clear dirty bitmap within slot in kvm Signed-off-by: Hyman Huang(=E9=BB=84=E5=8B=87) --- include/exec/ram_addr.h | 19 +++++++++++++++++++ migration/dirtyrate.c | 2 ++ 2 files changed, 21 insertions(+) diff --git a/include/exec/ram_addr.h b/include/exec/ram_addr.h index 45c9132..dce0f46 100644 --- a/include/exec/ram_addr.h +++ b/include/exec/ram_addr.h @@ -26,6 +26,8 @@ #include "exec/ramlist.h" #include "exec/ramblock.h" =20 +extern uint64_t DirtyRateDirtyPages; + /** * clear_bmap_size: calculate clear bitmap size * @@ -415,6 +417,17 @@ static inline void cpu_physical_memory_set_dirty_lebit= map(unsigned long *bitmap, } } } + + if (global_dirty_tracking && + global_dirty_tracking & GLOBAL_DIRTY_DIRTY_RATE) { + long nr =3D BITS_TO_LONGS(pages); + for (i =3D 0; i < nr; i++) { + if (bitmap[i]) { + unsigned long temp =3D leul_to_cpu(bitmap[i]); + DirtyRateDirtyPages +=3D ctpopl(temp); + } + } + } } #endif /* not _WIN32 */ =20 @@ -510,5 +523,11 @@ uint64_t cpu_physical_memory_sync_dirty_bitmap(RAMBloc= k *rb, =20 return num_dirty; } + +static inline +void cpu_physical_memory_dirtyrate_reset_protect(RAMBlock *rb) +{ + memory_region_clear_dirty_bitmap(rb->mr, 0, rb->used_length); +} #endif #endif diff --git a/migration/dirtyrate.c b/migration/dirtyrate.c index 3c8c5e2..c465e62 100644 --- a/migration/dirtyrate.c +++ b/migration/dirtyrate.c @@ -28,6 +28,8 @@ #include "sysemu/runstate.h" #include "exec/memory.h" =20 +uint64_t DirtyRateDirtyPages; + typedef struct DirtyPageRecord { uint64_t start_pages; uint64_t end_pages; --=20 1.8.3.1 From nobody Sat May 11 07:24:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1626364417551398.95824636444956; Thu, 15 Jul 2021 08:53:37 -0700 (PDT) Received: from localhost ([::1]:34066 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m43g8-0004u4-B9 for importer@patchew.org; Thu, 15 Jul 2021 11:53:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42932) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m43em-0002qT-5i for qemu-devel@nongnu.org; Thu, 15 Jul 2021 11:52:12 -0400 Received: from prt-mail.chinatelecom.cn ([42.123.76.228]:35944 helo=chinatelecom.cn) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m43ej-0002fa-MI for qemu-devel@nongnu.org; Thu, 15 Jul 2021 11:52:11 -0400 Received: from clientip-171.223.97.37?logid-5ad577dca6294f93a78c774e52779d08 (unknown [172.18.0.48]) by chinatelecom.cn (HERMES) with SMTP id 305AC2800C3; Thu, 15 Jul 2021 23:52:05 +0800 (CST) Received: from ([172.18.0.48]) by app0024 with ESMTP id 0145f8ab6eb54332b287418023747a9f for qemu-devel@nongnu.org; Thu Jul 15 23:52:08 2021 HMM_SOURCE_IP: 172.18.0.48:41252.1306426439 HMM_ATTACHE_NUM: 0000 HMM_SOURCE_TYPE: SMTP X-189-SAVE-TO-SEND: +huangy81@chinatelecom.cn X-Transaction-ID: 0145f8ab6eb54332b287418023747a9f X-filter-score: X-Real-From: huangy81@chinatelecom.cn X-Receive-IP: 172.18.0.48 X-MEDUSA-Status: 0 From: huangy81@chinatelecom.cn To: qemu-devel@nongnu.org Subject: [PATCH v3 3/3] migration/dirtyrate: implement dirty-bitmap dirtyrate calculation Date: Thu, 15 Jul 2021 23:51:33 +0800 Message-Id: <1623bf516942494f78b0d33c9dda1297d6660574.1626364220.git.huangy81@chinatelecom.cn> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: References: In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=42.123.76.228; envelope-from=huangy81@chinatelecom.cn; helo=chinatelecom.cn X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eduardo Habkost , Juan Quintela , Hyman , "Dr. David Alan Gilbert" , Peter Xu , Chuan Zheng , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1626364419188100001 From: Hyman Huang(=E9=BB=84=E5=8B=87) introduce dirty-bitmap mode as the third method of calc-dirty-rate. implement dirty-bitmap dirtyrate calculation, which can be used to measuring dirtyrate in the absence of dirty-ring. introduce "dirty_bitmap:-b" option in hmp calc_dirty_rate to indicate dirty bitmap method should be used for calculation. Signed-off-by: Hyman Huang(=E9=BB=84=E5=8B=87) --- hmp-commands.hx | 9 ++-- migration/dirtyrate.c | 116 +++++++++++++++++++++++++++++++++++++++++++++= ---- migration/trace-events | 1 + qapi/migration.json | 6 ++- 4 files changed, 117 insertions(+), 15 deletions(-) diff --git a/hmp-commands.hx b/hmp-commands.hx index f7fc9d7..605973c 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -1738,9 +1738,10 @@ ERST =20 { .name =3D "calc_dirty_rate", - .args_type =3D "dirty_ring:-r,second:l,sample_pages_per_GB:l?", - .params =3D "[-r] second [sample_pages_per_GB]", - .help =3D "start a round of guest dirty rate measurement (us= ing -d to" - "\n\t\t\t specify dirty ring as the method of calcul= ation)", + .args_type =3D "dirty_ring:-r,dirty_bitmap:-b,second:l,sample_pag= es_per_GB:l?", + .params =3D "[-r] [-b] second [sample_pages_per_GB]", + .help =3D "start a round of guest dirty rate measurement (us= ing -r to" + "\n\t\t\t specify dirty ring as the method of calcul= ation and" + "\n\t\t\t -b to specify dirty bitmap as method of ca= lculation)", .cmd =3D hmp_calc_dirty_rate, }, diff --git a/migration/dirtyrate.c b/migration/dirtyrate.c index c465e62..8006a0d 100644 --- a/migration/dirtyrate.c +++ b/migration/dirtyrate.c @@ -15,6 +15,7 @@ #include "qapi/error.h" #include "cpu.h" #include "exec/ramblock.h" +#include "exec/ram_addr.h" #include "qemu/rcu_queue.h" #include "qemu/main-loop.h" #include "qapi/qapi-commands-migration.h" @@ -113,6 +114,10 @@ static struct DirtyRateInfo *query_dirty_rate_info(voi= d) } info->vcpu_dirty_rate =3D head; } + + if (dirtyrate_mode =3D=3D DIRTY_RATE_MEASURE_MODE_DIRTY_BITMAP) { + info->sample_pages =3D 0; + } } =20 trace_query_dirty_rate_info(DirtyRateStatus_str(CalculatingState)); @@ -410,6 +415,83 @@ static void dirtyrate_global_dirty_log_stop(void) qemu_mutex_unlock_iothread(); } =20 +static inline void dirtyrate_dirtypages_clear(void) +{ + DirtyRateDirtyPages =3D 0; +} + +static inline void dirtyrate_manual_reset_protect(void) +{ + RAMBlock *block =3D NULL; + + WITH_RCU_READ_LOCK_GUARD() { + RAMBLOCK_FOREACH_MIGRATABLE(block) { + cpu_physical_memory_dirtyrate_reset_protect(block); + } + } +} + +static void do_calculate_dirtyrate_bitmap(void) +{ + uint64_t memory_size_MB; + int64_t time_s; + uint64_t dirtyrate =3D 0; + + memory_size_MB =3D (DirtyRateDirtyPages *TARGET_PAGE_SIZE) >> 20; + time_s =3D DirtyStat.calc_time; + + dirtyrate =3D memory_size_MB / time_s; + DirtyStat.dirty_rate =3D dirtyrate; + + trace_dirtyrate_do_calculate_bitmap(DirtyRateDirtyPages, + time_s, dirtyrate); +} + +static void calculate_dirtyrate_dirty_bitmap(struct DirtyRateConfig config) +{ + int64_t msec =3D 0; + int64_t start_time; + uint64_t protect_flags =3D kvm_get_manual_dirty_log_protect(); + + dirtyrate_global_dirty_log_start(); + + /* + * 1'round of log sync may return all 1 bits with + * KVM_DIRTY_LOG_INITIALLY_SET enable + * skip it unconditionally and start dirty tracking + * from 2'round of log sync + */ + memory_global_dirty_log_sync(); + + /* + * reset page protect manually and + * start dirty tracking from now on + */ + if (protect_flags & KVM_DIRTY_LOG_MANUAL_PROTECT_ENABLE) { + dirtyrate_manual_reset_protect(); + } + + dirtyrate_dirtypages_clear(); + + start_time =3D qemu_clock_get_ms(QEMU_CLOCK_REALTIME); + DirtyStat.start_time =3D start_time / 1000; + + msec =3D config.sample_period_seconds * 1000; + msec =3D set_sample_page_period(msec, start_time); + DirtyStat.calc_time =3D msec / 1000; + + /* fetch dirty bitmap from kvm */ + memory_global_dirty_log_sync(); + + do_calculate_dirtyrate_bitmap(); + + if (protect_flags & KVM_DIRTY_LOG_MANUAL_PROTECT_ENABLE) { + dirtyrate_manual_reset_protect(); + } + + dirtyrate_global_dirty_log_stop(); +} + static int64_t do_calculate_dirtyrate_vcpu(DirtyPageRecord dirty_pages) { uint64_t memory_size_MB; @@ -508,7 +590,9 @@ out: =20 static void calculate_dirtyrate(struct DirtyRateConfig config) { - if (config.mode =3D=3D DIRTY_RATE_MEASURE_MODE_DIRTY_RING) { + if (config.mode =3D=3D DIRTY_RATE_MEASURE_MODE_DIRTY_BITMAP) { + calculate_dirtyrate_dirty_bitmap(config); + } else if (config.mode =3D=3D DIRTY_RATE_MEASURE_MODE_DIRTY_RING) { calculate_dirtyrate_dirty_ring(config); } else { calculate_dirtyrate_sample_vm(config); @@ -591,12 +675,15 @@ void qmp_calc_dirty_rate(int64_t calc_time, =20 /* * dirty ring mode only works when kvm dirty ring is enabled. + * on the contrary, dirty bitmap mode is not. */ - if ((mode =3D=3D DIRTY_RATE_MEASURE_MODE_DIRTY_RING) && - !kvm_dirty_ring_enabled()) { - error_setg(errp, "dirty ring is disabled, use sample-pages method " - "or remeasure later."); - return; + if (((mode =3D=3D DIRTY_RATE_MEASURE_MODE_DIRTY_RING) && + !kvm_dirty_ring_enabled()) || + ((mode =3D=3D DIRTY_RATE_MEASURE_MODE_DIRTY_BITMAP) && + kvm_dirty_ring_enabled())) { + error_setg(errp, "mode %s is not enabled, use other method instead= .", + DirtyRateMeasureMode_str(mode)); + return; } =20 /* @@ -672,9 +759,8 @@ void hmp_calc_dirty_rate(Monitor *mon, const QDict *qdi= ct) int64_t sample_pages =3D qdict_get_try_int(qdict, "sample_pages_per_GB= ", -1); bool has_sample_pages =3D (sample_pages !=3D -1); bool dirty_ring =3D qdict_get_try_bool(qdict, "dirty_ring", false); - DirtyRateMeasureMode mode =3D - (dirty_ring ? DIRTY_RATE_MEASURE_MODE_DIRTY_RING : - DIRTY_RATE_MEASURE_MODE_PAGE_SAMPLING); + bool dirty_bitmap =3D qdict_get_try_bool(qdict, "dirty_bitmap", false); + DirtyRateMeasureMode mode =3D DIRTY_RATE_MEASURE_MODE_PAGE_SAMPLING; Error *err =3D NULL; =20 if (!sec) { @@ -682,6 +768,18 @@ void hmp_calc_dirty_rate(Monitor *mon, const QDict *qd= ict) return; } =20 + if (dirty_ring && dirty_bitmap) { + monitor_printf(mon, "Either dirty ring or dirty bitmap " + "can be specified!\n"); + return; + } + + if (dirty_bitmap) { + mode =3D DIRTY_RATE_MEASURE_MODE_DIRTY_BITMAP; + } else if (dirty_ring) { + mode =3D DIRTY_RATE_MEASURE_MODE_DIRTY_RING; + } + qmp_calc_dirty_rate(sec, has_sample_pages, sample_pages, true, mode, &err); if (err) { diff --git a/migration/trace-events b/migration/trace-events index ce0b5e6..921f7a7 100644 --- a/migration/trace-events +++ b/migration/trace-events @@ -333,6 +333,7 @@ skip_sample_ramblock(const char *idstr, uint64_t ramblo= ck_size) "ramblock name: find_page_matched(const char *idstr) "ramblock %s addr or size changed" dirtyrate_calculate(int64_t dirtyrate) "dirty rate: %" PRIi64 " MB/s" dirtyrate_do_calculate_vcpu(int idx, uint64_t rate) "vcpu[%d]: %"PRIu64 " = MB/s" +dirtyrate_do_calculate_bitmap(uint64_t pages, int64_t time, uint64_t rate)= "%"PRIu64 " pages has increased in %"PRIi64 " s, rate %"PRIu64 "MB/s" =20 # block.c migration_block_init_shared(const char *blk_device_name) "Start migration = for %s with shared base image" diff --git a/qapi/migration.json b/qapi/migration.json index de35528..0b00976 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -1747,13 +1747,15 @@ # # @page-sampling: calculate dirtyrate by sampling pages. # -# @dirty-ring: calculate dirtyrate by via dirty ring. +# @dirty-ring: calculate dirtyrate by dirty ring. +# +# @dirty-bitmap: calculate dirtyrate by dirty bitmap. # # Since: 6.1 # ## { 'enum': 'DirtyRateMeasureMode', - 'data': ['page-sampling', 'dirty-ring'] } + 'data': ['page-sampling', 'dirty-ring', 'dirty-bitmap'] } =20 ## # @DirtyRateInfo: --=20 1.8.3.1