[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=wi8C2yZF_y_T180-v+dSZAhps5QghS_2tKfn-+xAghYPQ@mail.gmail.com>
Date: Tue, 19 Nov 2024 12:56:31 -0800
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Ingo Molnar <mingo@...nel.org>
Cc: linux-kernel@...r.kernel.org, Peter Zijlstra <peterz@...radead.org>,
Thomas Gleixner <tglx@...utronix.de>, Will Deacon <will@...nel.org>, Waiman Long <longman@...hat.com>,
Boqun Feng <boqun.feng@...il.com>, Borislav Petkov <bp@...en8.de>
Subject: Re: [GIT PULL] locking changes for v6.13
On Mon, 18 Nov 2024 at 01:03, Ingo Molnar <mingo@...nel.org> wrote:
>
> - <linux/cleanup.h>:
> - Add if_not_cond_guard() conditional guard helper (David Lechner)
I've pulled this, but I'm unhappy.
This macro generates actively wrong code if it happens to be inside an
if-statement or a loop without a block.
IOW, code like this:
for (iterate-over-something)
if_not_guard(a)
return -BUSY;
looks like will build fine, but will generate completely incorrect code.
Honestly, just switching the order of the BUILD_BUG_ON() and the
CLASS() declaration looks like it would have fixed this (because then
the '_id' won't be in scope of the subsequent if-statement any more),
but I'm unhappy with how apparently nobody even bothered to think
about such a fundamental issue with macros.
Macros that expand to statements absolutely *ALWAYS* need to deal with
"what if we're in a single-statement situation?"
Linus
Powered by blists - more mailing lists