From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Subject: Re: [PATCHv2 4/6] x86: provide xadd() Date: Thu, 16 Apr 2015 15:07:55 +0100 Message-ID: <1429193275.25195.129.camel@citrix.com> References: <1428675597-28465-1-git-send-email-david.vrabel@citrix.com> <1428675597-28465-5-git-send-email-david.vrabel@citrix.com> <20150416112556.GI13443@deinos.phlegethon.org> <552FBDDF0200007800072BF6@mail.emea.novell.com> <20150416124925.GC13441@deinos.phlegethon.org> <1429188927.25195.122.camel@citrix.com> <552FD3000200007800072C97@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YikUk-0004fN-E0 for xen-devel@lists.xenproject.org; Thu, 16 Apr 2015 14:10:18 +0000 In-Reply-To: <552FD3000200007800072C97@mail.emea.novell.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: Jan Beulich Cc: xen-devel@lists.xenproject.org, Tim Deegan , Keir Fraser , David Vrabel , Stefano Stabellini List-Id: xen-devel@lists.xenproject.org On Thu, 2015-04-16 at 14:19 +0100, Jan Beulich wrote: > >>> On 16.04.15 at 14:55, wrote: > > On Thu, 2015-04-16 at 13:49 +0100, Tim Deegan wrote: > >> At 12:49 +0100 on 16 Apr (1429188559), Jan Beulich wrote: > >> > >>> On 16.04.15 at 13:25, wrote: > >> > > But also: AFAICS the GCC builtin __sync_fetch_and_add() does almost > >> > > exactly this (the difference being that those are also compiler > >> > > barriers where this is only a CPU barrier). Should we be using it > >> > > instead? > >> > > >> > I'm afraid that's useful only from gcc 4.5.x onwards; earlier versions > >> > (on x86 at least) simply generate a function call relying on a library to > >> > implement it. > >> > >> Darn. :( > > > > Might it still be a better generic fallback than the C/cmpxchg one? > > > > On x86 you'd get the asm version, and on ARM you need 4.5.x onwards > > Is that the case even for ARM32? Erm, I thought so when I wrote it but now I think again I'm not actually so sure. > > anyway, plus in general the ARM folks seem to recommend using the > > builtins more anyway. > > I assume you checked that 4.5.x actually expands said builtin for > ARM (as I only checked x86)? No, I hadn't, I should though, you are right. Ian.