The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: "H. Peter Anvin" <hpa@zytor.com>, Borislav Petkov <bp@alien8.de>,
	Tony Luck <tony.luck@intel.com>
Cc: Ingo Molnar <mingo@redhat.com>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	x86@kernel.org, "Peter Zijlstra (Intel)" <peterz@infradead.org>,
	Uros Bizjak <ubizjak@gmail.com>,
	Rick Edgecombe <rick.p.edgecombe@intel.com>,
	Arnd Bergmann <arnd@arndb.de>, Mateusz Guzik <mjguzik@gmail.com>,
	Thomas Renninger <trenn@suse.de>,
	Greg Kroah-Hartman <gregkh@suse.de>,
	Andi Kleen <ak@linux.intel.com>,
	linux-kernel@vger.kernel.org, patches@lists.linux.dev
Subject: Re: [PATCH v2] x86/cpu: Fix x86_match_cpu() to match just X86_VENDOR_INTEL
Date: Fri, 17 May 2024 22:41:21 +0200	[thread overview]
Message-ID: <87h6ewjhn2.ffs@tglx> (raw)
In-Reply-To: <863D0F06-1217-4C94-B2CA-816FC4ABB103@zytor.com>

On Fri, May 17 2024 at 10:35, H. Peter Anvin wrote:
> On May 17, 2024 7:43:12 AM PDT, Borislav Petkov <bp@alien8.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

  parent reply	other threads:[~2024-05-17 20:41 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-16 16:29 [PATCH v2] x86/cpu: Fix x86_match_cpu() to match just X86_VENDOR_INTEL Tony Luck
2024-05-16 21:27 ` Luck, Tony
2024-05-17 14:43 ` Borislav Petkov
2024-05-17 17:35   ` H. Peter Anvin
2024-05-17 18:17     ` Luck, Tony
2024-05-17 20:42       ` Thomas Gleixner
2024-05-17 20:41     ` Thomas Gleixner [this message]
2024-05-17 20:54       ` Luck, Tony
2024-05-20 23:33         ` H. Peter Anvin
2024-05-22  9:47   ` [tip: x86/urgent] " tip-bot2 for Tony Luck

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=87h6ewjhn2.ffs@tglx \
    --to=tglx@linutronix.de \
    --cc=ak@linux.intel.com \
    --cc=arnd@arndb.de \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=gregkh@suse.de \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=mjguzik@gmail.com \
    --cc=patches@lists.linux.dev \
    --cc=peterz@infradead.org \
    --cc=rick.p.edgecombe@intel.com \
    --cc=tony.luck@intel.com \
    --cc=trenn@suse.de \
    --cc=ubizjak@gmail.com \
    --cc=x86@kernel.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