From mboxrd@z Thu Jan 1 00:00:00 1970 From: Will Deacon Subject: Re: [PATCH 01/13] compiler.h: Split {READ,WRITE}_ONCE definitions out into rwonce.h Date: Tue, 12 Nov 2019 11:36:47 +0000 Message-ID: <20191112113646.GC17835@willie-the-truck> References: <20191108170120.22331-1-will@kernel.org> <20191108170120.22331-2-will@kernel.org> <93f80017-d65e-7c3a-29b0-d9a568d08f58@de.ibm.com> Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Return-path: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1573558613; bh=IBRZ0V+FizBPRXBE7AIelmGcF/rqx4zxpH+FTVnkzDQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=vgR6vb6pygOrhYdh1tLbICYpzNyLiNW/NGEr6J8+nCx71yHQDyEQ3zjASKeUfsJrC tr9H+e8krqDcjj664LKgstygnZJcLRjtIzdyrNXpDLEotbjAeOGuGg3W0fRW/q0rLK wrAAh0Cey56Uy6sOjPmN8QeMewVkm+GLfLdNBr24= Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org List-ID: Content-Type: text/plain; charset="iso-8859-1" To: Arnd Bergmann Cc: Christian Borntraeger , "linux-kernel@vger.kernel.org" , Yunjae Lee , SeongJae Park , "Paul E. McKenney" , Josh Triplett , Matt Turner , Ivan Kokshaysky , Richard Henderson , Peter Zijlstra , Alan Stern , Michael Ellerman , "Michael S. Tsirkin" , Jason Wang , Joe Perches , Boqun Feng , alpha , virtualization@lists.linux-foundation.org On Mon, Nov 11, 2019 at 10:32:46AM +0100, Arnd Bergmann wrote: > On Mon, Nov 11, 2019 at 9:10 AM Christian Borntraeger > wrote: > > On 08.11.19 20:57, Arnd Bergmann wrote: > > > On Fri, Nov 8, 2019 at 6:01 PM Will Deacon wrote: > > >> > > >> In preparation for allowing architectures to define their own > > >> implementation of the 'READ_ONCE()' macro, move the generic > > >> '{READ,WRITE}_ONCE()' definitions out of the unwieldy 'linux/compile= r.h' > > >> and into a new 'rwonce.h' header under 'asm-generic'. > > > > > > Adding Christian Borntr=E4ger to Cc, he originally added the > > > READ_ONCE()/WRITE_ONCE() > > > code. > > > > > > I wonder if it would be appropriate now to revert back to a much simp= ler version > > > of these helpers for any modern compiler. As I understand, only gcc-4= .6 and > > > gcc4.7 actually need the song-and-dance version with the union and sw= itch/case, > > > while for others, we can might be able back to a macro doing a volati= le access. > > > > As far as I know this particular issue with volatile access on aggrega= te types > > was fixed in gcc 4.8. On the other hand we know that the current constr= uct will > > work on all compilers. Not so sure about the orignal ACCESS_ONCE implem= entation. >=20 > I've seen problems with clang on the current version, leading to unnecess= ary > temporaries being spilled to the stack in some cases, so I think it would= still > help to simplify it. >=20 > We probably don't want the exact ACCESS_ONCE() implementation back > that existed before, but rather something that implements the stricter > READ_ONCE() and WRITE_ONCE(). I'd probably also want to avoid the > __builtin_memcpy() exception for odd-sized accesses and instead have > a separate way to do those. If you have a patch, I'm happy to carry it at the end of the series to avoid conflicts. It's not completely clear to me what you're after, so if you need me to adjust anything here then please shout! Will