qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [RFC PATCH 3/4] migration: snapshot thread


From: Christian Pinto
Subject: [Qemu-devel] [RFC PATCH 3/4] migration: snapshot thread
Date: Thu, 9 Mar 2017 12:34:36 +0100

VM execution was resumed while migration was still in setup.
This was causing a bus error because the userfault thread was
waking up VM too early during migration setup.

Signed-off-by: Christian Pinto <address@hidden>
Signed-off-by: Baptiste Reynal <address@hidden>
---
 migration/migration.c    |  9 +++++----
 migration/postcopy-ram.c | 14 --------------
 2 files changed, 5 insertions(+), 18 deletions(-)

diff --git a/migration/migration.c b/migration/migration.c
index f6d68ca020..19e8da1f84 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -1894,15 +1894,16 @@ static void *snapshot_thread(void *opaque)
     postcopy_ram_enable_notify(&ms->userfault_state, UFFDIO_REGISTER_MODE_WP);
     buffer = qemu_save_device_buffer();
 
+    migrate_set_state(&ms->state, MIGRATION_STATUS_SETUP,
+            MIGRATION_STATUS_ACTIVE);
+
+    trace_snapshot_thread_setup_complete();
+
     if (old_vm_running) {
         vm_start();
     }
     qemu_mutex_unlock_iothread();
 
-    migrate_set_state(&ms->state, MIGRATION_STATUS_SETUP, 
MIGRATION_STATUS_ACTIVE);
-
-    trace_snapshot_thread_setup_complete();
-
     while (qemu_file_get_error(ms->to_dst_file) == 0) {
         if (qemu_savevm_state_iterate(ms->to_dst_file, false) > 0) {
             break;
diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c
index 97382067b3..6252eb379a 100644
--- a/migration/postcopy-ram.c
+++ b/migration/postcopy-ram.c
@@ -551,20 +551,6 @@ static void *postcopy_ram_fault_thread(void *opaque)
                 break;
             }
 
-            /* Note: In the setup process, snapshot_thread may modify VM's
-            * write-protected pages, we should not block it there, or there
-            * will be an deadlock error.
-            */
-            if (migration_in_setup(ms)) {
-                ram_addr_t host = msg.arg.pagefault.address;
-
-                host &= ~(hostpagesize - 1);
-                ret = ram_set_pages_wp(host, hostpagesize, true,
-                                       us->userfault_fd);
-                if (ret < 0) {
-                    error_report("Remove page's write-protect failed");
-                }
-            }
         }
     }
     trace_postcopy_ram_fault_thread_exit();
-- 
2.11.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]