lkml.org 
[lkml]   [2020]   [Nov]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v4 4/4] arm64: lto: Strengthen READ_ONCE() to acquire when CONFIG_LTO=y
On Tue, Nov 03, 2020 at 12:58:45PM +0000, Mark Rutland wrote:
> On Tue, Nov 03, 2020 at 12:17:21PM +0000, Will Deacon wrote:
> > When building with LTO, there is an increased risk of the compiler
> > converting an address dependency headed by a READ_ONCE() invocation
> > into a control dependency and consequently allowing for harmful
> > reordering by the CPU.
> >
> > Ensure that such transformations are harmless by overriding the generic
> > READ_ONCE() definition with one that provides acquire semantics when
> > building with LTO.
> >
> > Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
> > Signed-off-by: Will Deacon <will@kernel.org>
>
> [...]
>
> Could we add a note above __READ_ONCE() along the lines of the commit
> message, e.g.
>
> /*
> * With LTO a compiler might convert an address dependency headed by a
> * READ_ONCE() into a control dependency, allowing for harmful
> * reordering by the CPU.
> *
> * To prevent this, upgrade READ_OONCE() to provide acquire semantics
> * when building with LTO.

It's not halloween any moooore :)

But yes, I'll add something to that effect, cheers.

Will

\
 
 \ /
  Last update: 2020-11-03 14:14    [W:0.106 / U:0.488 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site