From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:48060) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TSPmL-000789-Im for qemu-devel@nongnu.org; Sun, 28 Oct 2012 06:07:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TSPmK-00009j-J9 for qemu-devel@nongnu.org; Sun, 28 Oct 2012 06:07:37 -0400 Received: from mx1.redhat.com ([209.132.183.28]:2668) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TSPmK-00009L-Au for qemu-devel@nongnu.org; Sun, 28 Oct 2012 06:07:36 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q9SA7Y5n013720 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sun, 28 Oct 2012 06:07:35 -0400 Message-ID: <508D03E4.8070904@redhat.com> Date: Sun, 28 Oct 2012 12:07:32 +0200 From: Orit Wasserman MIME-Version: 1.0 References: <1350555758-29988-1-git-send-email-pbonzini@redhat.com> <1350555758-29988-13-git-send-email-pbonzini@redhat.com> In-Reply-To: <1350555758-29988-13-git-send-email-pbonzini@redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 12/12] migration: move process_incoming_migration to a coroutine List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel@nongnu.org, quintela@redhat.com On 10/18/2012 12:22 PM, Paolo Bonzini wrote: > The final part of incoming migration, which now consists of > process_incoming_migration for all protocols, is thus made non-blocking. > > Signed-off-by: Paolo Bonzini > --- > migration.c | 21 ++++++++++++++++++++- > 1 file modificato, 20 inserzioni(+). 1 rimozione(-) > > diff --git a/migration.c b/migration.c > index 0d74753..32d43e7 100644 > --- a/migration.c > +++ b/migration.c > @@ -86,11 +86,13 @@ int qemu_start_incoming_migration(const char *uri, Error **errp) > return ret; > } > > -void process_incoming_migration(QEMUFile *f) > +static void process_incoming_migration_co(void *opaque) > { > + QEMUFile *f = opaque; > int ret; > > ret = qemu_loadvm_state(f); > + qemu_set_fd_handler(qemu_get_fd(f), NULL, NULL, NULL); > qemu_fclose(f); > if (ret < 0) { > fprintf(stderr, "load of migration failed\n"); > @@ -110,6 +112,23 @@ void process_incoming_migration(QEMUFile *f) > } > } > > +static void enter_migration_coroutine(void *opaque) > +{ > + Coroutine *co = opaque; > + qemu_coroutine_enter(co, NULL); > +} > + > +void process_incoming_migration(QEMUFile *f) > +{ > + Coroutine *co = qemu_coroutine_create(process_incoming_migration_co); > + int fd = qemu_get_fd(f); > + > + assert(fd != -1); > + socket_set_nonblock(fd); > + qemu_set_fd_handler(fd, enter_migration_coroutine, NULL, co); > + qemu_coroutine_enter(co, f); > +} > + > /* amount of nanoseconds we are willing to wait for migration to be down. > * the choice of nanoseconds is because it is the maximum resolution that > * get_clock() can achieve. It is an internal measure. All user-visible > Reviewed-by: Orit Wasserman