* [PATCH v4 0/6] migration: auto-converge refinements for huge VM
@ 2024-10-17 6:42 yong.huang
2024-10-17 6:42 ` [PATCH v4 1/6] accel/tcg/icount-common: Remove the reference to the unused header file yong.huang
` (6 more replies)
0 siblings, 7 replies; 16+ messages in thread
From: yong.huang @ 2024-10-17 6:42 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Xu, Fabiano Rosas, Richard Henderson, Paolo Bonzini,
yong.huang
From: Hyman Huang <yong.huang@smartx.com>
v4:
1. split the [PATCH v3 1/6] into smaller patches.
2. refine some comment and commit message
3. fix race issue for the throttle_dirty_sync_timer
4. refine the util function cpu_throttle_dirty_sync_timer
Thanks Peter for the suggestions.
Please review.
Yong
v3:
1. drop the responsive throttle patchset
2. rename background sync to periodic ramblock dirty sync
3. move the cpu-throttle.* from system to migration
4. remove "rs" parameter in migration_bitmap_sync_precopy
5. implement periodic ramblock dirty sync in cpu-throttle.c
6. move the test change into a separate patch
To simplify the cover letter, i have dropped the test data,
please refer to
https://lore.kernel.org/qemu-devel/cover.1727630000.git.yong.huang@smartx.com/
for more test details.
Thanks Peter and Fabiano for the suggestions and comments.
Please review.
Yong
Hyman Huang (6):
accel/tcg/icount-common: Remove the reference to the unused header
file
migration: Stop CPU throttling conditionally
migration: Move cpu-throttole.c from system to migration
migration: Remove "rs" parameter in migration_bitmap_sync_precopy
migration: Support periodic RAMBlock dirty bitmap sync
tests/migration: Add case for periodic ramblock dirty sync
accel/tcg/icount-common.c | 1 -
{system => migration}/cpu-throttle.c | 67 +++++++++++++++++++-
{include/sysemu => migration}/cpu-throttle.h | 14 ++++
migration/meson.build | 1 +
migration/migration.c | 23 +++++--
migration/migration.h | 1 +
migration/ram.c | 13 ++--
migration/trace-events | 4 ++
system/cpu-timers.c | 3 -
system/meson.build | 1 -
system/trace-events | 3 -
tests/qtest/migration-test.c | 32 ++++++++++
12 files changed, 143 insertions(+), 20 deletions(-)
rename {system => migration}/cpu-throttle.c (67%)
rename {include/sysemu => migration}/cpu-throttle.h (87%)
--
2.27.0
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH v4 1/6] accel/tcg/icount-common: Remove the reference to the unused header file
2024-10-17 6:42 [PATCH v4 0/6] migration: auto-converge refinements for huge VM yong.huang
@ 2024-10-17 6:42 ` yong.huang
2024-10-17 17:59 ` Fabiano Rosas
2024-10-17 6:42 ` [PATCH v4 2/6] migration: Stop CPU throttling conditionally yong.huang
` (5 subsequent siblings)
6 siblings, 1 reply; 16+ messages in thread
From: yong.huang @ 2024-10-17 6:42 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Xu, Fabiano Rosas, Richard Henderson, Paolo Bonzini,
yong.huang
From: Hyman Huang <yong.huang@smartx.com>
Signed-off-by: Hyman Huang <yong.huang@smartx.com>
---
accel/tcg/icount-common.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/accel/tcg/icount-common.c b/accel/tcg/icount-common.c
index 8d3d3a7e9d..30bf8500dc 100644
--- a/accel/tcg/icount-common.c
+++ b/accel/tcg/icount-common.c
@@ -36,7 +36,6 @@
#include "sysemu/runstate.h"
#include "hw/core/cpu.h"
#include "sysemu/cpu-timers.h"
-#include "sysemu/cpu-throttle.h"
#include "sysemu/cpu-timers-internal.h"
/*
--
2.27.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v4 2/6] migration: Stop CPU throttling conditionally
2024-10-17 6:42 [PATCH v4 0/6] migration: auto-converge refinements for huge VM yong.huang
2024-10-17 6:42 ` [PATCH v4 1/6] accel/tcg/icount-common: Remove the reference to the unused header file yong.huang
@ 2024-10-17 6:42 ` yong.huang
2024-10-17 18:02 ` Fabiano Rosas
2024-10-17 6:42 ` [PATCH v4 3/6] migration: Move cpu-throttole.c from system to migration yong.huang
` (4 subsequent siblings)
6 siblings, 1 reply; 16+ messages in thread
From: yong.huang @ 2024-10-17 6:42 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Xu, Fabiano Rosas, Richard Henderson, Paolo Bonzini,
yong.huang
From: Hyman Huang <yong.huang@smartx.com>
Since CPU throttling only occurs when auto-converge
is on, stop it conditionally.
Signed-off-by: Hyman Huang <yong.huang@smartx.com>
---
migration/migration.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/migration/migration.c b/migration/migration.c
index 021faee2f3..37a200a177 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -3289,7 +3289,9 @@ static MigIterateState migration_iteration_run(MigrationState *s)
static void migration_iteration_finish(MigrationState *s)
{
/* If we enabled cpu throttling for auto-converge, turn it off. */
- cpu_throttle_stop();
+ if (migrate_auto_converge()) {
+ cpu_throttle_stop();
+ }
bql_lock();
switch (s->state) {
--
2.27.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v4 3/6] migration: Move cpu-throttole.c from system to migration
2024-10-17 6:42 [PATCH v4 0/6] migration: auto-converge refinements for huge VM yong.huang
2024-10-17 6:42 ` [PATCH v4 1/6] accel/tcg/icount-common: Remove the reference to the unused header file yong.huang
2024-10-17 6:42 ` [PATCH v4 2/6] migration: Stop CPU throttling conditionally yong.huang
@ 2024-10-17 6:42 ` yong.huang
2024-10-17 18:10 ` Fabiano Rosas
2024-10-17 6:42 ` [PATCH v4 4/6] migration: Remove "rs" parameter in migration_bitmap_sync_precopy yong.huang
` (3 subsequent siblings)
6 siblings, 1 reply; 16+ messages in thread
From: yong.huang @ 2024-10-17 6:42 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Xu, Fabiano Rosas, Richard Henderson, Paolo Bonzini,
yong.huang
From: Hyman Huang <yong.huang@smartx.com>
Move cpu-throttle.c from system to migration since it's
only used for migration; this makes us avoid exporting the
util functions and variables in misc.h but export them in
migration.h when implementing the periodic ramblock dirty
sync feature in the upcoming commits.
Since CPU throttle timers are only used in migration, move
their registry to migration_object_init.
Signed-off-by: Hyman Huang <yong.huang@smartx.com>
---
{system => migration}/cpu-throttle.c | 2 +-
{include/sysemu => migration}/cpu-throttle.h | 0
migration/meson.build | 1 +
migration/migration.c | 5 ++++-
migration/ram.c | 2 +-
migration/trace-events | 3 +++
system/cpu-timers.c | 3 ---
system/meson.build | 1 -
system/trace-events | 3 ---
9 files changed, 10 insertions(+), 10 deletions(-)
rename {system => migration}/cpu-throttle.c (99%)
rename {include/sysemu => migration}/cpu-throttle.h (100%)
diff --git a/system/cpu-throttle.c b/migration/cpu-throttle.c
similarity index 99%
rename from system/cpu-throttle.c
rename to migration/cpu-throttle.c
index 7632dc6143..fa47ee2e21 100644
--- a/system/cpu-throttle.c
+++ b/migration/cpu-throttle.c
@@ -27,7 +27,7 @@
#include "hw/core/cpu.h"
#include "qemu/main-loop.h"
#include "sysemu/cpus.h"
-#include "sysemu/cpu-throttle.h"
+#include "cpu-throttle.h"
#include "trace.h"
/* vcpu throttling controls */
diff --git a/include/sysemu/cpu-throttle.h b/migration/cpu-throttle.h
similarity index 100%
rename from include/sysemu/cpu-throttle.h
rename to migration/cpu-throttle.h
diff --git a/migration/meson.build b/migration/meson.build
index 66d3de86f0..d53cf3417a 100644
--- a/migration/meson.build
+++ b/migration/meson.build
@@ -13,6 +13,7 @@ system_ss.add(files(
'block-dirty-bitmap.c',
'channel.c',
'channel-block.c',
+ 'cpu-throttle.c',
'dirtyrate.c',
'exec.c',
'fd.c',
diff --git a/migration/migration.c b/migration/migration.c
index 37a200a177..2e10ca77af 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -24,7 +24,7 @@
#include "socket.h"
#include "sysemu/runstate.h"
#include "sysemu/sysemu.h"
-#include "sysemu/cpu-throttle.h"
+#include "cpu-throttle.h"
#include "rdma.h"
#include "ram.h"
#include "migration/global_state.h"
@@ -263,6 +263,9 @@ void migration_object_init(void)
ram_mig_init();
dirty_bitmap_mig_init();
+
+ /* Initialize cpu throttle timers */
+ cpu_throttle_init();
}
typedef struct {
diff --git a/migration/ram.c b/migration/ram.c
index 326ce7eb79..54d352b152 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -52,7 +52,7 @@
#include "exec/target_page.h"
#include "qemu/rcu_queue.h"
#include "migration/colo.h"
-#include "sysemu/cpu-throttle.h"
+#include "cpu-throttle.h"
#include "savevm.h"
#include "qemu/iov.h"
#include "multifd.h"
diff --git a/migration/trace-events b/migration/trace-events
index c65902f042..9a19599804 100644
--- a/migration/trace-events
+++ b/migration/trace-events
@@ -378,3 +378,6 @@ migration_block_progression(unsigned percent) "Completed %u%%"
# page_cache.c
migration_pagecache_init(int64_t max_num_items) "Setting cache buckets to %" PRId64
migration_pagecache_insert(void) "Error allocating page"
+
+# cpu-throttle.c
+cpu_throttle_set(int new_throttle_pct) "set guest CPU throttled by %d%%"
diff --git a/system/cpu-timers.c b/system/cpu-timers.c
index 0b31c9a1b6..856e502e34 100644
--- a/system/cpu-timers.c
+++ b/system/cpu-timers.c
@@ -35,7 +35,6 @@
#include "sysemu/runstate.h"
#include "hw/core/cpu.h"
#include "sysemu/cpu-timers.h"
-#include "sysemu/cpu-throttle.h"
#include "sysemu/cpu-timers-internal.h"
/* clock and ticks */
@@ -272,6 +271,4 @@ void cpu_timers_init(void)
seqlock_init(&timers_state.vm_clock_seqlock);
qemu_spin_init(&timers_state.vm_clock_lock);
vmstate_register(NULL, 0, &vmstate_timers, &timers_state);
-
- cpu_throttle_init();
}
diff --git a/system/meson.build b/system/meson.build
index a296270cb0..4952f4b2c7 100644
--- a/system/meson.build
+++ b/system/meson.build
@@ -10,7 +10,6 @@ system_ss.add(files(
'balloon.c',
'bootdevice.c',
'cpus.c',
- 'cpu-throttle.c',
'cpu-timers.c',
'datadir.c',
'dirtylimit.c',
diff --git a/system/trace-events b/system/trace-events
index 074d001e90..2ed1d59b1f 100644
--- a/system/trace-events
+++ b/system/trace-events
@@ -44,6 +44,3 @@ dirtylimit_state_finalize(void)
dirtylimit_throttle_pct(int cpu_index, uint64_t pct, int64_t time_us) "CPU[%d] throttle percent: %" PRIu64 ", throttle adjust time %"PRIi64 " us"
dirtylimit_set_vcpu(int cpu_index, uint64_t quota) "CPU[%d] set dirty page rate limit %"PRIu64
dirtylimit_vcpu_execute(int cpu_index, int64_t sleep_time_us) "CPU[%d] sleep %"PRIi64 " us"
-
-# cpu-throttle.c
-cpu_throttle_set(int new_throttle_pct) "set guest CPU throttled by %d%%"
--
2.27.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v4 4/6] migration: Remove "rs" parameter in migration_bitmap_sync_precopy
2024-10-17 6:42 [PATCH v4 0/6] migration: auto-converge refinements for huge VM yong.huang
` (2 preceding siblings ...)
2024-10-17 6:42 ` [PATCH v4 3/6] migration: Move cpu-throttole.c from system to migration yong.huang
@ 2024-10-17 6:42 ` yong.huang
2024-10-17 6:42 ` [PATCH v4 5/6] migration: Support periodic RAMBlock dirty bitmap sync yong.huang
` (2 subsequent siblings)
6 siblings, 0 replies; 16+ messages in thread
From: yong.huang @ 2024-10-17 6:42 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Xu, Fabiano Rosas, Richard Henderson, Paolo Bonzini,
yong.huang
From: Hyman Huang <yong.huang@smartx.com>
The global static variable ram_state in fact is referred to by the
"rs" parameter in migration_bitmap_sync_precopy. For ease of calling
by the callees, use the global variable directly in
migration_bitmap_sync_precopy and remove "rs" parameter.
The migration_bitmap_sync_precopy will be exported in the next commit.
Signed-off-by: Hyman Huang <yong.huang@smartx.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
---
migration/ram.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/migration/ram.c b/migration/ram.c
index 54d352b152..9b5b350405 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -1088,9 +1088,10 @@ static void migration_bitmap_sync(RAMState *rs, bool last_stage)
}
}
-static void migration_bitmap_sync_precopy(RAMState *rs, bool last_stage)
+static void migration_bitmap_sync_precopy(bool last_stage)
{
Error *local_err = NULL;
+ assert(ram_state);
/*
* The current notifier usage is just an optimization to migration, so we
@@ -1101,7 +1102,7 @@ static void migration_bitmap_sync_precopy(RAMState *rs, bool last_stage)
local_err = NULL;
}
- migration_bitmap_sync(rs, last_stage);
+ migration_bitmap_sync(ram_state, last_stage);
if (precopy_notify(PRECOPY_NOTIFY_AFTER_BITMAP_SYNC, &local_err)) {
error_report_err(local_err);
@@ -2782,7 +2783,7 @@ static bool ram_init_bitmaps(RAMState *rs, Error **errp)
if (!ret) {
goto out_unlock;
}
- migration_bitmap_sync_precopy(rs, false);
+ migration_bitmap_sync_precopy(false);
}
}
out_unlock:
@@ -3248,7 +3249,7 @@ static int ram_save_complete(QEMUFile *f, void *opaque)
WITH_RCU_READ_LOCK_GUARD() {
if (!migration_in_postcopy()) {
- migration_bitmap_sync_precopy(rs, true);
+ migration_bitmap_sync_precopy(true);
}
ret = rdma_registration_start(f, RAM_CONTROL_FINISH);
@@ -3330,7 +3331,7 @@ static void ram_state_pending_exact(void *opaque, uint64_t *must_precopy,
if (!migration_in_postcopy()) {
bql_lock();
WITH_RCU_READ_LOCK_GUARD() {
- migration_bitmap_sync_precopy(rs, false);
+ migration_bitmap_sync_precopy(false);
}
bql_unlock();
}
--
2.27.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v4 5/6] migration: Support periodic RAMBlock dirty bitmap sync
2024-10-17 6:42 [PATCH v4 0/6] migration: auto-converge refinements for huge VM yong.huang
` (3 preceding siblings ...)
2024-10-17 6:42 ` [PATCH v4 4/6] migration: Remove "rs" parameter in migration_bitmap_sync_precopy yong.huang
@ 2024-10-17 6:42 ` yong.huang
2024-10-17 18:57 ` Fabiano Rosas
2024-10-17 19:33 ` Peter Xu
2024-10-17 6:42 ` [PATCH v4 6/6] tests/migration: Add case for periodic ramblock dirty sync yong.huang
2024-10-18 15:08 ` [PATCH v4 0/6] migration: auto-converge refinements for huge VM Peter Xu
6 siblings, 2 replies; 16+ messages in thread
From: yong.huang @ 2024-10-17 6:42 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Xu, Fabiano Rosas, Richard Henderson, Paolo Bonzini,
yong.huang
From: Hyman Huang <yong.huang@smartx.com>
When VM is configured with huge memory, the current throttle logic
doesn't look like to scale, because migration_trigger_throttle()
is only called for each iteration, so it won't be invoked for a long
time if one iteration can take a long time.
The periodic dirty sync aims to fix the above issue by synchronizing
the ramblock from remote dirty bitmap and, when necessary, triggering
the CPU throttle multiple times during a long iteration.
This is a trade-off between synchronization overhead and CPU throttle
impact.
Signed-off-by: Hyman Huang <yong.huang@smartx.com>
---
migration/cpu-throttle.c | 65 +++++++++++++++++++++++++++++++++++++++-
migration/cpu-throttle.h | 14 +++++++++
migration/migration.c | 14 +++++++--
migration/migration.h | 1 +
migration/ram.c | 2 +-
migration/trace-events | 1 +
6 files changed, 93 insertions(+), 4 deletions(-)
diff --git a/migration/cpu-throttle.c b/migration/cpu-throttle.c
index fa47ee2e21..342681cdd4 100644
--- a/migration/cpu-throttle.c
+++ b/migration/cpu-throttle.c
@@ -28,16 +28,22 @@
#include "qemu/main-loop.h"
#include "sysemu/cpus.h"
#include "cpu-throttle.h"
+#include "migration.h"
+#include "migration-stats.h"
#include "trace.h"
/* vcpu throttling controls */
-static QEMUTimer *throttle_timer;
+static QEMUTimer *throttle_timer, *throttle_dirty_sync_timer;
static unsigned int throttle_percentage;
+static bool throttle_dirty_sync_timer_active;
#define CPU_THROTTLE_PCT_MIN 1
#define CPU_THROTTLE_PCT_MAX 99
#define CPU_THROTTLE_TIMESLICE_NS 10000000
+/* Making sure RAMBlock dirty bitmap is synchronized every five seconds */
+#define CPU_THROTTLE_DIRTY_SYNC_TIMESLICE_MS 5000
+
static void cpu_throttle_thread(CPUState *cpu, run_on_cpu_data opaque)
{
double pct;
@@ -112,6 +118,7 @@ void cpu_throttle_set(int new_throttle_pct)
void cpu_throttle_stop(void)
{
qatomic_set(&throttle_percentage, 0);
+ cpu_throttle_dirty_sync_timer(false);
}
bool cpu_throttle_active(void)
@@ -124,8 +131,64 @@ int cpu_throttle_get_percentage(void)
return qatomic_read(&throttle_percentage);
}
+void cpu_throttle_dirty_sync_timer_tick(void *opaque)
+{
+ static uint64_t prev_sync_cnt;
+ uint64_t sync_cnt = stat64_get(&mig_stats.dirty_sync_count);
+
+ /*
+ * The first iteration copies all memory anyhow and has no
+ * effect on guest performance, therefore omit it to avoid
+ * paying extra for the sync penalty.
+ */
+ if (sync_cnt <= 1) {
+ goto end;
+ }
+
+ if (sync_cnt == prev_sync_cnt) {
+ trace_cpu_throttle_dirty_sync();
+ WITH_RCU_READ_LOCK_GUARD() {
+ migration_bitmap_sync_precopy(false);
+ }
+ }
+
+end:
+ prev_sync_cnt = stat64_get(&mig_stats.dirty_sync_count);
+
+ timer_mod(throttle_dirty_sync_timer,
+ qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL_RT) +
+ CPU_THROTTLE_DIRTY_SYNC_TIMESLICE_MS);
+}
+
+static bool cpu_throttle_dirty_sync_active(void)
+{
+ return qatomic_read(&throttle_dirty_sync_timer_active);
+}
+
+void cpu_throttle_dirty_sync_timer(bool enable)
+{
+ assert(throttle_dirty_sync_timer);
+
+ if (enable) {
+ if (!cpu_throttle_dirty_sync_active()) {
+ timer_mod(throttle_dirty_sync_timer,
+ qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL_RT) +
+ CPU_THROTTLE_DIRTY_SYNC_TIMESLICE_MS);
+ qatomic_set(&throttle_dirty_sync_timer_active, 1);
+ }
+ } else {
+ if (cpu_throttle_dirty_sync_active()) {
+ timer_del(throttle_dirty_sync_timer);
+ qatomic_set(&throttle_dirty_sync_timer_active, 0);
+ }
+ }
+}
+
void cpu_throttle_init(void)
{
throttle_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL_RT,
cpu_throttle_timer_tick, NULL);
+ throttle_dirty_sync_timer =
+ timer_new_ms(QEMU_CLOCK_VIRTUAL_RT,
+ cpu_throttle_dirty_sync_timer_tick, NULL);
}
diff --git a/migration/cpu-throttle.h b/migration/cpu-throttle.h
index d65bdef6d0..420702b8d3 100644
--- a/migration/cpu-throttle.h
+++ b/migration/cpu-throttle.h
@@ -65,4 +65,18 @@ bool cpu_throttle_active(void);
*/
int cpu_throttle_get_percentage(void);
+/**
+ * cpu_throttle_dirty_sync_timer_tick:
+ *
+ * Dirty sync timer hook.
+ */
+void cpu_throttle_dirty_sync_timer_tick(void *opaque);
+
+/**
+ * cpu_throttle_dirty_sync_timer:
+ *
+ * Start or stop the dirty sync timer.
+ */
+void cpu_throttle_dirty_sync_timer(bool enable);
+
#endif /* SYSEMU_CPU_THROTTLE_H */
diff --git a/migration/migration.c b/migration/migration.c
index 2e10ca77af..f673e30069 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -3291,12 +3291,17 @@ static MigIterateState migration_iteration_run(MigrationState *s)
static void migration_iteration_finish(MigrationState *s)
{
- /* If we enabled cpu throttling for auto-converge, turn it off. */
+ bql_lock();
+
+ /*
+ * If we enabled cpu throttling for auto-converge, turn it off.
+ * Stopping CPU throttle should be serialized by BQL to avoid
+ * racing for the throttle_dirty_sync_timer.
+ */
if (migrate_auto_converge()) {
cpu_throttle_stop();
}
- bql_lock();
switch (s->state) {
case MIGRATION_STATUS_COMPLETED:
runstate_set(RUN_STATE_POSTMIGRATE);
@@ -3513,6 +3518,11 @@ static void *migration_thread(void *opaque)
qemu_savevm_send_colo_enable(s->to_dst_file);
}
+ if (migrate_auto_converge()) {
+ /* Start RAMBlock dirty bitmap sync timer */
+ cpu_throttle_dirty_sync_timer(true);
+ }
+
bql_lock();
ret = qemu_savevm_state_setup(s->to_dst_file, &local_err);
bql_unlock();
diff --git a/migration/migration.h b/migration/migration.h
index 38aa1402d5..fbd0d19092 100644
--- a/migration/migration.h
+++ b/migration/migration.h
@@ -537,4 +537,5 @@ int migration_rp_wait(MigrationState *s);
*/
void migration_rp_kick(MigrationState *s);
+void migration_bitmap_sync_precopy(bool last_stage);
#endif
diff --git a/migration/ram.c b/migration/ram.c
index 9b5b350405..d284f63854 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -1088,7 +1088,7 @@ static void migration_bitmap_sync(RAMState *rs, bool last_stage)
}
}
-static void migration_bitmap_sync_precopy(bool last_stage)
+void migration_bitmap_sync_precopy(bool last_stage)
{
Error *local_err = NULL;
assert(ram_state);
diff --git a/migration/trace-events b/migration/trace-events
index 9a19599804..0638183056 100644
--- a/migration/trace-events
+++ b/migration/trace-events
@@ -381,3 +381,4 @@ migration_pagecache_insert(void) "Error allocating page"
# cpu-throttle.c
cpu_throttle_set(int new_throttle_pct) "set guest CPU throttled by %d%%"
+cpu_throttle_dirty_sync(void) ""
--
2.27.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v4 6/6] tests/migration: Add case for periodic ramblock dirty sync
2024-10-17 6:42 [PATCH v4 0/6] migration: auto-converge refinements for huge VM yong.huang
` (4 preceding siblings ...)
2024-10-17 6:42 ` [PATCH v4 5/6] migration: Support periodic RAMBlock dirty bitmap sync yong.huang
@ 2024-10-17 6:42 ` yong.huang
2024-10-17 19:01 ` Fabiano Rosas
2024-10-18 15:08 ` [PATCH v4 0/6] migration: auto-converge refinements for huge VM Peter Xu
6 siblings, 1 reply; 16+ messages in thread
From: yong.huang @ 2024-10-17 6:42 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Xu, Fabiano Rosas, Richard Henderson, Paolo Bonzini,
yong.huang
From: Hyman Huang <yong.huang@smartx.com>
Signed-off-by: Hyman Huang <yong.huang@smartx.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
---
tests/qtest/migration-test.c | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c
index 95e45b5029..e6a2803e71 100644
--- a/tests/qtest/migration-test.c
+++ b/tests/qtest/migration-test.c
@@ -2791,6 +2791,8 @@ static void test_migrate_auto_converge(void)
* so we need to decrease a bandwidth.
*/
const int64_t init_pct = 5, inc_pct = 25, max_pct = 95;
+ uint64_t prev_dirty_sync_cnt, dirty_sync_cnt;
+ int max_try_count, hit = 0;
if (test_migrate_start(&from, &to, uri, &args)) {
return;
@@ -2827,6 +2829,36 @@ static void test_migrate_auto_converge(void)
} while (true);
/* The first percentage of throttling should be at least init_pct */
g_assert_cmpint(percentage, >=, init_pct);
+
+ /*
+ * End the loop when the dirty sync count greater than 1.
+ */
+ while ((dirty_sync_cnt = get_migration_pass(from)) < 2) {
+ usleep(1000 * 1000);
+ }
+
+ prev_dirty_sync_cnt = dirty_sync_cnt;
+
+ /*
+ * The RAMBlock dirty sync count must changes in 5 seconds, here we set
+ * the timeout to 10 seconds to ensure it changes.
+ *
+ * Note that migrate_ensure_non_converge set the max-bandwidth to 3MB/s,
+ * while the qtest mem is >= 100MB, one iteration takes at least 33s (100/3)
+ * to complete; this ensures that the RAMBlock dirty sync occurs.
+ */
+ max_try_count = 10;
+ while (--max_try_count) {
+ dirty_sync_cnt = get_migration_pass(from);
+ if (dirty_sync_cnt != prev_dirty_sync_cnt) {
+ hit = 1;
+ break;
+ }
+ prev_dirty_sync_cnt = dirty_sync_cnt;
+ sleep(1);
+ }
+ g_assert_cmpint(hit, ==, 1);
+
/* Now, when we tested that throttling works, let it converge */
migrate_ensure_converge(from);
--
2.27.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH v4 1/6] accel/tcg/icount-common: Remove the reference to the unused header file
2024-10-17 6:42 ` [PATCH v4 1/6] accel/tcg/icount-common: Remove the reference to the unused header file yong.huang
@ 2024-10-17 17:59 ` Fabiano Rosas
0 siblings, 0 replies; 16+ messages in thread
From: Fabiano Rosas @ 2024-10-17 17:59 UTC (permalink / raw)
To: yong.huang, qemu-devel
Cc: Peter Xu, Richard Henderson, Paolo Bonzini, yong.huang
yong.huang@smartx.com writes:
> From: Hyman Huang <yong.huang@smartx.com>
>
> Signed-off-by: Hyman Huang <yong.huang@smartx.com>
> ---
> accel/tcg/icount-common.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/accel/tcg/icount-common.c b/accel/tcg/icount-common.c
> index 8d3d3a7e9d..30bf8500dc 100644
> --- a/accel/tcg/icount-common.c
> +++ b/accel/tcg/icount-common.c
> @@ -36,7 +36,6 @@
> #include "sysemu/runstate.h"
> #include "hw/core/cpu.h"
> #include "sysemu/cpu-timers.h"
> -#include "sysemu/cpu-throttle.h"
> #include "sysemu/cpu-timers-internal.h"
>
> /*
Reviewed-by: Fabiano Rosas <farosas@suse.de>
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v4 2/6] migration: Stop CPU throttling conditionally
2024-10-17 6:42 ` [PATCH v4 2/6] migration: Stop CPU throttling conditionally yong.huang
@ 2024-10-17 18:02 ` Fabiano Rosas
0 siblings, 0 replies; 16+ messages in thread
From: Fabiano Rosas @ 2024-10-17 18:02 UTC (permalink / raw)
To: yong.huang, qemu-devel
Cc: Peter Xu, Richard Henderson, Paolo Bonzini, yong.huang
yong.huang@smartx.com writes:
> From: Hyman Huang <yong.huang@smartx.com>
>
> Since CPU throttling only occurs when auto-converge
> is on, stop it conditionally.
>
> Signed-off-by: Hyman Huang <yong.huang@smartx.com>
> ---
> migration/migration.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/migration/migration.c b/migration/migration.c
> index 021faee2f3..37a200a177 100644
> --- a/migration/migration.c
> +++ b/migration/migration.c
> @@ -3289,7 +3289,9 @@ static MigIterateState migration_iteration_run(MigrationState *s)
> static void migration_iteration_finish(MigrationState *s)
> {
> /* If we enabled cpu throttling for auto-converge, turn it off. */
> - cpu_throttle_stop();
> + if (migrate_auto_converge()) {
> + cpu_throttle_stop();
> + }
>
> bql_lock();
> switch (s->state) {
Reviewed-by: Fabiano Rosas <farosas@suse.de>
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v4 3/6] migration: Move cpu-throttole.c from system to migration
2024-10-17 6:42 ` [PATCH v4 3/6] migration: Move cpu-throttole.c from system to migration yong.huang
@ 2024-10-17 18:10 ` Fabiano Rosas
0 siblings, 0 replies; 16+ messages in thread
From: Fabiano Rosas @ 2024-10-17 18:10 UTC (permalink / raw)
To: yong.huang, qemu-devel
Cc: Peter Xu, Richard Henderson, Paolo Bonzini, yong.huang
yong.huang@smartx.com writes:
> From: Hyman Huang <yong.huang@smartx.com>
>
> Move cpu-throttle.c from system to migration since it's
> only used for migration; this makes us avoid exporting the
> util functions and variables in misc.h but export them in
> migration.h when implementing the periodic ramblock dirty
> sync feature in the upcoming commits.
>
> Since CPU throttle timers are only used in migration, move
> their registry to migration_object_init.
>
> Signed-off-by: Hyman Huang <yong.huang@smartx.com>
Reviewed-by: Fabiano Rosas <farosas@suse.de>
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v4 5/6] migration: Support periodic RAMBlock dirty bitmap sync
2024-10-17 6:42 ` [PATCH v4 5/6] migration: Support periodic RAMBlock dirty bitmap sync yong.huang
@ 2024-10-17 18:57 ` Fabiano Rosas
2024-10-17 19:33 ` Peter Xu
1 sibling, 0 replies; 16+ messages in thread
From: Fabiano Rosas @ 2024-10-17 18:57 UTC (permalink / raw)
To: yong.huang, qemu-devel
Cc: Peter Xu, Richard Henderson, Paolo Bonzini, yong.huang
yong.huang@smartx.com writes:
> From: Hyman Huang <yong.huang@smartx.com>
>
> When VM is configured with huge memory, the current throttle logic
> doesn't look like to scale, because migration_trigger_throttle()
> is only called for each iteration, so it won't be invoked for a long
> time if one iteration can take a long time.
>
> The periodic dirty sync aims to fix the above issue by synchronizing
> the ramblock from remote dirty bitmap and, when necessary, triggering
> the CPU throttle multiple times during a long iteration.
>
> This is a trade-off between synchronization overhead and CPU throttle
> impact.
>
> Signed-off-by: Hyman Huang <yong.huang@smartx.com>
Reviewed-by: Fabiano Rosas <farosas@suse.de>
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v4 6/6] tests/migration: Add case for periodic ramblock dirty sync
2024-10-17 6:42 ` [PATCH v4 6/6] tests/migration: Add case for periodic ramblock dirty sync yong.huang
@ 2024-10-17 19:01 ` Fabiano Rosas
0 siblings, 0 replies; 16+ messages in thread
From: Fabiano Rosas @ 2024-10-17 19:01 UTC (permalink / raw)
To: yong.huang, qemu-devel
Cc: Peter Xu, Richard Henderson, Paolo Bonzini, yong.huang
yong.huang@smartx.com writes:
> From: Hyman Huang <yong.huang@smartx.com>
>
> Signed-off-by: Hyman Huang <yong.huang@smartx.com>
> Reviewed-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Fabiano Rosas <farosas@suse.de>
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v4 5/6] migration: Support periodic RAMBlock dirty bitmap sync
2024-10-17 6:42 ` [PATCH v4 5/6] migration: Support periodic RAMBlock dirty bitmap sync yong.huang
2024-10-17 18:57 ` Fabiano Rosas
@ 2024-10-17 19:33 ` Peter Xu
2024-10-17 20:35 ` Fabiano Rosas
2024-10-18 1:55 ` Yong Huang
1 sibling, 2 replies; 16+ messages in thread
From: Peter Xu @ 2024-10-17 19:33 UTC (permalink / raw)
To: yong.huang, Fabiano Rosas
Cc: qemu-devel, Fabiano Rosas, Richard Henderson, Paolo Bonzini
On Thu, Oct 17, 2024 at 02:42:54PM +0800, yong.huang@smartx.com wrote:
> +void cpu_throttle_dirty_sync_timer_tick(void *opaque)
> +{
> + static uint64_t prev_sync_cnt;
We may need to reset this in case migration got cancelled and invoked
again, to make sure it keeps working in the 2nd run.
> + uint64_t sync_cnt = stat64_get(&mig_stats.dirty_sync_count);
> +
> + /*
> + * The first iteration copies all memory anyhow and has no
> + * effect on guest performance, therefore omit it to avoid
> + * paying extra for the sync penalty.
> + */
> + if (sync_cnt <= 1) {
> + goto end;
> + }
> +
> + if (sync_cnt == prev_sync_cnt) {
> + trace_cpu_throttle_dirty_sync();
> + WITH_RCU_READ_LOCK_GUARD() {
> + migration_bitmap_sync_precopy(false);
> + }
> + }
> +
> +end:
> + prev_sync_cnt = stat64_get(&mig_stats.dirty_sync_count);
> +
> + timer_mod(throttle_dirty_sync_timer,
> + qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL_RT) +
> + CPU_THROTTLE_DIRTY_SYNC_TIMESLICE_MS);
> +}
Please both of you have a look on whether you agree I squash below into
this patch when merge:
===8<===
From 84a2544eab73e35dbd35fed3b1440169915f9aa4 Mon Sep 17 00:00:00 2001
From: Peter Xu <peterx@redhat.com>
Date: Thu, 17 Oct 2024 15:27:19 -0400
Subject: [PATCH] fixup! migration: Support periodic RAMBlock dirty bitmap sync
Signed-off-by: Peter Xu <peterx@redhat.com>
---
migration/cpu-throttle.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/migration/cpu-throttle.c b/migration/cpu-throttle.c
index 342681cdd4..3df287d8d3 100644
--- a/migration/cpu-throttle.c
+++ b/migration/cpu-throttle.c
@@ -36,6 +36,7 @@
static QEMUTimer *throttle_timer, *throttle_dirty_sync_timer;
static unsigned int throttle_percentage;
static bool throttle_dirty_sync_timer_active;
+static uint64_t throttle_dirty_sync_count_prev;
#define CPU_THROTTLE_PCT_MIN 1
#define CPU_THROTTLE_PCT_MAX 99
@@ -133,7 +134,6 @@ int cpu_throttle_get_percentage(void)
void cpu_throttle_dirty_sync_timer_tick(void *opaque)
{
- static uint64_t prev_sync_cnt;
uint64_t sync_cnt = stat64_get(&mig_stats.dirty_sync_count);
/*
@@ -145,7 +145,7 @@ void cpu_throttle_dirty_sync_timer_tick(void *opaque)
goto end;
}
- if (sync_cnt == prev_sync_cnt) {
+ if (sync_cnt == throttle_dirty_sync_count_prev) {
trace_cpu_throttle_dirty_sync();
WITH_RCU_READ_LOCK_GUARD() {
migration_bitmap_sync_precopy(false);
@@ -153,7 +153,7 @@ void cpu_throttle_dirty_sync_timer_tick(void *opaque)
}
end:
- prev_sync_cnt = stat64_get(&mig_stats.dirty_sync_count);
+ throttle_dirty_sync_count_prev = stat64_get(&mig_stats.dirty_sync_count);
timer_mod(throttle_dirty_sync_timer,
qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL_RT) +
@@ -171,6 +171,11 @@ void cpu_throttle_dirty_sync_timer(bool enable)
if (enable) {
if (!cpu_throttle_dirty_sync_active()) {
+ /*
+ * Always reset the dirty sync count cache, in case migration
+ * was cancelled once.
+ */
+ throttle_dirty_sync_count_prev = 0;
timer_mod(throttle_dirty_sync_timer,
qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL_RT) +
CPU_THROTTLE_DIRTY_SYNC_TIMESLICE_MS);
--
2.45.0
--
Peter Xu
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH v4 5/6] migration: Support periodic RAMBlock dirty bitmap sync
2024-10-17 19:33 ` Peter Xu
@ 2024-10-17 20:35 ` Fabiano Rosas
2024-10-18 1:55 ` Yong Huang
1 sibling, 0 replies; 16+ messages in thread
From: Fabiano Rosas @ 2024-10-17 20:35 UTC (permalink / raw)
To: Peter Xu, yong.huang; +Cc: qemu-devel, Richard Henderson, Paolo Bonzini
Peter Xu <peterx@redhat.com> writes:
> On Thu, Oct 17, 2024 at 02:42:54PM +0800, yong.huang@smartx.com wrote:
>> +void cpu_throttle_dirty_sync_timer_tick(void *opaque)
>> +{
>> + static uint64_t prev_sync_cnt;
>
> We may need to reset this in case migration got cancelled and invoked
> again, to make sure it keeps working in the 2nd run.
>
>> + uint64_t sync_cnt = stat64_get(&mig_stats.dirty_sync_count);
>> +
>> + /*
>> + * The first iteration copies all memory anyhow and has no
>> + * effect on guest performance, therefore omit it to avoid
>> + * paying extra for the sync penalty.
>> + */
>> + if (sync_cnt <= 1) {
>> + goto end;
>> + }
>> +
>> + if (sync_cnt == prev_sync_cnt) {
>> + trace_cpu_throttle_dirty_sync();
>> + WITH_RCU_READ_LOCK_GUARD() {
>> + migration_bitmap_sync_precopy(false);
>> + }
>> + }
>> +
>> +end:
>> + prev_sync_cnt = stat64_get(&mig_stats.dirty_sync_count);
>> +
>> + timer_mod(throttle_dirty_sync_timer,
>> + qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL_RT) +
>> + CPU_THROTTLE_DIRTY_SYNC_TIMESLICE_MS);
>> +}
>
> Please both of you have a look on whether you agree I squash below into
> this patch when merge:
>
> ===8<===
> From 84a2544eab73e35dbd35fed3b1440169915f9aa4 Mon Sep 17 00:00:00 2001
> From: Peter Xu <peterx@redhat.com>
> Date: Thu, 17 Oct 2024 15:27:19 -0400
> Subject: [PATCH] fixup! migration: Support periodic RAMBlock dirty bitmap sync
>
> Signed-off-by: Peter Xu <peterx@redhat.com>
> ---
> migration/cpu-throttle.c | 11 ++++++++---
> 1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/migration/cpu-throttle.c b/migration/cpu-throttle.c
> index 342681cdd4..3df287d8d3 100644
> --- a/migration/cpu-throttle.c
> +++ b/migration/cpu-throttle.c
> @@ -36,6 +36,7 @@
> static QEMUTimer *throttle_timer, *throttle_dirty_sync_timer;
> static unsigned int throttle_percentage;
> static bool throttle_dirty_sync_timer_active;
> +static uint64_t throttle_dirty_sync_count_prev;
>
> #define CPU_THROTTLE_PCT_MIN 1
> #define CPU_THROTTLE_PCT_MAX 99
> @@ -133,7 +134,6 @@ int cpu_throttle_get_percentage(void)
>
> void cpu_throttle_dirty_sync_timer_tick(void *opaque)
> {
> - static uint64_t prev_sync_cnt;
> uint64_t sync_cnt = stat64_get(&mig_stats.dirty_sync_count);
>
> /*
> @@ -145,7 +145,7 @@ void cpu_throttle_dirty_sync_timer_tick(void *opaque)
> goto end;
> }
>
> - if (sync_cnt == prev_sync_cnt) {
> + if (sync_cnt == throttle_dirty_sync_count_prev) {
> trace_cpu_throttle_dirty_sync();
> WITH_RCU_READ_LOCK_GUARD() {
> migration_bitmap_sync_precopy(false);
> @@ -153,7 +153,7 @@ void cpu_throttle_dirty_sync_timer_tick(void *opaque)
> }
>
> end:
> - prev_sync_cnt = stat64_get(&mig_stats.dirty_sync_count);
> + throttle_dirty_sync_count_prev = stat64_get(&mig_stats.dirty_sync_count);
>
> timer_mod(throttle_dirty_sync_timer,
> qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL_RT) +
> @@ -171,6 +171,11 @@ void cpu_throttle_dirty_sync_timer(bool enable)
>
> if (enable) {
> if (!cpu_throttle_dirty_sync_active()) {
> + /*
> + * Always reset the dirty sync count cache, in case migration
> + * was cancelled once.
> + */
> + throttle_dirty_sync_count_prev = 0;
> timer_mod(throttle_dirty_sync_timer,
> qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL_RT) +
> CPU_THROTTLE_DIRTY_SYNC_TIMESLICE_MS);
> --
> 2.45.0
LGTM
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v4 5/6] migration: Support periodic RAMBlock dirty bitmap sync
2024-10-17 19:33 ` Peter Xu
2024-10-17 20:35 ` Fabiano Rosas
@ 2024-10-18 1:55 ` Yong Huang
1 sibling, 0 replies; 16+ messages in thread
From: Yong Huang @ 2024-10-18 1:55 UTC (permalink / raw)
To: Peter Xu; +Cc: Fabiano Rosas, qemu-devel, Richard Henderson, Paolo Bonzini
[-- Attachment #1: Type: text/plain, Size: 3886 bytes --]
On Fri, Oct 18, 2024 at 3:33 AM Peter Xu <peterx@redhat.com> wrote:
> On Thu, Oct 17, 2024 at 02:42:54PM +0800, yong.huang@smartx.com wrote:
> > +void cpu_throttle_dirty_sync_timer_tick(void *opaque)
> > +{
> > + static uint64_t prev_sync_cnt;
>
> We may need to reset this in case migration got cancelled and invoked
> again, to make sure it keeps working in the 2nd run.
>
> > + uint64_t sync_cnt = stat64_get(&mig_stats.dirty_sync_count);
> > +
> > + /*
> > + * The first iteration copies all memory anyhow and has no
> > + * effect on guest performance, therefore omit it to avoid
> > + * paying extra for the sync penalty.
> > + */
> > + if (sync_cnt <= 1) {
> > + goto end;
> > + }
> > +
> > + if (sync_cnt == prev_sync_cnt) {
> > + trace_cpu_throttle_dirty_sync();
> > + WITH_RCU_READ_LOCK_GUARD() {
> > + migration_bitmap_sync_precopy(false);
> > + }
> > + }
> > +
> > +end:
> > + prev_sync_cnt = stat64_get(&mig_stats.dirty_sync_count);
> > +
> > + timer_mod(throttle_dirty_sync_timer,
> > + qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL_RT) +
> > + CPU_THROTTLE_DIRTY_SYNC_TIMESLICE_MS);
> > +}
>
> Please both of you have a look on whether you agree I squash below into
> this patch when merge:
>
Thanks for the fixup, it looks good to me.
>
> ===8<===
> From 84a2544eab73e35dbd35fed3b1440169915f9aa4 Mon Sep 17 00:00:00 2001
> From: Peter Xu <peterx@redhat.com>
> Date: Thu, 17 Oct 2024 15:27:19 -0400
> Subject: [PATCH] fixup! migration: Support periodic RAMBlock dirty bitmap
> sync
>
> Signed-off-by: Peter Xu <peterx@redhat.com>
> ---
> migration/cpu-throttle.c | 11 ++++++++---
> 1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/migration/cpu-throttle.c b/migration/cpu-throttle.c
> index 342681cdd4..3df287d8d3 100644
> --- a/migration/cpu-throttle.c
> +++ b/migration/cpu-throttle.c
> @@ -36,6 +36,7 @@
> static QEMUTimer *throttle_timer, *throttle_dirty_sync_timer;
> static unsigned int throttle_percentage;
> static bool throttle_dirty_sync_timer_active;
> +static uint64_t throttle_dirty_sync_count_prev;
>
> #define CPU_THROTTLE_PCT_MIN 1
> #define CPU_THROTTLE_PCT_MAX 99
> @@ -133,7 +134,6 @@ int cpu_throttle_get_percentage(void)
>
> void cpu_throttle_dirty_sync_timer_tick(void *opaque)
> {
> - static uint64_t prev_sync_cnt;
> uint64_t sync_cnt = stat64_get(&mig_stats.dirty_sync_count);
>
> /*
> @@ -145,7 +145,7 @@ void cpu_throttle_dirty_sync_timer_tick(void *opaque)
> goto end;
> }
>
> - if (sync_cnt == prev_sync_cnt) {
> + if (sync_cnt == throttle_dirty_sync_count_prev) {
> trace_cpu_throttle_dirty_sync();
> WITH_RCU_READ_LOCK_GUARD() {
> migration_bitmap_sync_precopy(false);
> @@ -153,7 +153,7 @@ void cpu_throttle_dirty_sync_timer_tick(void *opaque)
> }
>
> end:
> - prev_sync_cnt = stat64_get(&mig_stats.dirty_sync_count);
> + throttle_dirty_sync_count_prev =
> stat64_get(&mig_stats.dirty_sync_count);
>
> timer_mod(throttle_dirty_sync_timer,
> qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL_RT) +
> @@ -171,6 +171,11 @@ void cpu_throttle_dirty_sync_timer(bool enable)
>
> if (enable) {
> if (!cpu_throttle_dirty_sync_active()) {
> + /*
> + * Always reset the dirty sync count cache, in case migration
> + * was cancelled once.
> + */
> + throttle_dirty_sync_count_prev = 0;
> timer_mod(throttle_dirty_sync_timer,
> qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL_RT) +
> CPU_THROTTLE_DIRTY_SYNC_TIMESLICE_MS);
> --
> 2.45.0
>
> --
> Peter Xu
>
>
Acked-by: Hyman Huang <yong.huang@smartx.com>
--
Best regards
[-- Attachment #2: Type: text/html, Size: 5635 bytes --]
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v4 0/6] migration: auto-converge refinements for huge VM
2024-10-17 6:42 [PATCH v4 0/6] migration: auto-converge refinements for huge VM yong.huang
` (5 preceding siblings ...)
2024-10-17 6:42 ` [PATCH v4 6/6] tests/migration: Add case for periodic ramblock dirty sync yong.huang
@ 2024-10-18 15:08 ` Peter Xu
6 siblings, 0 replies; 16+ messages in thread
From: Peter Xu @ 2024-10-18 15:08 UTC (permalink / raw)
To: yong.huang; +Cc: qemu-devel, Fabiano Rosas, Richard Henderson, Paolo Bonzini
On Thu, Oct 17, 2024 at 02:42:49PM +0800, yong.huang@smartx.com wrote:
> From: Hyman Huang <yong.huang@smartx.com>
>
> v4:
> 1. split the [PATCH v3 1/6] into smaller patches.
> 2. refine some comment and commit message
> 3. fix race issue for the throttle_dirty_sync_timer
> 4. refine the util function cpu_throttle_dirty_sync_timer
queued, with a fixup squashed to patch 5 per discussion, thanks.
--
Peter Xu
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2024-10-18 15:09 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-17 6:42 [PATCH v4 0/6] migration: auto-converge refinements for huge VM yong.huang
2024-10-17 6:42 ` [PATCH v4 1/6] accel/tcg/icount-common: Remove the reference to the unused header file yong.huang
2024-10-17 17:59 ` Fabiano Rosas
2024-10-17 6:42 ` [PATCH v4 2/6] migration: Stop CPU throttling conditionally yong.huang
2024-10-17 18:02 ` Fabiano Rosas
2024-10-17 6:42 ` [PATCH v4 3/6] migration: Move cpu-throttole.c from system to migration yong.huang
2024-10-17 18:10 ` Fabiano Rosas
2024-10-17 6:42 ` [PATCH v4 4/6] migration: Remove "rs" parameter in migration_bitmap_sync_precopy yong.huang
2024-10-17 6:42 ` [PATCH v4 5/6] migration: Support periodic RAMBlock dirty bitmap sync yong.huang
2024-10-17 18:57 ` Fabiano Rosas
2024-10-17 19:33 ` Peter Xu
2024-10-17 20:35 ` Fabiano Rosas
2024-10-18 1:55 ` Yong Huang
2024-10-17 6:42 ` [PATCH v4 6/6] tests/migration: Add case for periodic ramblock dirty sync yong.huang
2024-10-17 19:01 ` Fabiano Rosas
2024-10-18 15:08 ` [PATCH v4 0/6] migration: auto-converge refinements for huge VM Peter Xu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).