[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH RFCv1 3/8] migration: Add last stage indicator to global dirty lo
From: |
Gavin Shan |
Subject: |
[PATCH RFCv1 3/8] migration: Add last stage indicator to global dirty log synchronization |
Date: |
Mon, 6 Feb 2023 19:20:05 +0800 |
For the pre-copy live migration scenario, the last stage indicator
is needed for KVM backend to collect the dirty pages from the backup
bitmap when dirty ring is used. The indicator isn't used so far.
No functional change intended.
Signed-off-by: Gavin Shan <gshan@redhat.com>
---
migration/ram.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/migration/ram.c b/migration/ram.c
index d1b9b270ec..6c9642edee 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -1176,7 +1176,7 @@ static void migration_trigger_throttle(RAMState *rs)
}
}
-static void migration_bitmap_sync(RAMState *rs)
+static void migration_bitmap_sync(RAMState *rs, bool last_stage)
{
RAMBlock *block;
int64_t end_time;
@@ -1188,7 +1188,7 @@ static void migration_bitmap_sync(RAMState *rs)
}
trace_migration_bitmap_sync_start();
- memory_global_dirty_log_sync(false);
+ memory_global_dirty_log_sync(last_stage);
qemu_mutex_lock(&rs->bitmap_mutex);
WITH_RCU_READ_LOCK_GUARD() {
@@ -1222,7 +1222,7 @@ static void migration_bitmap_sync(RAMState *rs)
}
}
-static void migration_bitmap_sync_precopy(RAMState *rs)
+static void migration_bitmap_sync_precopy(RAMState *rs, bool last_stage)
{
Error *local_err = NULL;
@@ -1235,7 +1235,7 @@ static void migration_bitmap_sync_precopy(RAMState *rs)
local_err = NULL;
}
- migration_bitmap_sync(rs);
+ migration_bitmap_sync(rs, last_stage);
if (precopy_notify(PRECOPY_NOTIFY_AFTER_BITMAP_SYNC, &local_err)) {
error_report_err(local_err);
@@ -2844,7 +2844,7 @@ void ram_postcopy_send_discard_bitmap(MigrationState *ms)
RCU_READ_LOCK_GUARD();
/* This should be our last sync, the src is now paused */
- migration_bitmap_sync(rs);
+ migration_bitmap_sync(rs, false);
/* Easiest way to make sure we don't resume in the middle of a host-page */
rs->pss[RAM_CHANNEL_PRECOPY].last_sent_block = NULL;
@@ -3034,7 +3034,7 @@ static void ram_init_bitmaps(RAMState *rs)
/* We don't use dirty log with background snapshots */
if (!migrate_background_snapshot()) {
memory_global_dirty_log_start(GLOBAL_DIRTY_MIGRATION);
- migration_bitmap_sync_precopy(rs);
+ migration_bitmap_sync_precopy(rs, false);
}
}
qemu_mutex_unlock_ramlist();
@@ -3349,7 +3349,7 @@ static int ram_save_complete(QEMUFile *f, void *opaque)
WITH_RCU_READ_LOCK_GUARD() {
if (!migration_in_postcopy()) {
- migration_bitmap_sync_precopy(rs);
+ migration_bitmap_sync_precopy(rs, true);
}
ram_control_before_iterate(f, RAM_CONTROL_FINISH);
@@ -3407,7 +3407,7 @@ static void ram_save_pending(QEMUFile *f, void *opaque,
uint64_t max_size,
remaining_size < max_size) {
qemu_mutex_lock_iothread();
WITH_RCU_READ_LOCK_GUARD() {
- migration_bitmap_sync_precopy(rs);
+ migration_bitmap_sync_precopy(rs, false);
}
qemu_mutex_unlock_iothread();
remaining_size = rs->migration_dirty_pages * TARGET_PAGE_SIZE;
--
2.23.0
- [PATCH RFCv1 0/8] hw/arm/virt: Support dirty ring, Gavin Shan, 2023/02/06
- [PATCH RFCv1 1/8] linux-headers: Update for dirty ring, Gavin Shan, 2023/02/06
- [PATCH RFCv1 2/8] memory: Add last stage indicator to global dirty log synchronization, Gavin Shan, 2023/02/06
- [PATCH RFCv1 3/8] migration: Add last stage indicator to global dirty log synchronization,
Gavin Shan <=
- [PATCH RFCv1 4/8] kvm: Introduce secondary dirty bitmap, Gavin Shan, 2023/02/06
- [PATCH RFCv1 8/8] kvm: Enable dirty ring for arm64, Gavin Shan, 2023/02/06
- [PATCH RFCv1 6/8] kvm: Add helper kvm_dirty_ring_init(), Gavin Shan, 2023/02/06
- [PATCH RFCv1 5/8] kvm: Synchronize secondary bitmap in last stage, Gavin Shan, 2023/02/06
- [PATCH RFCv1 7/8] hw/arm/virt: Enable backup bitmap for dirty ring, Gavin Shan, 2023/02/06