Re: [PATCH v1 8/9] x86/cpuid: Rename native_cpuid() to cpuid_native()

"Ahmed S. Darwish" <[email protected]>
Newsgroups dev.linux.lists.x86-cpuid,org.kernel.vger.linux-kernel
Message-ID <aCY1j0AksHZQvmWQ@lx-t490>
On Thu, 15 May 2025, Ingo Molnar wrote:
>
> * Ahmed S. Darwish <[email protected]> wrote:
> >
> > diff --git a/arch/x86/boot/compressed/sev.c b/arch/x86/boot/compressed/sev.c
> > index f054bf52c10a..4b617f8f9b7f 100644
> > --- a/arch/x86/boot/compressed/sev.c
> > +++ b/arch/x86/boot/compressed/sev.c
> > @@ -494,7 +494,7 @@ static int sev_check_cpu_support(void)
> >  	/* Check for the SME/SEV support leaf */
> >  	eax = 0x80000000;
> >  	ecx = 0;
> > -	native_cpuid(&eax, &ebx, &ecx, &edx);
> > +	cpuid_native(&eax, &ebx, &ecx, &edx);
> >  	if (eax < 0x8000001f)
> >  		return -ENODEV;
>
> I'm torn about this one.
>
> native_*() is a pretty generic way to denote baremetal methods, all
> around the x86 tree:
>
>   starship:~/tip> git grep -E '\<native_' arch/x86/ | wc -l
>   682
...
>
> I think it might be better to leave these as native_cpuid_*, because
> shifting a naming inconsistency into another namespace isn't really a
> net improvement.
>

Yeah, I admit I was a little bit uncomfortable about this one, especially
when modifying a call-site like:

    => arch/x86/kernel/paravirt.c:
    struct paravirt_patch_template pv_ops = {
	.cpu.io_delay		= native_io_delay,
	.cpu.cpuid		= cpuid_native,		// stands out
	.cpu.read_cr0		= native_read_cr0,
	.cpu.write_cr0		= native_write_cr0,
	.cpu.write_cr4		= native_write_cr4,
	.cpu.read_msr		= native_read_msr,
	...
    };

So, indeed, ACK.

Thanks!
~ Ahmed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.