From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51653) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zf3JJ-0002tb-H7 for qemu-devel@nongnu.org; Thu, 24 Sep 2015 05:59:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zf3JG-0001dM-Ac for qemu-devel@nongnu.org; Thu, 24 Sep 2015 05:59:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43197) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zf3JG-0001ci-5i for qemu-devel@nongnu.org; Thu, 24 Sep 2015 05:59:26 -0400 Date: Thu, 24 Sep 2015 10:59:18 +0100 From: "Dr. David Alan Gilbert" Message-ID: <20150924095918.GA31664@work-vm> 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> <87mvz0hqx3.fsf@neno.neno> <20150721074047.GF10280@grmbl.mre> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150721074047.GF10280@grmbl.mre> Subject: Re: [Qemu-devel] [PATCH v7 22/42] migrate_start_postcopy: Command to trigger transition to postcopy List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Amit Shah Cc: aarcange@redhat.com, yamahata@private.email.ne.jp, Juan Quintela , liang.z.li@intel.com, qemu-devel@nongnu.org, luis@cs.umu.se, pbonzini@redhat.com, david@gibson.dropbear.id.au * Amit Shah (amit.shah@redhat.com) wrote: > On (Mon) 13 Jul 2015 [20:07:52], Juan Quintela wrote: > > "Dr. David Alan Gilbert" wrote: > > > * Juan Quintela (quintela@redhat.com) wrote: > > > >> > +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. > > Yeah, I tend to agree, because in the cases where migration has failed > or has been cancelled, we'll end up setting the postcopy bit. Then, > upon the next migration, this bit could get reused - resulting in the > previous condition of setting postcopy bit before starting migration. No, that doesn't happen; the bit is cleared at the start of migration so that race condition doesn't exist. Dave > > > Amit -- Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK