From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754103AbbIRMcS (ORCPT ); Fri, 18 Sep 2015 08:32:18 -0400 Received: from mailapp01.imgtec.com ([195.59.15.196]:45049 "EHLO imgpgp01.kl.imgtec.org" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753485AbbIRMcP (ORCPT ); Fri, 18 Sep 2015 08:32:15 -0400 X-PGP-Universal: processed; by imgpgp01.kl.imgtec.org on Fri, 18 Sep 2015 13:32:12 +0100 Date: Fri, 18 Sep 2015 13:31:27 +0100 From: James Hogan To: Peter Zijlstra CC: Oleg Nesterov , Dmitry Vyukov , , Al Viro , Andrew Morton , Ingo Molnar , Paul McKenney , , LKML , , Kostya Serebryany , Andrey Konovalov , "Alexander Potapenko" , Hans Boehm Subject: Re: [PATCH] kernel: fix data race in put_pid Message-ID: <20150918123127.GC26975@jhogan-linux.le.imgtec.org> References: <1442496268-47803-1-git-send-email-dvyukov@google.com> <20150917160837.GA26050@redhat.com> <20150917174456.GA30178@redhat.com> <20150917180919.GA32116@redhat.com> <20150918085156.GS3816@twins.programming.kicks-ass.net> <20150918085732.GC11639@twins.programming.kicks-ass.net> <20150918092732.GD11639@twins.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="E/DnYTRukya0zdZ1" Content-Disposition: inline In-Reply-To: <20150918092732.GD11639@twins.programming.kicks-ass.net> User-Agent: Mutt/1.5.23 (2014-03-12) X-Originating-IP: [192.168.154.110] X-ESG-ENCRYPT-TAG: e4aa9c8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --E/DnYTRukya0zdZ1 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Peter, On Fri, Sep 18, 2015 at 11:27:32AM +0200, Peter Zijlstra wrote: > On Fri, Sep 18, 2015 at 10:57:32AM +0200, Peter Zijlstra wrote: > > diff --git a/arch/metag/include/asm/atomic_lnkget.h b/arch/metag/includ= e/asm/atomic_lnkget.h > > index 21c4c268b86c..1bd21c933435 100644 > > --- a/arch/metag/include/asm/atomic_lnkget.h > > +++ b/arch/metag/include/asm/atomic_lnkget.h > > @@ -3,7 +3,8 @@ > > =20 > > #define ATOMIC_INIT(i) { (i) } > > =20 > > -#define atomic_set(v, i) ((v)->counter =3D (i)) > > +/* XXX: should be LNKSETD ? */ > > +#define atomic_set(v, i) WRITE_ONCE((v)->counter, (i)) > > =20 > > #include > > =20 >=20 > James? It should be fine without a LNKSET. The only reason LNKGET is required for atomic_read() is that on certain cores the LNKGET/LNKSET instructions went around the cache, but those cores also have write through caches, so it shouldn't result in incoherence. I've just double checked, and the pipeline seems to handle the linked read after write correctly, so e.g. after: 0220002c MOV D0FrT,#0x5 b6208042 SETD [D1Ar3],D0FrT ad1080cc LNKGETD D0Ar4,[D1Ar3] D0Ar4 is correct (0x5). Cheers James --E/DnYTRukya0zdZ1 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBAgAGBQJV/AQfAAoJEGwLaZPeOHZ63RoP/3AR7E4L/xNdVAB1ajrLtuj8 1rJn232vH8EVliGu4N7rwHu1eJPuCpZp+N4WPlieoYu1KH7xjrr4Wiwxx/lwXObs 2NWzUmGbkJ1jCsYiov4CwFNY8w+4MHgVY6lJGsWsVR7qHqWBOtaegVf7Z3xWasb2 bb2OrinaxllwoIkcqA3cgyho7dXlrSD8ou3x6TqaeQuDZph7OR+oa5p6ovEaV0FV Z8o0eNId2YH0mqDaE1ghxduDQ8a9X90fozofOge/Z6no05LsMEu7LiPtsaYG8ril 6NCQhNpYzhX35doXrEC/ufQqbHQ1Gb/E9Ut1SHGMveEiNxQ6qIJl6yl5vq8CJcKa GphUtefuyl81TtU0iRxSRM9/lMl5Jd8gzqgNXc5GWD1mXtGWVCAjG4AMIxnxe7Mv MsFAquyowKteTKhg8lh9P4rrTDIpSabIQt6YsY7e9eXL8FPe9tnEYSzc/j0b3Bpo hZCkY5GNbnG4SZHKCR6vQAH4gMZzebXioYeZDNmM5A4iD7tFrpMUgEyM9hEIFS40 ATcoyWxliQ37L+W7qQ7g2fTjOZfFmR38+0g7bPVwNdzwUkgtC4XFsJh95y1lm7p4 yTqSoTVFAV9tombVgbpWuHbMaGAi5b04cgwzTELdzfRZgnIx8CkCCU6Ugoogfog6 oUoxLAJBL1VHpKEMixbf =WGJe -----END PGP SIGNATURE----- --E/DnYTRukya0zdZ1--