From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58104) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ycdm4-0004L7-Ic for qemu-devel@nongnu.org; Mon, 30 Mar 2015 13:46:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ycdm0-0001Es-HL for qemu-devel@nongnu.org; Mon, 30 Mar 2015 13:46:56 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57384) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ycdm0-0001Ek-BB for qemu-devel@nongnu.org; Mon, 30 Mar 2015 13:46:52 -0400 Date: Mon, 30 Mar 2015 18:46:46 +0100 From: "Dr. David Alan Gilbert" Message-ID: <20150330174646.GI2474@work-vm> References: <1424883128-9841-1-git-send-email-dgilbert@redhat.com> <1424883128-9841-18-git-send-email-dgilbert@redhat.com> <5516CC19.7080004@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5516CC19.7080004@redhat.com> Subject: Re: [Qemu-devel] [PATCH v5 17/45] Add wrappers and handlers for sending/receiving the postcopy-ram migration messages. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: aarcange@redhat.com, yamahata@private.email.ne.jp, quintela@redhat.com, qemu-devel@nongnu.org, amit.shah@redhat.com, yanghy@cn.fujitsu.com, david@gibson.dropbear.id.au * Paolo Bonzini (pbonzini@redhat.com) wrote: > > > On 25/02/2015 17:51, Dr. David Alan Gilbert (git) wrote: > > +PostcopyState postcopy_state_get(MigrationIncomingState *mis) > > +{ > > + return atomic_fetch_add(&mis->postcopy_state, 0); > > +} > > + > > +/* Set the state and return the old state */ > > +PostcopyState postcopy_state_set(MigrationIncomingState *mis, > > + PostcopyState new_state) > > +{ > > + return atomic_xchg(&mis->postcopy_state, new_state); > > +} > > Which are the (multiple) threads are calling these functions? The main thread receiving the migration and the postcopy ram_listen_thread receiving the RAM pages. It's not actually racy between multiple threads updating it, it's sequenced so that the main thread initialises it and then hands over to the listen thread that takes it over from that point. Dave > > Paolo -- Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK