From: Tim Deegan Subject: Re: [PATCH 17/45] xen: arm64: xchg and cmpxchg Date: Thu, 7 Feb 2013 17:18:37 +0000 Message-ID: <20130207171837.GT77133@ocelot.phlegethon.org> References: <1358956576.17440.60.camel@zakaz.uk.xensource.com> <1358956611-8432-17-git-send-email-ian.campbell@citrix.com> <20130207164844.GS77133@ocelot.phlegethon.org> <1360256782.32479.101.camel@zakaz.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <1360256782.32479.101.camel@zakaz.uk.xensource.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: Ian Campbell Cc: "xen-devel@lists.xen.org" , Stefano Stabellini List-Id: xen-devel@lists.xenproject.org At 17:06 +0000 on 07 Feb (1360256782), Ian Campbell wrote: > 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. Argh, so there is. I jujst didn't see it for some reason. So, Acked-by: Tim Deegan Tim.