From: Ian Campbell Subject: Re: [PATCH 17/45] xen: arm64: xchg and cmpxchg Date: Thu, 7 Feb 2013 17:06:22 +0000 Message-ID: <1360256782.32479.101.camel@zakaz.uk.xensource.com> References: <1358956576.17440.60.camel@zakaz.uk.xensource.com> <1358956611-8432-17-git-send-email-ian.campbell@citrix.com> <20130207164844.GS77133@ocelot.phlegethon.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20130207164844.GS77133@ocelot.phlegethon.org> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Tim Deegan Cc: Stefano Stabellini , "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org On Thu, 2013-02-07 at 16:48 +0000, Tim Deegan wrote: > At 15:56 +0000 on 23 Jan (1358956583), Ian Campbell wrote: > > Signed-off-by: Ian Campbell > > --- > > xen/include/asm-arm/arm32/system.h | 115 ++++++++++++++++++++++++++ > > xen/include/asm-arm/arm64/system.h | 155 ++++++++++++++++++++++++++++++++++++ > > xen/include/asm-arm/system.h | 114 -------------------------- > > 3 files changed, 270 insertions(+), 114 deletions(-) > > > > --- a/xen/include/asm-arm/arm64/system.h > > +++ b/xen/include/asm-arm/arm64/system.h > > @@ -17,6 +17,161 @@ > > #define smp_rmb() asm volatile("dmb ishld" : : : "memory") > > #define smp_wmb() asm volatile("dmb ishst" : : : "memory") > > > > + > > +extern void __bad_xchg(volatile void *, int); > > + > > +static inline unsigned long __xchg(unsigned long x, volatile void *ptr, int size) > > +{ > > + unsigned long ret, tmp; > > + > > + switch (size) { > > + case 1: > > + asm volatile("// __xchg1\n" > > + "1: ldaxrb %w0, [%3]\n" > > + " stlxrb %w1, %w2, [%3]\n" > > Why are these using acquire/release ops (i.e. why not LDXR/STXR)? I nicked this from Linux ;-) > The 32-bit equivalent doesn't have any memory barriers. You mean does? There is a smp_mb() before and after in that implementation. Ian.