Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NppDe-0004hG-1x for qemu-devel@nongnu.org; Thu, 11 Mar 2010 15:42:58 -0500 Received: from [199.232.76.173] (port=51183 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NppDd-0004gF-Io for qemu-devel@nongnu.org; Thu, 11 Mar 2010 15:42:57 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NppDa-0004s5-Fg for qemu-devel@nongnu.org; Thu, 11 Mar 2010 15:42:57 -0500 Received: from mx1.redhat.com ([209.132.183.28]:27659) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NppDa-0004rz-1v for qemu-devel@nongnu.org; Thu, 11 Mar 2010 15:42:54 -0500 From: Juan Quintela In-Reply-To: <4B995247.5010306@codemonkey.ws> (Anthony Liguori's message of "Thu, 11 Mar 2010 14:27:51 -0600") References: <4B995247.5010306@codemonkey.ws> Date: Thu, 11 Mar 2010 21:42:48 +0100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: [Qemu-devel] Re: [PATCH 2/2] migration: unix migration should obey autostart are the other ones List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: qemu-devel@nongnu.org Anthony Liguori wrote: > On 03/09/2010 05:10 PM, Juan Quintela wrote: >> This was the only incoming migration without autostart check >> >> Signed-off-by: Juan Quintela >> --- >> migration-unix.c | 2 ++ >> 1 files changed, 2 insertions(+), 0 deletions(-) >> >> diff --git a/migration-unix.c b/migration-unix.c >> index ce59a2a..49de1b9 100644 >> --- a/migration-unix.c >> +++ b/migration-unix.c >> @@ -176,6 +176,8 @@ static void unix_accept_incoming_migration(void *opaque) >> qemu_announce_self(); >> DPRINTF("successfully loaded vm state\n"); >> >> + if (autostart) >> + vm_start(); >> > > Maybe a better thing to do is make accept_incoming_migration return an > error code and do the vm_start in common code. It is uglier than that (got the ones from migration-fd but idea is the same, removed uinteresting bits) static void fd_accept_incoming_migration(void *opaque) { ret = qemu_loadvm_state(f); .... if (autostart) vm_start(); .... } int fd_start_incoming_migration(const char *infd) { .... qemu_set_fd_handler2(fd, NULL, fd_accept_incoming_migration, NULL, (void *)(unsigned long)f); return 0; } function call chain is: main() -> qemu_start_incoming_migration() -> fd_start_migration() -> here they got an fd, and call fd_accept_incoming_migration asyncronously on that fd. We can't call vm_start() until migration finish. And we have gone async a long time ago. As a related note, you can see that exec_accept_incoming_migration() is identical to fd_start_incoming_migration(). I was going to share the code for all migrations until I found that unix & tcp migration do the accept also asynchronously, breaking the common function. My plan was to make the accept in {unix,tcp}_start_incoming_migration() and then have a shared qemu_accept_incoming_migration() for all four kinds of migration. Notice that it don't make sense to make the accept async, because qemu is not going to do _anything_ until incoming migration is finished, anyways. Just didn't want to merge the bugfix with the other change. Later, Juan. > Regards, > > Anthony Liguori > >> out_fopen: >> qemu_fclose(f); >>