From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33320) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a94N5-00024X-Jh for qemu-devel@nongnu.org; Wed, 16 Dec 2015 00:11:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a94N2-0002ze-9B for qemu-devel@nongnu.org; Wed, 16 Dec 2015 00:11:27 -0500 Received: from szxga02-in.huawei.com ([119.145.14.65]:53949) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a94N1-0002z8-Ld for qemu-devel@nongnu.org; Wed, 16 Dec 2015 00:11:24 -0500 References: <1450206170-26901-1-git-send-email-dgilbert@redhat.com> <1450206170-26901-4-git-send-email-dgilbert@redhat.com> From: Hailiang Zhang Message-ID: <5670F25C.4020203@huawei.com> Date: Wed, 16 Dec 2015 13:10:52 +0800 MIME-Version: 1.0 In-Reply-To: <1450206170-26901-4-git-send-email-dgilbert@redhat.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 3/6] Postcopy: Send events/change state on incoming side List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Dr. David Alan Gilbert (git)" , qemu-devel@nongnu.org, quintela@redhat.com, amit.shah@redhat.com Cc: jdenemar@redhat.com, liang.z.li@intel.com, peter.huangpeng@huawei.com On 2015/12/16 3:02, Dr. David Alan Gilbert (git) wrote: > 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 > --- > 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; > } > > Reviewed-by: zhanghailiang