@@ -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;
@@ -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();