From patchwork Wed Dec 16 11:47:35 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: 557418 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 7034F1402C4 for ; Wed, 16 Dec 2015 22:51:24 +1100 (AEDT) Received: from localhost ([::1]:46794 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a9Ac6-0007I9-EM for incoming@patchwork.ozlabs.org; Wed, 16 Dec 2015 06:51:22 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52261) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a9AYf-0000zu-02 for qemu-devel@nongnu.org; Wed, 16 Dec 2015 06:47:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a9AYc-0006Ma-Jh for qemu-devel@nongnu.org; Wed, 16 Dec 2015 06:47:48 -0500 Received: from mx1.redhat.com ([209.132.183.28]:37217) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a9AYc-0006MU-E9 for qemu-devel@nongnu.org; Wed, 16 Dec 2015 06:47:46 -0500 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id 0CDAE693C1; Wed, 16 Dec 2015 11:47:46 +0000 (UTC) Received: from dgilbert-t530.redhat.com (ovpn-116-101.ams2.redhat.com [10.36.116.101]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id tBGBlcif032283; Wed, 16 Dec 2015 06:47:44 -0500 From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, quintela@redhat.com, amit.shah@redhat.com Date: Wed, 16 Dec 2015 11:47:35 +0000 Message-Id: <1450266458-3178-4-git-send-email-dgilbert@redhat.com> In-Reply-To: <1450266458-3178-1-git-send-email-dgilbert@redhat.com> References: <1450266458-3178-1-git-send-email-dgilbert@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: jdenemar@redhat.com, liang.z.li@intel.com, zhang.zhanghailiang@huawei.com Subject: [Qemu-devel] [PATCH v2 3/6] Postcopy: Send events/change state on incoming side 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" I missed the calls to send migration events on the destination side as we enter postcopy. Take care when adding them not to do it after state has been freed. Signed-off-by: Dr. David Alan Gilbert Reviewed-by: zhanghailiang Reviewed-by: Juan Quintela --- migration/savevm.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/migration/savevm.c b/migration/savevm.c index 0ad1b93..c469bad 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -1399,6 +1399,8 @@ static void *postcopy_ram_listen_thread(void *opaque) MigrationIncomingState *mis = migration_incoming_get_current(); int load_res; + migrate_set_state(&mis->state, MIGRATION_STATUS_ACTIVE, + MIGRATION_STATUS_POSTCOPY_ACTIVE); qemu_sem_post(&mis->listen_thread_sem); trace_postcopy_ram_listen_thread_start(); @@ -1415,6 +1417,8 @@ static void *postcopy_ram_listen_thread(void *opaque) if (load_res < 0) { error_report("%s: loadvm failed: %d", __func__, load_res); qemu_file_set_error(f, load_res); + migrate_set_state(&mis->state, MIGRATION_STATUS_POSTCOPY_ACTIVE, + MIGRATION_STATUS_FAILED); } else { /* * This looks good, but it's possible that the device loading in the @@ -1424,13 +1428,6 @@ static void *postcopy_ram_listen_thread(void *opaque) qemu_event_wait(&mis->main_thread_load_event); } postcopy_ram_incoming_cleanup(mis); - /* - * If everything has worked fine, then the main thread has waited - * for us to start, and we're the last use of the mis. - * (If something broke then qemu will have to exit anyway since it's - * got a bad migration state). - */ - migration_incoming_state_destroy(); if (load_res < 0) { /* @@ -1442,6 +1439,17 @@ static void *postcopy_ram_listen_thread(void *opaque) exit(EXIT_FAILURE); } + migrate_set_state(&mis->state, MIGRATION_STATUS_POSTCOPY_ACTIVE, + MIGRATION_STATUS_COMPLETED); + /* + * If everything has worked fine, then the main thread has waited + * for us to start, and we're the last use of the mis. + * (If something broke then qemu will have to exit anyway since it's + * got a bad migration state). + */ + migration_incoming_state_destroy(); + + return NULL; }