aboutsummaryrefslogtreecommitdiff
path: root/migration
diff options
context:
space:
mode:
Diffstat (limited to 'migration')
-rw-r--r--migration/postcopy-ram.c2
-rw-r--r--migration/savevm.c17
2 files changed, 14 insertions, 5 deletions
diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c
index d3bb3a7..d99842e 100644
--- a/migration/postcopy-ram.c
+++ b/migration/postcopy-ram.c
@@ -903,7 +903,6 @@ static void *postcopy_ram_fault_thread(void *opaque)
* the channel is rebuilt.
*/
if (postcopy_pause_fault_thread(mis)) {
- mis->last_rb = NULL;
/* Continue to read the userfaultfd */
} else {
error_report("%s: paused but don't allow to continue",
@@ -985,7 +984,6 @@ retry:
/* May be network failure, try to wait for recovery */
if (ret == -EIO && postcopy_pause_fault_thread(mis)) {
/* We got reconnected somehow, try to continue */
- mis->last_rb = NULL;
goto retry;
} else {
/* This is a unavoidable fault */
diff --git a/migration/savevm.c b/migration/savevm.c
index 21ccba9..5f937a2 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -2062,13 +2062,16 @@ static int loadvm_postcopy_handle_resume(MigrationIncomingState *mis)
}
/*
+ * Reset the last_rb before we resend any page req to source again, since
+ * the source should have it reset already.
+ */
+ mis->last_rb = NULL;
+
+ /*
* This means source VM is ready to resume the postcopy migration.
- * It's time to switch state and release the fault thread to
- * continue service page faults.
*/
migrate_set_state(&mis->state, MIGRATION_STATUS_POSTCOPY_RECOVER,
MIGRATION_STATUS_POSTCOPY_ACTIVE);
- qemu_sem_post(&mis->postcopy_pause_sem_fault);
trace_loadvm_postcopy_handle_resume();
@@ -2089,6 +2092,14 @@ static int loadvm_postcopy_handle_resume(MigrationIncomingState *mis)
*/
migrate_send_rp_req_pages_pending(mis);
+ /*
+ * It's time to switch state and release the fault thread to continue
+ * service page faults. Note that this should be explicitly after the
+ * above call to migrate_send_rp_req_pages_pending(). In short:
+ * migrate_send_rp_message_req_pages() is not thread safe, yet.
+ */
+ qemu_sem_post(&mis->postcopy_pause_sem_fault);
+
return 0;
}