[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 30/43] mig fd_connect: open return path
From: |
Dr. David Alan Gilbert (git) |
Subject: |
[Qemu-devel] [PATCH v2 30/43] mig fd_connect: open return path |
Date: |
Mon, 11 Aug 2014 15:29:46 +0100 |
From: "Dr. David Alan Gilbert" <address@hidden>
Open the return path before migration thread creation.
Since this can fail, guard the fd cleanup so it doesn't
try and destroy the potentially non-existent thread.
Signed-off-by: Dr. David Alan Gilbert <address@hidden>
---
include/migration/migration.h | 3 +++
migration.c | 18 +++++++++++++++++-
2 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/include/migration/migration.h b/include/migration/migration.h
index 12a54e5..21aa8e3 100644
--- a/include/migration/migration.h
+++ b/include/migration/migration.h
@@ -122,6 +122,9 @@ struct MigrationState
/* Flag set once the migration has been asked to enter postcopy */
volatile bool start_postcopy;
+ /* Flag set once the migration thread is running (and needs joining) */
+ volatile bool started_migration_thread;
+
};
void process_incoming_migration(QEMUFile *f);
diff --git a/migration.c b/migration.c
index 472fc4d..9637941 100644
--- a/migration.c
+++ b/migration.c
@@ -470,7 +470,10 @@ static void migrate_fd_cleanup(void *opaque)
if (s->file) {
trace_migrate_fd_cleanup();
qemu_mutex_unlock_iothread();
- qemu_thread_join(&s->thread);
+ if (s->started_migration_thread) {
+ qemu_thread_join(&s->thread);
+ s->started_migration_thread = false;
+ }
qemu_mutex_lock_iothread();
qemu_fclose(s->file);
@@ -1162,6 +1165,19 @@ void migrate_fd_connect(MigrationState *s)
/* Notify before starting migration thread */
notifier_list_notify(&migration_state_notifiers, s);
+ /* Open the return path; currently for postcopy but other things might
+ * also want it.
+ */
+ if (migrate_postcopy_ram()) {
+ if (open_outgoing_return_path(s)) {
+ error_report("Unable to open return-path for postcopy");
+ migrate_set_state(s, MIG_STATE_SETUP, MIG_STATE_ERROR);
+ migrate_fd_cleanup(s);
+ return;
+ }
+ }
+
qemu_thread_create(&s->thread, "migration", migration_thread, s,
QEMU_THREAD_JOINABLE);
+ s->started_migration_thread = true;
}
--
1.9.3
- [Qemu-devel] [PATCH v2 20/43] migrate_start_postcopy: Command to trigger transition to postcopy, (continued)
- [Qemu-devel] [PATCH v2 20/43] migrate_start_postcopy: Command to trigger transition to postcopy, Dr. David Alan Gilbert (git), 2014/08/11
- [Qemu-devel] [PATCH v2 22/43] qemu_savevm_state_complete: Postcopy changes, Dr. David Alan Gilbert (git), 2014/08/11
- [Qemu-devel] [PATCH v2 24/43] Postcopy page-map-incoming (PMI) structure, Dr. David Alan Gilbert (git), 2014/08/11
- [Qemu-devel] [PATCH v2 21/43] MIG_STATE_POSTCOPY_ACTIVE: Add new migration state, Dr. David Alan Gilbert (git), 2014/08/11
- [Qemu-devel] [PATCH v2 25/43] postcopy: Add incoming_init/cleanup functions, Dr. David Alan Gilbert (git), 2014/08/11
- [Qemu-devel] [PATCH v2 23/43] Postcopy: Maintain sentmap during postcopy pre phase, Dr. David Alan Gilbert (git), 2014/08/11
- [Qemu-devel] [PATCH v2 27/43] postcopy: ram_enable_notify to switch on userfault, Dr. David Alan Gilbert (git), 2014/08/11
- [Qemu-devel] [PATCH v2 26/43] postcopy: Incoming initialisation, Dr. David Alan Gilbert (git), 2014/08/11
- [Qemu-devel] [PATCH v2 28/43] Postcopy: postcopy_start, Dr. David Alan Gilbert (git), 2014/08/11
- [Qemu-devel] [PATCH v2 29/43] Postcopy: Rework migration thread for postcopy mode, Dr. David Alan Gilbert (git), 2014/08/11
- [Qemu-devel] [PATCH v2 30/43] mig fd_connect: open return path,
Dr. David Alan Gilbert (git) <=
- [Qemu-devel] [PATCH v2 31/43] Postcopy: Create a fault handler thread before marking the ram as userfault, Dr. David Alan Gilbert (git), 2014/08/11
- [Qemu-devel] [PATCH v2 33/43] Page request: Process incoming page request, Dr. David Alan Gilbert (git), 2014/08/11
- [Qemu-devel] [PATCH v2 34/43] Page request: Consume pages off the post-copy queue, Dr. David Alan Gilbert (git), 2014/08/11
- [Qemu-devel] [PATCH v2 36/43] postcopy_ram.c: place_page and helpers, Dr. David Alan Gilbert (git), 2014/08/11
- [Qemu-devel] [PATCH v2 35/43] Add assertion to check migration_dirty_pages, Dr. David Alan Gilbert (git), 2014/08/11
- [Qemu-devel] [PATCH v2 38/43] qemu_ram_block_from_host, Dr. David Alan Gilbert (git), 2014/08/11
- [Qemu-devel] [PATCH v2 37/43] Postcopy: Use helpers to map pages during migration, Dr. David Alan Gilbert (git), 2014/08/11
- [Qemu-devel] [PATCH v2 40/43] Start up a postcopy/listener thread ready for incoming page data, Dr. David Alan Gilbert (git), 2014/08/11
- [Qemu-devel] [PATCH v2 41/43] postcopy: Wire up loadvm_postcopy_ram_handle_{run, end} commands, Dr. David Alan Gilbert (git), 2014/08/11
- [Qemu-devel] [PATCH v2 39/43] Postcopy; Handle userfault requests, Dr. David Alan Gilbert (git), 2014/08/11