[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Zz0m-19axUhZb_1w@gmail.com>
Date: Wed, 20 Nov 2024 01:02:03 +0100
From: Ingo Molnar <mingo@...nel.org>
To: Linus Torvalds <torvalds@...ux-foundation.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
* Linus Torvalds <torvalds@...ux-foundation.org> wrote:
> 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?"
Indeed - sorry about that, will sort this out tomorrow.
Thanks,
Ingo
Powered by blists - more mailing lists