|
@@ -2862,18 +2862,32 @@ static void migration_bitmap_clear_discarded_pages(RAMState *rs)
|
|
|
|
|
|
static void ram_init_bitmaps(RAMState *rs)
|
|
|
{
|
|
|
+ Error *local_err = NULL;
|
|
|
+ bool ret = true;
|
|
|
+
|
|
|
qemu_mutex_lock_ramlist();
|
|
|
|
|
|
WITH_RCU_READ_LOCK_GUARD() {
|
|
|
ram_list_init_bitmaps();
|
|
|
/* We don't use dirty log with background snapshots */
|
|
|
if (!migrate_background_snapshot()) {
|
|
|
- memory_global_dirty_log_start(GLOBAL_DIRTY_MIGRATION);
|
|
|
+ ret = memory_global_dirty_log_start(GLOBAL_DIRTY_MIGRATION,
|
|
|
+ &local_err);
|
|
|
+ if (!ret) {
|
|
|
+ error_report_err(local_err);
|
|
|
+ goto out_unlock;
|
|
|
+ }
|
|
|
migration_bitmap_sync_precopy(rs, false);
|
|
|
}
|
|
|
}
|
|
|
+out_unlock:
|
|
|
qemu_mutex_unlock_ramlist();
|
|
|
|
|
|
+ if (!ret) {
|
|
|
+ ram_bitmaps_destroy();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
/*
|
|
|
* After an eventual first bitmap sync, fixup the initial bitmap
|
|
|
* containing all 1s to exclude any discarded pages from migration.
|
|
@@ -3665,6 +3679,8 @@ int colo_init_ram_cache(void)
|
|
|
void colo_incoming_start_dirty_log(void)
|
|
|
{
|
|
|
RAMBlock *block = NULL;
|
|
|
+ Error *local_err = NULL;
|
|
|
+
|
|
|
/* For memory_global_dirty_log_start below. */
|
|
|
bql_lock();
|
|
|
qemu_mutex_lock_ramlist();
|
|
@@ -3676,7 +3692,10 @@ void colo_incoming_start_dirty_log(void)
|
|
|
/* Discard this dirty bitmap record */
|
|
|
bitmap_zero(block->bmap, block->max_length >> TARGET_PAGE_BITS);
|
|
|
}
|
|
|
- memory_global_dirty_log_start(GLOBAL_DIRTY_MIGRATION);
|
|
|
+ if (!memory_global_dirty_log_start(GLOBAL_DIRTY_MIGRATION,
|
|
|
+ &local_err)) {
|
|
|
+ error_report_err(local_err);
|
|
|
+ }
|
|
|
}
|
|
|
ram_state->migration_dirty_pages = 0;
|
|
|
qemu_mutex_unlock_ramlist();
|