From: Ingo Molnar <mingo@kernel.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: "H. Peter Anvin" <hpa@zytor.com>,
linux-kernel@vger.kernel.org, Juergen Gross <jgross@suse.com>,
Stefano Stabellini <sstabellini@kernel.org>,
"Ahmed S . Darwish" <darwi@linutronix.de>,
Andrew Cooper <andrew.cooper3@citrix.com>,
John Ogness <john.ogness@linutronix.de>,
Peter Zijlstra <peterz@infradead.org>,
Borislav Petkov <bp@alien8.de>,
Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH 0/5] x86/cpu: Introduce <asm/cpuid/types.h> and <asm/cpuid/api.h> and clean them up
Date: Tue, 18 Mar 2025 19:46:41 +0100 [thread overview]
Message-ID: <Z9m_kUqxqMPfU8Fl@gmail.com> (raw)
In-Reply-To: <CAHk-=whAUHyXM29_9w_T26=15D1KZnuR3R+f4MT9f-C89oukvA@mail.gmail.com>
* Linus Torvalds <torvalds@linux-foundation.org> wrote:
> On Tue, 18 Mar 2025 at 11:04, Ingo Molnar <mingo@kernel.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
next prev parent reply other threads:[~2025-03-18 18:46 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-17 22:18 [PATCH 0/5] x86/cpu: Introduce <asm/cpuid/types.h> and <asm/cpuid/api.h> and clean them up Ingo Molnar
2025-03-17 22:18 ` [PATCH 1/5] x86/cpuid: Refactor <asm/cpuid.h> Ingo Molnar
2025-03-18 12:00 ` [tip: x86/cpu] " tip-bot2 for Ahmed S. Darwish
2025-03-19 11:03 ` [tip: x86/core] " tip-bot2 for Ahmed S. Darwish
2025-03-17 22:18 ` [PATCH 2/5] x86/cpuid: Clean up <asm/cpuid/types.h> Ingo Molnar
2025-03-18 12:00 ` [tip: x86/cpu] " tip-bot2 for Ingo Molnar
2025-03-19 11:03 ` [tip: x86/core] " tip-bot2 for Ingo Molnar
2025-03-17 22:18 ` [PATCH 3/5] x86/cpuid: Clean up <asm/cpuid/api.h> Ingo Molnar
2025-03-18 12:00 ` [tip: x86/cpu] " tip-bot2 for Ingo Molnar
2025-03-19 11:03 ` [tip: x86/core] " tip-bot2 for Ingo Molnar
2025-03-17 22:18 ` [PATCH 4/5] x86/cpuid: Standardize on u32 in <asm/cpuid/api.h> Ingo Molnar
2025-03-18 5:59 ` Xin Li
2025-03-18 12:00 ` [tip: x86/cpu] " tip-bot2 for Ingo Molnar
2025-03-19 11:03 ` [tip: x86/core] " tip-bot2 for Ingo Molnar
2025-03-17 22:18 ` [PATCH 5/5] x86/cpuid: Use u32 in instead of uint32_t " Ingo Molnar
2025-03-18 6:01 ` Xin Li
2025-03-18 8:34 ` Ingo Molnar
2025-03-18 9:37 ` Borislav Petkov
2025-03-18 11:53 ` Ingo Molnar
2025-03-18 12:15 ` Borislav Petkov
2025-03-18 18:20 ` Ingo Molnar
2025-03-19 8:08 ` Thomas Gleixner
2025-03-19 20:16 ` Ingo Molnar
2025-03-18 12:00 ` [tip: x86/cpu] " tip-bot2 for Ingo Molnar
2025-03-19 11:03 ` [tip: x86/core] " tip-bot2 for Ingo Molnar
2025-03-18 14:05 ` [PATCH 0/5] x86/cpu: Introduce <asm/cpuid/types.h> and <asm/cpuid/api.h> and clean them up H. Peter Anvin
2025-03-18 18:04 ` Ingo Molnar
2025-03-18 18:33 ` Linus Torvalds
2025-03-18 18:46 ` Ingo Molnar [this message]
2025-03-18 20:11 ` [PATCH] compiler/gcc: Make asm() templates asm __inline__() by default Ingo Molnar
2025-03-18 22:07 ` Josh Poimboeuf
2025-03-19 4:57 ` Uros Bizjak
2025-03-19 22:34 ` Ingo Molnar
2025-03-20 8:21 ` Uros Bizjak
2025-03-20 8:59 ` Ingo Molnar
2025-03-20 10:30 ` Uros Bizjak
2025-03-20 11:58 ` Uros Bizjak
2025-03-19 3:30 ` [PATCH 0/5] x86/cpu: Introduce <asm/cpuid/types.h> and <asm/cpuid/api.h> and clean them up H. Peter Anvin
-- strict thread matches above, loose matches on Subject: below --
2025-03-17 22:30 mingo
2025-03-17 22:49 ` Linus Torvalds
2025-03-17 23:00 ` Ingo Molnar
2025-03-18 11:39 ` Ahmed S. Darwish
2025-03-18 11:55 ` Ingo Molnar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Z9m_kUqxqMPfU8Fl@gmail.com \
--to=mingo@kernel.org \
--cc=andrew.cooper3@citrix.com \
--cc=bp@alien8.de \
--cc=darwi@linutronix.de \
--cc=hpa@zytor.com \
--cc=jgross@suse.com \
--cc=john.ogness@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=sstabellini@kernel.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox