From patchwork Wed Feb 25 16:52:06 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Dr. David Alan Gilbert" X-Patchwork-Id: 443544 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3A1BF14007D for ; Thu, 26 Feb 2015 04:16:43 +1100 (AEDT) Received: from localhost ([::1]:55314 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YQfZh-0001rc-As for incoming@patchwork.ozlabs.org; Wed, 25 Feb 2015 12:16:41 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35114) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YQfDm-0002LM-4T for qemu-devel@nongnu.org; Wed, 25 Feb 2015 11:54:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YQfDk-0001UK-JU for qemu-devel@nongnu.org; Wed, 25 Feb 2015 11:54:02 -0500 Received: from mx1.redhat.com ([209.132.183.28]:55312) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YQfDk-0001U2-Ae for qemu-devel@nongnu.org; Wed, 25 Feb 2015 11:54:00 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t1PGrsPm009958 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 25 Feb 2015 11:53:54 -0500 Received: from dgilbert-t530.redhat.com (ovpn-116-97.ams2.redhat.com [10.36.116.97]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t1PGq8la032146; Wed, 25 Feb 2015 11:53:52 -0500 From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org Date: Wed, 25 Feb 2015 16:52:06 +0000 Message-Id: <1424883128-9841-44-git-send-email-dgilbert@redhat.com> In-Reply-To: <1424883128-9841-1-git-send-email-dgilbert@redhat.com> References: <1424883128-9841-1-git-send-email-dgilbert@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: aarcange@redhat.com, yamahata@private.email.ne.jp, quintela@redhat.com, amit.shah@redhat.com, pbonzini@redhat.com, yanghy@cn.fujitsu.com, david@gibson.dropbear.id.au Subject: [Qemu-devel] [PATCH v5 43/45] End of migration for postcopy X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: "Dr. David Alan Gilbert" Tweak the end of migration cleanup; we don't want to close stuff down at the end of the main stream, since the postcopy is still sending pages on the other thread. Signed-off-by: Dr. David Alan Gilbert --- migration/migration.c | 25 ++++++++++++++++++++++++- trace-events | 2 ++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/migration/migration.c b/migration/migration.c index 97b86cc..a137444 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -199,12 +199,35 @@ static void process_incoming_migration_co(void *opaque) { QEMUFile *f = opaque; Error *local_err = NULL; + MigrationIncomingState *mis; + PostcopyState ps; int ret; - migration_incoming_state_new(f); + mis = migration_incoming_state_new(f); ret = qemu_loadvm_state(f); + ps = postcopy_state_get(mis); + trace_process_incoming_migration_co_end(ret, ps); + if (ps != POSTCOPY_INCOMING_NONE) { + if (ps == POSTCOPY_INCOMING_ADVISE) { + /* + * Where a migration had postcopy enabled (and thus went to advise) + * but managed to complete within the precopy period, we can use + * the normal exit. + */ + postcopy_ram_incoming_cleanup(mis); + } else if (ret >= 0) { + /* + * Postcopy was started, cleanup should happen at the end of the + * postcopy thread. + */ + trace_process_incoming_migration_co_postcopy_end_main(); + return; + } + /* Else if something went wrong then just fall out of the normal exit */ + } + qemu_fclose(f); free_xbzrle_decoded_buf(); migration_incoming_state_destroy(); diff --git a/trace-events b/trace-events index 869988b..cbf4f88 100644 --- a/trace-events +++ b/trace-events @@ -1434,6 +1434,8 @@ source_return_path_thread_loop_top(void) "" source_return_path_thread_pong(uint32_t val) "%x" source_return_path_thread_shut(uint32_t val) "%x" migrate_transferred(uint64_t tranferred, uint64_t time_spent, double bandwidth, uint64_t size) "transferred %" PRIu64 " time_spent %" PRIu64 " bandwidth %g max_size %" PRId64 +process_incoming_migration_co_end(int ret, int ps) "ret=%d postcopy-state=%d" +process_incoming_migration_co_postcopy_end_main(void) "" # migration/rdma.c __qemu_rdma_add_block(int block, uint64_t addr, uint64_t offset, uint64_t len, uint64_t end, uint64_t bits, int chunks) "Added Block: %d, addr: %" PRIu64 ", offset: %" PRIu64 " length: %" PRIu64 " end: %" PRIu64 " bits %" PRIu64 " chunks %d"