From: Ian Campbell Subject: Re: [PATCH 2/3] xen/arm64: resync atomics and spinlock asm with Linux Date: Tue, 30 Jul 2013 10:55:01 +0100 Message-ID: <1375178101.11701.81.camel@kazak.uk.xensource.com> References: <1374247170.13645.100.camel@kazak.uk.xensource.com> <1374247210-20994-2-git-send-email-ian.campbell@citrix.com> <20130729160244.GM37169@ocelot.phlegethon.org> <1375114382.11701.21.camel@kazak.uk.xensource.com> <20130729180549.GO32383@mudshark.cambridge.arm.com> <1375176852.11701.68.camel@kazak.uk.xensource.com> <20130730094535.GG11527@mudshark.cambridge.arm.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20130730094535.GG11527@mudshark.cambridge.arm.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Will Deacon Cc: "julien.grall@citrix.com" , Catalin Marinas , "stefano.stabellini@eu.citrix.com" , Tim Deegan , "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org On Tue, 2013-07-30 at 10:45 +0100, Will Deacon wrote: > On Tue, Jul 30, 2013 at 10:34:12AM +0100, Ian Campbell wrote: > > On Mon, 2013-07-29 at 19:05 +0100, Will Deacon wrote: > > > On Mon, Jul 29, 2013 at 05:13:02PM +0100, Ian Campbell wrote: > > > > On Mon, 2013-07-29 at 17:02 +0100, Tim Deegan wrote: > > > > > But I don't understand the new 'memory' clobbers around in this patch. > > > > > Or rather, I don't understand why there are memory clobbers but not > > > > > DMBs. > > > > > > The acquire/release instructions imply half barriers, but GCC may still > > > re-order instructions across them unless we include the memory clobber. > > > > The instructions which Tim is querying patch the are > > load/store-exclusive (ldxr,stxr) not acquire/release (ldaxr/stlxr et al) > > ones. The a/r ones do indeed have implicit barriers but do the l/s-excl > > do too? > > > > The ARM ARM Tim quoted was the v7 version but I don't see anything in > > the v8 docs which I have available (which I know are incomplete and may > > well be out of date) which says anything about barriers (implicit or > > otherwise) wrt the l/s-excl instructions. I do see stuff relating to the > > a/r instructions having implicit barriers. > > Ah sorry, should've looked more closely. This is basically because not all > atomic operations in Linux imply barriers. > > Take a look at Documentation/atomic_ops.txt and check whether it matches the > semantics required by Xen. Ohoo, I wasn't aware of that (it's not that surprising mind). Some auditing of the Xen code may be required here! Ian.