[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=wiv6dgJDj81wukpJCJBVhAVn-CYJdhj+o8JGN1LfRwb0g@mail.gmail.com>
Date: Wed, 27 Feb 2019 08:14:09 -0800
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Ingo Molnar <mingo@...nel.org>, Borislav Petkov <bp@...en8.de>,
Thomas Gleixner <tglx@...utronix.de>,
Andrew Lutomirski <luto@...nel.org>,
Nadav Amit <namit@...are.com>,
Linux List Kernel Mailing <linux-kernel@...r.kernel.org>,
Nadav Amit <nadav.amit@...il.com>
Subject: Re: [PATCH 1/5] x86/percpu: Differentiate this_cpu_{}() and __this_cpu_{}()
On Wed, Feb 27, 2019 at 2:16 AM Peter Zijlstra <peterz@...radead.org> wrote:
>
> Nadav Amit reported that commit:
>
> b59167ac7baf ("x86/percpu: Fix this_cpu_read()")
>
> added a bunch of constraints to all sorts of code; and while some of
> that was correct and desired, some of that seems superfluous.
Hmm.
I have the strong feeling that we should instead relax this_cpu_read()
again a bit.
In particular, making it "asm volatile" really is a big hammer
approach. It's worth noting that the *other* this_cpu_xyz ops don't
even do that.
I would suggest that instead of making "this_cpu_read()" be asm
volatile, we mark it as potentially changing the memory location it is
touching - the same way the modify/write ops do.
That still means that the read will be forced (like READ_ONCE()), but
allows gcc a bit more flexibility in instruction scheduling, I think.
Trivial (but entirely untested) patch attached.
That said, I didn't actually check how it affects code generation.
Nadav, would you check the code sequences you originally noticed?
Linus
View attachment "patch.diff" of type "text/x-patch" (1348 bytes)
Powered by blists - more mailing lists