[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210225225425.GH4746@worktop.programming.kicks-ass.net>
Date: Thu, 25 Feb 2021 23:54:25 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Nick Desaulniers <ndesaulniers@...gle.com>
Cc: Borislav Petkov <bp@...en8.de>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
the arch/x86 maintainers <x86@...nel.org>,
Nathan Chancellor <nathan@...nel.org>,
Arnd Bergmann <arnd@...db.de>,
"H. Peter Anvin" <hpa@...or.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
clang-built-linux <clang-built-linux@...glegroups.com>,
Arnd Bergmann <arnd@...nel.org>,
Arthur Eubanks <aeubanks@...gle.com>,
Chandler Carruth <chandlerc@...gle.com>
Subject: Re: [PATCH] x86: mark some mpspec inline functions as __init
On Thu, Feb 25, 2021 at 12:31:33PM -0800, Nick Desaulniers wrote:
> Q: But I put the `inline` keyword on the callee?
> A: Probably deserves its own post, but the `inline` keyword doesn't
> mean what any rational initial impression would suppose. Language in
> the standard refers to "inline substitution" and grants a lot of
> leeway to implementations in terms of whether it's performed at all.
That's just weasle wording to do the wrong thing :/ GCC (and other
compilers) have been saying inline is a valid substitute for macros. You
then reading the spec and saying we can do this ass backwards and
screw everybody who's been expecting things to top-down is just not
acceptible.
The C spec is notoriously bad, because it fails to actually specify and
then we get shit like this :-( And if you then take that 'freedom' and
implement behaviour that 'doesn't mean what any rational initial
impression would suppose', then you're just being a twat.
Life is hard enough without compilers trying to screw you over on
purpose :/
> There are cases where even with "always_inline" fn attr is applied,
> and the compiler says "that's nice, but I still cannot perform inline
> substitution here, I'm sorry."
That's a hard fail from where I'm sitting. Can we please get a compiler
error when that happens? That is, we're relying on this for correctness,
if the compiler then goes and ignores it, we've got *serious* problems.
This really MUST NOT happen.
And I'm not joking, I can get you a non-booting kernel by removing just
a few __always_inline in the right place.
> There are no silver bullets here. It's semantics have
> changed since its introduction,
That isn't our doing, if the compiler redefines its keywords, don't tell
us our program is broken. You're the ones that have been changing the
meaning of thigs.
> and I have seen rare uses that make my skin crawl.
Do tell...
Powered by blists - more mailing lists