[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAFULd4amFXV1WB0O64BihiLCtmZw5B65Rf=7dTtni5fnvBoPWQ@mail.gmail.com>
Date: Sun, 3 Dec 2023 23:49:51 +0100
From: Uros Bizjak <ubizjak@...il.com>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: x86@...nel.org, linux-kernel@...r.kernel.org,
Andy Lutomirski <luto@...nel.org>,
Brian Gerst <brgerst@...il.com>,
Denys Vlasenko <dvlasenk@...hat.com>,
Ingo Molnar <mingo@...nel.org>,
"H . Peter Anvin" <hpa@...or.com>,
Peter Zijlstra <peterz@...radead.org>,
Thomas Gleixner <tglx@...utronix.de>,
Josh Poimboeuf <jpoimboe@...hat.com>
Subject: Re: [PATCH -tip 1/3] x86/percpu: Fix "const_pcpu_hot" version
generation failure
On Sun, Dec 3, 2023 at 11:19 PM Linus Torvalds
<torvalds@...ux-foundation.org> wrote:
>
> On Mon, 4 Dec 2023 at 07:12, Uros Bizjak <ubizjak@...il.com> wrote:
> >
> > +/*
> > + * The generic per-cpu infrastrucutre is not suitable for
> > + * reading const-qualified variables.
> > + */
> > +#define this_cpu_read_const(pcp) ({ BUG(); (typeof(pcp))0; })
>
> NAK. Absolutely not.
>
> No way in hell is it acceptable to make this a run-time BUG. If it
> doesn't work, it needs to be a compile failure. End of story.
Thanks - BUILD_BUG() also works here and is indeed more appropriate:
/**
* BUILD_BUG - break compile if used.
*
* If you have some code that you expect the compiler to eliminate at
* build time, you should use BUILD_BUG to detect if it is
* unexpectedly used.
*/
v2 is in testing.
Thanks,
Uros.
Powered by blists - more mailing lists