From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54093) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z4o6f-0008Na-MD for qemu-devel@nongnu.org; Tue, 16 Jun 2015 06:28:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z4o6d-0001SS-FL for qemu-devel@nongnu.org; Tue, 16 Jun 2015 06:28:37 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36610) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z4o6d-0001SH-Ay for qemu-devel@nongnu.org; Tue, 16 Jun 2015 06:28:35 -0400 From: "Dr. David Alan Gilbert (git)" Date: Tue, 16 Jun 2015 11:26:52 +0100 Message-Id: <1434450415-11339-40-git-send-email-dgilbert@redhat.com> In-Reply-To: <1434450415-11339-1-git-send-email-dgilbert@redhat.com> References: <1434450415-11339-1-git-send-email-dgilbert@redhat.com> Subject: [Qemu-devel] [PATCH v7 39/42] postcopy: Wire up loadvm_postcopy_handle_ commands List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: aarcange@redhat.com, yamahata@private.email.ne.jp, quintela@redhat.com, liang.z.li@intel.com, luis@cs.umu.se, amit.shah@redhat.com, pbonzini@redhat.com, david@gibson.dropbear.id.au From: "Dr. David Alan Gilbert" Wire up more of the handlers for the commands on the destination side, in particular loadvm_postcopy_handle_run now has enough to start the guest running. Signed-off-by: Dr. David Alan Gilbert --- migration/savevm.c | 29 ++++++++++++++++++++++++++++- trace-events | 2 ++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/migration/savevm.c b/migration/savevm.c index 258c551..13dd6de 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -1413,12 +1413,34 @@ static int loadvm_postcopy_handle_listen(MigrationIncomingState *mis) static int loadvm_postcopy_handle_run(MigrationIncomingState *mis) { PostcopyState ps = postcopy_state_set(mis, POSTCOPY_INCOMING_RUNNING); + Error *local_err = NULL; + trace_loadvm_postcopy_handle_run(); if (ps != POSTCOPY_INCOMING_LISTENING) { error_report("CMD_POSTCOPY_RUN in wrong postcopy state (%d)", ps); return -1; } + /* TODO we should move all of this lot into postcopy_ram.c or a shared code + * in migration.c + */ + cpu_synchronize_all_post_init(); + + qemu_announce_self(); + + /* Make sure all file formats flush their mutable metadata */ + bdrv_invalidate_cache_all(&local_err); + if (local_err) { + qerror_report_err(local_err); + error_free(local_err); + return -1; + } + + trace_loadvm_postcopy_handle_run_cpu_sync(); + cpu_synchronize_all_post_init(); + + trace_loadvm_postcopy_handle_run_vmstart(); + if (autostart) { /* Hold onto your hats, starting the CPU */ vm_start(); @@ -1427,7 +1449,12 @@ static int loadvm_postcopy_handle_run(MigrationIncomingState *mis) runstate_set(RUN_STATE_PAUSED); } - return 0; + /* We need to finish reading the stream from the package + * and also stop reading anything more from the stream that loaded the + * package (since it's now being read by the listener thread). + * LOADVM_QUIT will quit all the layers of nested loadvm loops. + */ + return LOADVM_QUIT; } static int loadvm_process_command_simple_lencheck(const char *name, diff --git a/trace-events b/trace-events index a6c7839..6e9b32a 100644 --- a/trace-events +++ b/trace-events @@ -1194,6 +1194,8 @@ loadvm_handle_cmd_packaged_received(int ret) "%d" loadvm_postcopy_handle_advise(void) "" loadvm_postcopy_handle_listen(void) "" loadvm_postcopy_handle_run(void) "" +loadvm_postcopy_handle_run_cpu_sync(void) "" +loadvm_postcopy_handle_run_vmstart(void) "" loadvm_postcopy_ram_handle_discard(void) "" loadvm_postcopy_ram_handle_discard_end(void) "" loadvm_postcopy_ram_handle_discard_header(const char *ramid, uint16_t len) "%s: %ud" -- 2.4.3