From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52530) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZEi94-0002lQ-78 for qemu-devel@nongnu.org; Mon, 13 Jul 2015 14:08:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZEi8w-0004vQ-Ir for qemu-devel@nongnu.org; Mon, 13 Jul 2015 14:08:02 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47930) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZEi8w-0004vF-Bi for qemu-devel@nongnu.org; Mon, 13 Jul 2015 14:07:54 -0400 From: Juan Quintela In-Reply-To: <20150713171340.GK2492@work-vm> (David Alan Gilbert's message of "Mon, 13 Jul 2015 18:13:40 +0100") References: <1434450415-11339-1-git-send-email-dgilbert@redhat.com> <1434450415-11339-23-git-send-email-dgilbert@redhat.com> <87380sl2rx.fsf@neno.neno> <20150713171340.GK2492@work-vm> Date: Mon, 13 Jul 2015 20:07:52 +0200 Message-ID: <87mvz0hqx3.fsf@neno.neno> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH v7 22/42] migrate_start_postcopy: Command to trigger transition to postcopy Reply-To: quintela@redhat.com List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Dr. David Alan Gilbert" Cc: aarcange@redhat.com, yamahata@private.email.ne.jp, liang.z.li@intel.com, qemu-devel@nongnu.org, luis@cs.umu.se, amit.shah@redhat.com, pbonzini@redhat.com, david@gibson.dropbear.id.au "Dr. David Alan Gilbert" wrote: > * Juan Quintela (quintela@redhat.com) wrote: >> "Dr. David Alan Gilbert (git)" wrote: >> > From: "Dr. David Alan Gilbert" >> > >> > Once postcopy is enabled (with migrate_set_capability), the migration >> > will still start on precopy mode. To cause a transition into postcopy >> > the: >> > >> > migrate_start_postcopy >> > >> > command must be issued. Postcopy will start sometime after this >> > (when it's next checked in the migration loop). >> > >> > Issuing the command before migration has started will error, >> > and issuing after it has finished is ignored. >> > >> > Signed-off-by: Dr. David Alan Gilbert >> > Reviewed-by: Eric Blake >> >> > diff --git a/include/migration/migration.h b/include/migration/migration.h >> > index a5951ac..e973490 100644 >> > --- a/include/migration/migration.h >> > +++ b/include/migration/migration.h >> > @@ -111,6 +111,9 @@ struct MigrationState >> > int64_t xbzrle_cache_size; >> > int64_t setup_time; >> > int64_t dirty_sync_count; >> > + >> > + /* Flag set once the migration has been asked to enter postcopy */ >> > + bool start_postcopy; >> > }; >> > >> > void process_incoming_migration(QEMUFile *f); >> > diff --git a/migration/migration.c b/migration/migration.c >> > index e77b8b4..6fc47f9 100644 >> > --- a/migration/migration.c >> > +++ b/migration/migration.c >> > @@ -465,6 +465,28 @@ void qmp_migrate_set_parameters(bool has_compress_level, >> > } >> > } >> > >> > +void qmp_migrate_start_postcopy(Error **errp) >> > +{ >> > + MigrationState *s = migrate_get_current(); >> > + >> > + if (!migrate_postcopy_ram()) { >> > + error_setg(errp, "Enable postcopy with migration_set_capability before" >> > + " the start of migration"); >> > + return; >> > + } >> > + >> > + if (s->state == MIGRATION_STATUS_NONE) { >> >> I would claim that this check should be: >> >> if (s->state != MIGRATION_STATUS_ACTIVE) { >> ?? >> >> FAILED, COMPLETED, CANCELL* don't make sense, right? > > What I'm trying to catch here is people doing: > migrate_start_postcopy > migrate tcp:pppp:whereever > > which wont work, because migrate_init reinitialises > the flag that start previously set. > > However, I also don't want to create a race, since what you do is > typically: > migrate tcp:pppp:whereever > > migrate_start_postcopy > > if you're unlucky, and the migration finishes just > at the same time you do the migrate_start_postcopy, do you > want migrate_start_postcopy to fail? My guess was it > was best for it not to fail, in this case. Change the order, if it is ACTIVE: do the postcopy thing, otherwise, do the clause that is protected now? Moving to postcopy only make sense if we are in active. Later, Juan. > > Dave > >> >> Thanks, Juan. > -- > Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK