From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41131) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XGqdD-0000Yl-W2 for qemu-devel@nongnu.org; Mon, 11 Aug 2014 10:31:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XGqd7-0001UU-OQ for qemu-devel@nongnu.org; Mon, 11 Aug 2014 10:31:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:7674) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XGqd7-0001UQ-Hp for qemu-devel@nongnu.org; Mon, 11 Aug 2014 10:31:21 -0400 From: "Dr. David Alan Gilbert (git)" Date: Mon, 11 Aug 2014 15:29:58 +0100 Message-Id: <1407767399-3030-43-git-send-email-dgilbert@redhat.com> In-Reply-To: <1407767399-3030-1-git-send-email-dgilbert@redhat.com> References: <1407767399-3030-1-git-send-email-dgilbert@redhat.com> Subject: [Qemu-devel] [PATCH v2 42/43] End of migration for postcopy 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, lilei@linux.vnet.ibm.com, quintela@redhat.com 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.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/migration.c b/migration.c index ac5bd3d..188b13b 100644 --- a/migration.c +++ b/migration.c @@ -212,6 +212,26 @@ static void process_incoming_migration_co(void *opaque) ret = qemu_loadvm_state(f); + if (mis->postcopy_ram_state == POSTCOPY_RAM_INCOMING_ADVISE) { + /* + * Where a migration had postcopy enabled (and thus went to advise) + * but managed to complete within the precopy period + */ + postcopy_ram_incoming_cleanup(mis); + } + + DPRINTF("%s: ret=%d postcopy_ram_state=%d", __func__, ret, + mis->postcopy_ram_state); + if ((ret >= 0) && + (mis->postcopy_ram_state > POSTCOPY_RAM_INCOMING_ADVISE)) { + /* + * Postcopy was started, cleanup should happen at the end of the + * postcopy thread. + */ + DPRINTF("process_incoming_migration_co: exiting main branch"); + return; + } + qemu_fclose(f); free_xbzrle_decoded_buf(); migration_incoming_state_destroy(); -- 1.9.3