From: Tim Deegan Subject: Re: [PATCH 17/45] xen: arm64: xchg and cmpxchg Date: Thu, 7 Feb 2013 16:48:44 +0000 Message-ID: <20130207164844.GS77133@ocelot.phlegethon.org> References: <1358956576.17440.60.camel@zakaz.uk.xensource.com> <1358956611-8432-17-git-send-email-ian.campbell@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <1358956611-8432-17-git-send-email-ian.campbell@citrix.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: stefano.stabellini@citrix.com, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org 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)? The 32-bit equivalent doesn't have any memory barriers. Tim.