[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 02/12] migration: Postpone the kick of the fault thread after reco
From: |
Dr. David Alan Gilbert (git) |
Subject: |
[PULL 02/12] migration: Postpone the kick of the fault thread after recover |
Date: |
Mon, 2 Nov 2020 19:56:47 +0000 |
From: Peter Xu <peterx@redhat.com>
The new migrate_send_rp_req_pages_pending() call should greatly improve
destination responsiveness because it will resync faulted address after
postcopy recovery. However it is also the 1st place to initiate the page
request from the main thread.
One thing is overlooked on that migrate_send_rp_message_req_pages() is not
designed to be thread-safe. So if we wake the fault thread before syncing all
the faulted pages in the main thread, it means they can race.
Postpone the wake up operation after the sync of faulted addresses.
Fixes: 0c26781c09 ("migration: Sync requested pages after postcopy recovery")
Tested-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
Message-Id: <20201102153010.11979-3-peterx@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
migration/savevm.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/migration/savevm.c b/migration/savevm.c
index e8834991ec..5f937a2762 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -2069,12 +2069,9 @@ static int
loadvm_postcopy_handle_resume(MigrationIncomingState *mis)
/*
* 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();
@@ -2095,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;
}
--
2.28.0
- [PULL 00/12] migration queue, Dr. David Alan Gilbert (git), 2020/11/02
- [PULL 02/12] migration: Postpone the kick of the fault thread after recover,
Dr. David Alan Gilbert (git) <=
- [PULL 03/12] virtiofsd: Seccomp: Add 'send' for syslog, Dr. David Alan Gilbert (git), 2020/11/02
- [PULL 01/12] migration: Unify reset of last_rb on destination node when recover, Dr. David Alan Gilbert (git), 2020/11/02
- [PULL 05/12] virtiofsd: Fix the help message of posix lock, Dr. David Alan Gilbert (git), 2020/11/02
- [PULL 04/12] tools/virtiofsd: Check vu_init() return value (CID 1435958), Dr. David Alan Gilbert (git), 2020/11/02
- [PULL 06/12] virtiofsd: Check FUSE_SUBMOUNTS, Dr. David Alan Gilbert (git), 2020/11/02
- [PULL 07/12] virtiofsd: Add attr_flags to fuse_entry_param, Dr. David Alan Gilbert (git), 2020/11/02
- [PULL 08/12] meson.build: Check for statx(), Dr. David Alan Gilbert (git), 2020/11/02
- [PULL 09/12] virtiofsd: Add mount ID to the lo_inode key, Dr. David Alan Gilbert (git), 2020/11/02
- [PULL 10/12] virtiofsd: Announce sub-mount points, Dr. David Alan Gilbert (git), 2020/11/02