From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752772AbbJNBAx (ORCPT ); Tue, 13 Oct 2015 21:00:53 -0400 Received: from mail-ig0-f177.google.com ([209.85.213.177]:33820 "EHLO mail-ig0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752162AbbJNBAu (ORCPT ); Tue, 13 Oct 2015 21:00:50 -0400 Date: Wed, 14 Oct 2015 09:00:29 +0800 From: Boqun Feng To: Will Deacon Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Peter Zijlstra , Ingo Molnar , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Thomas Gleixner , "Paul E. McKenney" , Waiman Long , Davidlohr Bueso Subject: Re: [PATCH v3 4/6] powerpc: atomic: Implement atomic{,64}_*_return_* variants Message-ID: <20151014010029.GB14305@fixme-laptop.cn.ibm.com> References: <1444659246-24769-1-git-send-email-boqun.feng@gmail.com> <1444659246-24769-5-git-send-email-boqun.feng@gmail.com> <20151013132132.GH21550@arm.com> <20151013133554.GA23991@fixme-laptop.cn.ibm.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="nVMJ2NtxeReIH9PS" Content-Disposition: inline In-Reply-To: <20151013133554.GA23991@fixme-laptop.cn.ibm.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --nVMJ2NtxeReIH9PS Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Oct 13, 2015 at 09:35:54PM +0800, Boqun Feng wrote: > On Tue, Oct 13, 2015 at 02:21:32PM +0100, Will Deacon wrote: > > On Mon, Oct 12, 2015 at 10:14:04PM +0800, Boqun Feng wrote: > [snip] > > > +/* > > > + * Since {add,sub}_return_relaxed and xchg_relaxed are implemented w= ith > > > + * a "bne-" instruction at the end, so an isync is enough as a acqui= re barrier > > > + * on the platform without lwsync. > > > + */ > > > +#ifdef CONFIG_SMP > > > +#define smp_acquire_barrier__after_atomic() \ > > > + __asm__ __volatile__(PPC_ACQUIRE_BARRIER : : : "memory") > >=20 > > I'm not keen on this barrier, as it sounds like it's part of the kernel > > memory model, as opposed to an implementation detail on PowerPC (and > > we've already got enough of that in the generic code ;). > >=20 >=20 > Indeed, but we still have smp_lwsync() ;-) >=20 > > Can you name it something different please (and maybe #undef it when > > you're done)? > >=20 >=20 > I've considered #undef it after used, but now I think open code this > into __atomic_op_acquire() of PPC is a better idea? >=20 >=20 > #define __atomic_op_acquire(op, args...) \ > ({ \ > typeof(op##_relaxed(args)) __ret =3D op##_relaxed(args); \ > __asm__ __volatile__(PPC_ACQUIRE_BARRIER : : : "memory"); \ Should be: __asm__ __volatile__(PPC_ACQUIRE_BARRIER "" : : : "memory"); > __ret; \ > }) >=20 > PPC_ACQUIRE_BARRIER will be empty if !SMP, so that will become a pure > compiler barrier and just what we need. >=20 > Regards, > Boqun --nVMJ2NtxeReIH9PS Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAABCAAGBQJWHakpAAoJEEl56MO1B/q4V84H/ivZAy1Ro3m2BdDvDLLbOzOl gEJrDi/RB7EpKAJFv+/yRg8+gBZxpf3/BXHPrtSrS/XOVhFLZph5wzoLFVHogu8J TYJw31TgIoggROtNlO9Der5NOX+pHbcCzZqgiNcGgg7voX0WO7wcdOuaJrjfiTdF dS8j8xIIox04a3UGUhFLp2+3pHgNRcOGrkE1S91bVaSh5ZQ2KLZJwenAy/I02TJy L1tDaQ32EOyi5jAb+Phl7Ebf/TbHHFU4vrwCxFj+xYVWR1vn2VDLoPjql0zybN37 TPcdpVJ7RH8HYjub158ak8LMYZA2Ov7rzrKADxc/1OXT756O87Ik7O60LRXxWZA= =mcRu -----END PGP SIGNATURE----- --nVMJ2NtxeReIH9PS--