[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z9m_kUqxqMPfU8Fl@gmail.com>
Date: Tue, 18 Mar 2025 19:46:41 +0100
From: Ingo Molnar <mingo@...nel.org>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: "H. Peter Anvin" <hpa@...or.com>, linux-kernel@...r.kernel.org,
Juergen Gross <jgross@...e.com>,
Stefano Stabellini <sstabellini@...nel.org>,
"Ahmed S . Darwish" <darwi@...utronix.de>,
Andrew Cooper <andrew.cooper3@...rix.com>,
John Ogness <john.ogness@...utronix.de>,
Peter Zijlstra <peterz@...radead.org>,
Borislav Petkov <bp@...en8.de>,
Thomas Gleixner <tglx@...utronix.de>
Subject: Re: [PATCH 0/5] x86/cpu: Introduce <asm/cpuid/types.h> and
<asm/cpuid/api.h> and clean them up
* Linus Torvalds <torvalds@...ux-foundation.org> wrote:
> On Tue, 18 Mar 2025 at 11:04, Ingo Molnar <mingo@...nel.org> wrote:
> >
> > plus we could implement the main CPUID call as:
> >
> > static inline void native_cpuid(struct cpuid_regs *cregs)
> > {
> > /* ecx is often an input as well as an output. */
> > asm volatile("cpuid"
>
> So this really needs "asm inline" now. Because if it's not inlined, it
> generates horrific code.
>
> Anyway, I agree with whoever (hpa?) said we should probably just
> unconditionally make all "asm" be "__asm__ __inline__" .
Yeah, it was hpa, and I was thinking about that approach today, and was
about to write a "don't want to do such a big binary change without
Linus's buy-in" reply ...
... and problem solved. ;-)
> And then *if* there are any places that want to out-line the asm (why
> would you do that? At that point you'd be better off just writing
> assembler!), they could use an explicit __asm__ instead with a
> comment.
>
> Sadly, I think doing just a mindless
>
> #define asm(...) __asm__ __inline__(__VA_ARGS__)
>
> doesn't work, because we also have
>
> register void *tos asm("r11");
>
> kind of patterns.
>
> So first we'd have to change those to use __asm__(), and *then* we
> could do the "asm() is always __asm__ __inline__()" thing.
Yeah, I'll try this out. Should this be done for all architectures, or
just for x86 for the time being?
I'm not sure an arch opt-in is worth it, it will only end up in the
active architectures picking it, but none of the others, and we'll live
with the duality forever.
Thanks,
Ingo
Powered by blists - more mailing lists