Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755441AbbGPUkK (ORCPT ); Thu, 16 Jul 2015 16:40:10 -0400 Received: from g4t3426.houston.hp.com ([15.201.208.54]:44999 "EHLO g4t3426.houston.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751609AbbGPUkH (ORCPT ); Thu, 16 Jul 2015 16:40:07 -0400 Message-ID: <55A816A3.1000502@hp.com> Date: Thu, 16 Jul 2015 16:40:03 -0400 From: Waiman Long User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.12) Gecko/20130109 Thunderbird/10.0.12 MIME-Version: 1.0 To: Will Deacon CC: linux-arch@vger.kernel.org, peterz@infradead.org, linux-kernel@vger.kernel.org, paulmck@linux.vnet.ibm.com Subject: Re: [PATCH v2 7/7] ARM: atomics: define our SMP atomics in terms of _relaxed operations References: <1437060758-10381-1-git-send-email-will.deacon@arm.com> <1437060758-10381-8-git-send-email-will.deacon@arm.com> In-Reply-To: <1437060758-10381-8-git-send-email-will.deacon@arm.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1210 Lines: 34 On 07/16/2015 11:32 AM, Will Deacon wrote: > By defining our SMP atomics in terms of relaxed operations, we gain > a small reduction in code size and have acquire/release/fence variants > generated automatically by the core code. > > Signed-off-by: Will Deacon > --- > arch/arm/include/asm/atomic.h | 37 ++++++++++++++------------------- > arch/arm/include/asm/cmpxchg.h | 47 +++++++----------------------------------- > 2 files changed, 24 insertions(+), 60 deletions(-) > > > > -#define xchg(ptr, x) ({ \ > +#define xchg_relaxed(ptr, x) ({ \ > (__typeof__(*(ptr)))__xchg((unsigned long)(x), (ptr), \ > sizeof(*(ptr))); \ > }) > @@ -117,6 +115,8 @@ static inline unsigned long __xchg(unsigned long x, volatile void *ptr, int size > #error "SMP is not supported on this platform" > #endif > > +#define xchg xchg_relaxed Is that a typo? I think xchg() needs to be a full memory barrier. Cheers, Longman -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/