[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87h6ewjhn2.ffs@tglx>
Date: Fri, 17 May 2024 22:41:21 +0200
From: Thomas Gleixner <tglx@...utronix.de>
To: "H. Peter Anvin" <hpa@...or.com>, Borislav Petkov <bp@...en8.de>, Tony
Luck <tony.luck@...el.com>
Cc: Ingo Molnar <mingo@...hat.com>, Dave Hansen
<dave.hansen@...ux.intel.com>, x86@...nel.org, "Peter Zijlstra (Intel)"
<peterz@...radead.org>, Uros Bizjak <ubizjak@...il.com>, Rick Edgecombe
<rick.p.edgecombe@...el.com>, Arnd Bergmann <arnd@...db.de>, Mateusz Guzik
<mjguzik@...il.com>, Thomas Renninger <trenn@...e.de>, Greg Kroah-Hartman
<gregkh@...e.de>, Andi Kleen <ak@...ux.intel.com>,
linux-kernel@...r.kernel.org, patches@...ts.linux.dev
Subject: Re: [PATCH v2] x86/cpu: Fix x86_match_cpu() to match just
X86_VENDOR_INTEL
On Fri, May 17 2024 at 10:35, H. Peter Anvin wrote:
> On May 17, 2024 7:43:12 AM PDT, Borislav Petkov <bp@...en8.de> wrote:
>>And then do:
>>
>>struct x86_cpu_id {
>> __u16 vendor;
>> __u16 family;
>> __u16 model;
>> __u16 steppings;
>> __u16 feature; /* bit index */
>> __u16 flags;
>> kernel_ulong_t driver_data;
>>};
>>
>>#define X86_CPU_ID_FLAG_VENDOR_VALID BIT(0)
>>
>>and then have the macros in arch/x86/include/asm/cpu_device_id.h set
>>that valid flag and then have x86_match_cpu() check it.
>>
>>Then you don't risk a userspace breakage and that x86_match_cpu() crap
>>thing is fixed.
>
> I'm confused. Why not simply use say -1 for wildcard vendor match, -2
> for no vendor ID (no CPUID or other known probing mechanism) and -3
> for unrecognized vendor (vendor detectable but not known.)
This has nothing to do with wildcards.
The problem at hand is about loop termination. Making that explicit by
having a valid bit in the existing struct hole is trivial, straight
forward and just works obviously correct.
> I *hate* these strings with the passion of a thousand suns: they are a
> classic case of how just blindly converting binary information to hex
> adds absolutely no value, and often makes the result worse than what
> one started with. And yes, I complained about that when they first
> went in as a classic case of exposing what was always simply intended
> as a kernel internal interface to user space.
You obviously did not complain loud enough :)
> This is particularly pathetic as there already is a canonical string
> representation of the vendor ID!
I agree, but that train has left the station long ago,
Thanks,
tglx
Powered by blists - more mailing lists