[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=wh81PAKxapicYOby3WWOFJV2htR5KWCRdKNgw68mOc0Zg@mail.gmail.com>
Date: Wed, 23 Mar 2022 10:17:08 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
Cc: Borislav Petkov <bp@...en8.de>, Ingo Molnar <mingo@...nel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Peter Zijlstra <peterz@...radead.org>,
Will Deacon <will@...nel.org>,
Waiman Long <longman@...hat.com>,
Boqun Feng <boqun.feng@...il.com>,
Thomas Gleixner <tglx@...utronix.de>,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH] locking/local_lock: Pretend to use the per-CPU variable
if not needed.
On Wed, Mar 23, 2022 at 4:09 AM Sebastian Andrzej Siewior
<bigeasy@...utronix.de> wrote:
>
> Replace this_cpu_ptr() with __ll_cpu_ptr() which points to
> this_cpu_ptr() when it is used.
Ok, so that's just really ugly.
Is there really no way to just fixthis_cpu_ptr() to not generate crap
code when the result isn't used?
I get the feeling that the real problem is that on x86, we have this:
#define arch_raw_cpu_ptr(ptr) \
({ \
unsigned long tcp_ptr__; \
asm volatile("add " __percpu_arg(1) ", %0" \
: "=r" (tcp_ptr__) \
: "m" (this_cpu_off), "0" (ptr)); \
(typeof(*(ptr)) __kernel __force *)tcp_ptr__; \
})
and that "volatile" is just *WRONG*.
That volatile is what literally tells the compiler "you can't remove
this if it isn't used".
But there's no point to that.
So how about we
(a) just revert commit 9983a9d577db4
(b) remove that bogus 'volatile'
Doesn't that fix the problem?
Linus
Powered by blists - more mailing lists