Re: [PATCH 0/5] x86/cpu: Introduce <asm/cpuid/types.h> and <asm/cpuid/api.h> and clean them up

From: Linus Torvalds
Date: Tue Mar 18 2025 - 14:34:17 EST


On Tue, 18 Mar 2025 at 11:04, Ingo Molnar <mingo@xxxxxxxxxx> 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__" .

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.

Linus