Re: [PATCH] locking/local_lock: Don't evaluate the per-CPU lock pointer if unused
From: Ard Biesheuvel
Date: Mon Nov 23 2026 - 17:16:11 EST
On Mon, 23 Nov 2026, at 22:52, Nick Desaulniers wrote:
> On Mon, Nov 23, 2026 at 1:23 PM Ard Biesheuvel <ardb@xxxxxxxxxx> wrote:
>>
>>
>> On Mon, 23 Nov 2026, at 20:12, Nick Desaulniers wrote:
>> > Very detailed commit message, but you kind of bury the lede here on
>> > what the actual problem this patch is fixing *is*.
>> >
>>
>> Apologies. I'll trim it down,
>>
>> The TL;DR is that non-volatile asm() statements with memory input
>> operands are not elided by Clang if their output is never used.
>
> That's not a bug; both Clang and GCC behave that way.
> https://godbolt.org/z/sEhec4oae
>
Try changing that to
asm("# hello world %0": "=r"(x) :"m"(x));
(and don't touch x afterwards)