[PATCH v1 3/4] migration/debug: add checkpoint for migration consistency check

Chuan Zheng posted 4 patches 5 years ago
Maintainers: "Dr. David Alan Gilbert" <dgilbert@redhat.com>, Juan Quintela <quintela@redhat.com>
[PATCH v1 3/4] migration/debug: add checkpoint for migration consistency check
Posted by Chuan Zheng 5 years ago
Signed-off-by: Chuan Zheng <zhengchuan@huawei.com>
---
 migration/migration.c | 1 +
 migration/savevm.c    | 7 +++++++
 2 files changed, 8 insertions(+)

diff --git a/migration/migration.c b/migration/migration.c
index 0575ecb..f4434c4 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -1678,6 +1678,7 @@ static void migrate_fd_cleanup(MigrationState *s)
         tmp = s->to_dst_file;
         s->to_dst_file = NULL;
         qemu_mutex_unlock(&s->qemu_file_lock);
+        MIGRATION_RAM_CONSISTENCY_CHECK();
         /*
          * Close the file handle without the lock to make sure the
          * critical section won't block for long.
diff --git a/migration/savevm.c b/migration/savevm.c
index ff33e21..5f989a8 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -2636,6 +2636,13 @@ int qemu_loadvm_state(QEMUFile *f)
     }
 
     qemu_loadvm_state_cleanup();
+    /*
+     * cpu_synchronize_all_post_init->kvm_put_msrs will update the
+     * kvmclock share-mem.
+     * So this's the latest point at which the ram is the same as source
+     */
+    MIGRATION_RAM_CONSISTENCY_CHECK();
+
     cpu_synchronize_all_post_init();
 
     return ret;
-- 
1.8.3.1