From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49029) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YcfHH-00062e-Jg for qemu-devel@nongnu.org; Mon, 30 Mar 2015 15:23:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YcfHC-0001Bo-PN for qemu-devel@nongnu.org; Mon, 30 Mar 2015 15:23:15 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43650) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YcfHC-0001Bc-Ia for qemu-devel@nongnu.org; Mon, 30 Mar 2015 15:23:10 -0400 Message-ID: <5519A292.4030808@redhat.com> Date: Mon, 30 Mar 2015 21:22:58 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1424883128-9841-1-git-send-email-dgilbert@redhat.com> <1424883128-9841-24-git-send-email-dgilbert@redhat.com> <20150313012652.GB11973@voom.redhat.com> <20150313111905.GC2486@work-vm> <20150316062355.GG5741@voom.redhat.com> <20150318175951.GL2355@work-vm> <20150319041830.GU5741@voom.redhat.com> <20150319093330.GA2409@work-vm> <20150323022042.GF25043@voom.fritz.box> <5519072A.5060407@redhat.com> <20150330170406.GF2474@work-vm> In-Reply-To: <20150330170406.GF2474@work-vm> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v5 23/45] migrate_start_postcopy: Command to trigger transition to postcopy 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, quintela@redhat.com, qemu-devel@nongnu.org, amit.shah@redhat.com, yanghy@cn.fujitsu.com, David Gibson On 30/03/2015 19:04, Dr. David Alan Gilbert wrote: >>> > > That one's a trickier question. Compilers are absolutely capable >>> > > of optimizing that far, *but* the C rules about when it's allowed >>> > > to assume in-memory values remain unchanged are pretty >>> > > conservative. I think any function call in the loop will require >>> > > it to reload the value, for example. That said, a (compiler only) >>> > > memory barrier might be appropriate to ensure that reload. >> > >> > That's exactly what atomic_read provides. > So does that say I need the atomic_read but not the atomic_write - > which seems a bit weird, but I think only due to the naming. No, you need both even though it's even more far-fetched that the compiler will do something bad with the set. Paolo