[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190227164806.GS32494@hirez.programming.kicks-ass.net>
Date: Wed, 27 Feb 2019 17:48:06 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Linus Torvalds <torvalds@...ux-foundation.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 08:14:09AM -0800, Linus Torvalds wrote:
> 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.
Right, this patch 'fixes' 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.
Ah, fair enough, I'll spin a version of this patch with "+m" for
this_cpu and "m" for raw_cpu.
> That said, I didn't actually check how it affects code generation.
> Nadav, would you check the code sequences you originally noticed?
Much of it was the ONCE behaviour defeating CSE I think, but yes, it
would be good to have another look.
Powered by blists - more mailing lists