From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45708) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z5X8M-00030u-Nx for qemu-devel@nongnu.org; Thu, 18 Jun 2015 06:33:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z5X8H-0005bi-E7 for qemu-devel@nongnu.org; Thu, 18 Jun 2015 06:33:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35429) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z5X8H-0005b8-8z for qemu-devel@nongnu.org; Thu, 18 Jun 2015 06:33:17 -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 (Postfix) with ESMTPS id D296833B359 for ; Thu, 18 Jun 2015 10:33:16 +0000 (UTC) Date: Thu, 18 Jun 2015 11:33:12 +0100 From: "Dr. David Alan Gilbert" Message-ID: <20150618103312.GE2248@work-vm> References: <1434505833-11234-1-git-send-email-quintela@redhat.com> <1434505833-11234-8-git-send-email-quintela@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1434505833-11234-8-git-send-email-quintela@redhat.com> Subject: Re: [Qemu-devel] [PATCH 07/11] migration: Use cmpxchg correctly List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Juan Quintela Cc: amit.shah@redhat.com, qemu-devel@nongnu.org * Juan Quintela (quintela@redhat.com) wrote: > cmpxchg returns the old value > > Signed-off-by: Juan Quintela Reviewed-by: Dr. David Alan Gilbert Nice spot. > --- > migration/migration.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/migration/migration.c b/migration/migration.c > index f1ecf76..1791185 100644 > --- a/migration/migration.c > +++ b/migration/migration.c > @@ -505,7 +505,7 @@ void qmp_migrate_set_parameters(bool has_compress_level, > > static void migrate_set_state(MigrationState *s, int old_state, int new_state) > { > - if (atomic_cmpxchg(&s->state, old_state, new_state) == new_state) { > + if (atomic_cmpxchg(&s->state, old_state, new_state) == old_state) { > trace_migrate_set_state(new_state); > } > } > -- > 2.4.3 > > -- Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK