[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200113161606.GD4458@willie-the-truck>
Date: Mon, 13 Jan 2020 16:16:06 +0000
From: Will Deacon <will@...nel.org>
To: Arnd Bergmann <arnd@...db.de>
Cc: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
linux-arch <linux-arch@...r.kernel.org>,
Android Kernel Team <kernel-team@...roid.com>,
Michael Ellerman <mpe@...erman.id.au>,
Peter Zijlstra <peterz@...radead.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Segher Boessenkool <segher@...nel.crashing.org>,
Christian Borntraeger <borntraeger@...ibm.com>,
Luc Van Oostenryck <luc.vanoostenryck@...il.com>
Subject: Re: [RFC PATCH 5/8] READ_ONCE: Enforce atomicity for
{READ,WRITE}_ONCE() memory accesses
On Fri, Jan 10, 2020 at 08:24:00PM +0100, Arnd Bergmann wrote:
> On Fri, Jan 10, 2020 at 5:56 PM Will Deacon <will@...nel.org> wrote:
>
> > +/*
> > + * Use __READ_ONCE() instead of READ_ONCE() if you do not require any
> > + * atomicity or dependency ordering guarantees. Note that this may result
> > + * in tears!
> > + */
> > +#define __READ_ONCE(x) (*(volatile typeof(x) *)&(x))
> > +
>
> This probably allows writing
>
> extern int i;
> __READ_ONCE(i) = 1;
>
> and not get a warning for it. How about also casting to 'const'?
Well spotted! I'll fold that in.
Will
Powered by blists - more mailing lists