* Re: [PATCH 4/6] x86/cpu: Add platform ID to CPU info structure
@ 2026-01-20 14:34 Maciej Wieczor-Retman
2026-01-20 15:13 ` Dave Hansen
0 siblings, 1 reply; 17+ messages in thread
From: Maciej Wieczor-Retman @ 2026-01-20 14:34 UTC (permalink / raw)
To: Dave Hansen
Cc: linux-kernel, sohil.mehta, Borislav Petkov, H. Peter Anvin,
Ingo Molnar, Jon Kohler, Pawan Gupta, Peter Zijlstra (Intel),
Thomas Gleixner, Tony Luck, x86
On 2026-01-19 at 11:50:55 -0800, Dave Hansen wrote:
>
>From: Dave Hansen <dave.hansen@linux.intel.com>
>
>The end goal here is to be able to do x86_match_cpu() and match on a
>specific platform ID. While it would be possible to stash this ID
>off somewhere or read it dynamically, that approaches would not be
>consistent with the other fields which can be matched.
>
>Read the platform ID and store it in cpuinfo_x86->x86_platform_id.
>
>There are lots of sites to set this new field. Place it near
>the place c->microcode is established since the platform ID is
>so closely intertwined with microcode updates.
>
>Note: This should not grow the size of 'struct cpuinfo_x86' in
>practice since the u8 fits next to another u8 in the structure.
>
>Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
>Cc: Thomas Gleixner <tglx@kernel.org>
>Cc: Ingo Molnar <mingo@redhat.com>
>Cc: Borislav Petkov <bp@alien8.de>
>Cc: Dave Hansen <dave.hansen@linux.intel.com>
>Cc: "H. Peter Anvin" <hpa@zytor.com>
>Cc: Tony Luck <tony.luck@intel.com>
>Cc: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
>Cc: "Peter Zijlstra (Intel)" <peterz@infradead.org>
>Cc: x86@kernel.org
>Cc: Jon Kohler <jon@nutanix.com>
>---
>
> b/arch/x86/include/asm/processor.h | 1 +
> b/arch/x86/kernel/cpu/common.c | 4 +++-
> b/arch/x86/kernel/cpu/intel.c | 1 +
> 3 files changed, 5 insertions(+), 1 deletion(-)
>
>diff -puN arch/x86/include/asm/processor.h~cpu-x86_stepping arch/x86/include/asm/processor.h
>--- a/arch/x86/include/asm/processor.h~cpu-x86_stepping 2026-01-19 11:38:09.341914025 -0800
>+++ b/arch/x86/include/asm/processor.h 2026-01-19 11:38:09.444917962 -0800
>@@ -140,6 +140,7 @@ struct cpuinfo_x86 {
> __u32 x86_vfm;
> };
> __u8 x86_stepping;
>+ __u8 x86_platform_id; /* Intel-only. 3 bits */
Should platform ID be added to print_cpu_info()?
So it's printed alongside (family: 0xN model: 0xN, stepping: 0xN)
--
Kind regards
Maciej Wieczór-Retman
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 4/6] x86/cpu: Add platform ID to CPU info structure
2026-01-20 14:34 [PATCH 4/6] x86/cpu: Add platform ID to CPU info structure Maciej Wieczor-Retman
@ 2026-01-20 15:13 ` Dave Hansen
2026-01-20 16:03 ` Maciej Wieczor-Retman
0 siblings, 1 reply; 17+ messages in thread
From: Dave Hansen @ 2026-01-20 15:13 UTC (permalink / raw)
To: Maciej Wieczor-Retman, Dave Hansen
Cc: linux-kernel, sohil.mehta, Borislav Petkov, H. Peter Anvin,
Ingo Molnar, Jon Kohler, Pawan Gupta, Peter Zijlstra (Intel),
Thomas Gleixner, Tony Luck, x86
On 1/20/26 06:34, Maciej Wieczor-Retman wrote:
>> __u8 x86_stepping;
>> + __u8 x86_platform_id; /* Intel-only. 3 bits */
> Should platform ID be added to print_cpu_info()?
>
> So it's printed alongside (family: 0xN model: 0xN, stepping: 0xN)
It's not a horrible idea, but it's also relatively worthless compared to
the other three. I'd certainly take a look at it if someone sent a
patch, but I'm not really looking to add more to this series that
doesn't _need_ to be here.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 4/6] x86/cpu: Add platform ID to CPU info structure
2026-01-20 15:13 ` Dave Hansen
@ 2026-01-20 16:03 ` Maciej Wieczor-Retman
2026-01-20 16:12 ` Dave Hansen
0 siblings, 1 reply; 17+ messages in thread
From: Maciej Wieczor-Retman @ 2026-01-20 16:03 UTC (permalink / raw)
To: Dave Hansen
Cc: Dave Hansen, linux-kernel, sohil.mehta, Borislav Petkov,
H. Peter Anvin, Ingo Molnar, Jon Kohler, Pawan Gupta,
Peter Zijlstra (Intel),
Thomas Gleixner, Tony Luck, x86
On 2026-01-20 at 07:13:31 -0800, Dave Hansen wrote:
>On 1/20/26 06:34, Maciej Wieczor-Retman wrote:
>>> __u8 x86_stepping;
>>> + __u8 x86_platform_id; /* Intel-only. 3 bits */
>> Should platform ID be added to print_cpu_info()?
>>
>> So it's printed alongside (family: 0xN model: 0xN, stepping: 0xN)
>
>It's not a horrible idea, but it's also relatively worthless compared to
>the other three. I'd certainly take a look at it if someone sent a
>patch, but I'm not really looking to add more to this series that
>doesn't _need_ to be here.
Fair enough, and I suppose if someone really needs this information they can
just read the MSR themselves.
--
Kind regards
Maciej Wieczór-Retman
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 4/6] x86/cpu: Add platform ID to CPU info structure
2026-01-20 16:03 ` Maciej Wieczor-Retman
@ 2026-01-20 16:12 ` Dave Hansen
0 siblings, 0 replies; 17+ messages in thread
From: Dave Hansen @ 2026-01-20 16:12 UTC (permalink / raw)
To: Maciej Wieczor-Retman
Cc: Dave Hansen, linux-kernel, sohil.mehta, Borislav Petkov,
H. Peter Anvin, Ingo Molnar, Jon Kohler, Pawan Gupta,
Peter Zijlstra (Intel),
Thomas Gleixner, Tony Luck, x86
On 1/20/26 08:03, Maciej Wieczor-Retman wrote:
> On 2026-01-20 at 07:13:31 -0800, Dave Hansen wrote:
>> On 1/20/26 06:34, Maciej Wieczor-Retman wrote:
>>>> __u8 x86_stepping;
>>>> + __u8 x86_platform_id; /* Intel-only. 3 bits */
>>> Should platform ID be added to print_cpu_info()?
>>>
>>> So it's printed alongside (family: 0xN model: 0xN, stepping: 0xN)
>> It's not a horrible idea, but it's also relatively worthless compared to
>> the other three. I'd certainly take a look at it if someone sent a
>> patch, but I'm not really looking to add more to this series that
>> doesn't _need_ to be here.
> Fair enough, and I suppose if someone really needs this information they can
> just read the MSR themselves.
Right. If they get some weird "old_microcode" output, they can go use
rdmsr(1) to debug it if they're root. It might make debugging issues a
_wee_ bit easier to have the platform_id in dmesg, but it's only used in
two places in the kernel, so the value is *MUCH* lower than
family/model/stepping which are used all over.
Also, despite being 6 patches, this series is _just_ about as small as I
can make it to fix the bug at hand. Even if we decided a pr_whatever()
would be really nice, it's not a bug fix and would (IMNHO) need to be in
a separate series.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 4/6] x86/cpu: Add platform ID to CPU info structure
2026-02-11 18:40 ` Dave Hansen
@ 2026-02-12 15:22 ` Borislav Petkov
0 siblings, 0 replies; 17+ messages in thread
From: Borislav Petkov @ 2026-02-12 15:22 UTC (permalink / raw)
To: Dave Hansen
Cc: Dave Hansen, linux-kernel, sohil.mehta, zhao1.liu,
H. Peter Anvin, Ingo Molnar, Jon Kohler, Pawan Gupta,
Peter Zijlstra (Intel),
Thomas Gleixner, Tony Luck, x86
On Wed, Feb 11, 2026 at 10:40:21AM -0800, Dave Hansen wrote:
> I'm racking my brain but having a hard time coming up with a good name
> that would work for unknown future AMD things. ;)
>
> Any suggestions? I'm not married to the name in any way.
> I could prefix it with 'intel_' to make it more clear that someone _can_
> do a union in the future, like we do with "Hardware defined CPU-type".
>
> Or we could do:
>
> union {
> u8 intel_platform_id;
> u8 amd_unused;
> };
>
> to make it utterly clear that it's free for use on AMD if someone goes
> looking for AMD-usable space.
That last one LGTM.
And if we need to change it later, we always can - the thing is there to
remind that we have a u8 ready to use.
Thx.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 4/6] x86/cpu: Add platform ID to CPU info structure
2026-02-08 21:37 ` Borislav Petkov
@ 2026-02-11 18:40 ` Dave Hansen
2026-02-12 15:22 ` Borislav Petkov
0 siblings, 1 reply; 17+ messages in thread
From: Dave Hansen @ 2026-02-11 18:40 UTC (permalink / raw)
To: Borislav Petkov, Dave Hansen
Cc: linux-kernel, sohil.mehta, zhao1.liu, H. Peter Anvin,
Ingo Molnar, Jon Kohler, Pawan Gupta, Peter Zijlstra (Intel),
Thomas Gleixner, Tony Luck, x86
On 2/8/26 13:37, Borislav Petkov wrote:
> On Fri, Feb 06, 2026 at 03:14:45PM -0800, Dave Hansen wrote:
>> diff -puN arch/x86/include/asm/processor.h~cpu-x86_stepping arch/x86/include/asm/processor.h
>> --- a/arch/x86/include/asm/processor.h~cpu-x86_stepping 2026-02-06 15:14:23.528790212 -0800
>> +++ b/arch/x86/include/asm/processor.h 2026-02-06 15:14:23.567791582 -0800
>> @@ -140,6 +140,8 @@ struct cpuinfo_x86 {
>> __u32 x86_vfm;
>> };
>> __u8 x86_stepping;
>> + /* Intel-only. 3 bits: */
>> + __u8 x86_platform_id;
> Can we call this something more generic so that we can do:
>
> /* On Intel: platform ID
> /* On AMD: something else
>
> so that we can use this on both vendors?
>
> I don't have any usage in mind on AMD now but it might come in handy some day.
I'm racking my brain but having a hard time coming up with a good name
that would work for unknown future AMD things. ;)
Any suggestions? I'm not married to the name in any way.
I could prefix it with 'intel_' to make it more clear that someone _can_
do a union in the future, like we do with "Hardware defined CPU-type".
Or we could do:
union {
u8 intel_platform_id;
u8 amd_unused;
};
to make it utterly clear that it's free for use on AMD if someone goes
looking for AMD-usable space.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 4/6] x86/cpu: Add platform ID to CPU info structure
2026-02-06 23:14 ` [PATCH 4/6] x86/cpu: Add platform ID to CPU info structure Dave Hansen
2026-02-08 21:37 ` Borislav Petkov
@ 2026-02-10 23:23 ` Sohil Mehta
1 sibling, 0 replies; 17+ messages in thread
From: Sohil Mehta @ 2026-02-10 23:23 UTC (permalink / raw)
To: Dave Hansen, linux-kernel
Cc: zhao1.liu, Borislav Petkov, H. Peter Anvin, Ingo Molnar,
Jon Kohler, Pawan Gupta, Peter Zijlstra (Intel),
Thomas Gleixner, Tony Luck, x86
On 2/6/2026 3:14 PM, Dave Hansen wrote:
>
> From: Dave Hansen <dave.hansen@linux.intel.com>
>
> The end goal here is to be able to do x86_match_cpu() and match on a
> specific platform ID. While it would be possible to stash this ID
> off somewhere or read it dynamically, that approaches would not be
> consistent with the other fields which can be matched.
>
> Read the platform ID and store it in cpuinfo_x86->x86_platform_id.
>
> There are lots of sites to set this new field. Place it near
> the place c->microcode is established since the platform ID is
> so closely intertwined with microcode updates.
>
> Note: This should not grow the size of 'struct cpuinfo_x86' in
> practice since the u8 fits next to another u8 in the structure.
>
> Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Reviewed-by: Sohil Mehta <sohil.mehta@intel.com>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 4/6] x86/cpu: Add platform ID to CPU info structure
2026-02-06 23:14 ` [PATCH 4/6] x86/cpu: Add platform ID to CPU info structure Dave Hansen
@ 2026-02-08 21:37 ` Borislav Petkov
2026-02-11 18:40 ` Dave Hansen
2026-02-10 23:23 ` Sohil Mehta
1 sibling, 1 reply; 17+ messages in thread
From: Borislav Petkov @ 2026-02-08 21:37 UTC (permalink / raw)
To: Dave Hansen
Cc: linux-kernel, sohil.mehta, zhao1.liu, H. Peter Anvin,
Ingo Molnar, Jon Kohler, Pawan Gupta, Peter Zijlstra (Intel),
Thomas Gleixner, Tony Luck, x86
On Fri, Feb 06, 2026 at 03:14:45PM -0800, Dave Hansen wrote:
> diff -puN arch/x86/include/asm/processor.h~cpu-x86_stepping arch/x86/include/asm/processor.h
> --- a/arch/x86/include/asm/processor.h~cpu-x86_stepping 2026-02-06 15:14:23.528790212 -0800
> +++ b/arch/x86/include/asm/processor.h 2026-02-06 15:14:23.567791582 -0800
> @@ -140,6 +140,8 @@ struct cpuinfo_x86 {
> __u32 x86_vfm;
> };
> __u8 x86_stepping;
> + /* Intel-only. 3 bits: */
> + __u8 x86_platform_id;
Can we call this something more generic so that we can do:
/* On Intel: platform ID
/* On AMD: something else
so that we can use this on both vendors?
I don't have any usage in mind on AMD now but it might come in handy some day.
Thx.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 4/6] x86/cpu: Add platform ID to CPU info structure
2026-02-06 23:14 [PATCH 0/6] [v2] x86/cpu: Take Intel platform into account for old microcode checks Dave Hansen
@ 2026-02-06 23:14 ` Dave Hansen
2026-02-08 21:37 ` Borislav Petkov
2026-02-10 23:23 ` Sohil Mehta
0 siblings, 2 replies; 17+ messages in thread
From: Dave Hansen @ 2026-02-06 23:14 UTC (permalink / raw)
To: linux-kernel
Cc: sohil.mehta, zhao1.liu, Dave Hansen, Borislav Petkov,
H. Peter Anvin, Ingo Molnar, Jon Kohler, Pawan Gupta,
Peter Zijlstra (Intel),
Thomas Gleixner, Tony Luck, x86
From: Dave Hansen <dave.hansen@linux.intel.com>
The end goal here is to be able to do x86_match_cpu() and match on a
specific platform ID. While it would be possible to stash this ID
off somewhere or read it dynamically, that approaches would not be
consistent with the other fields which can be matched.
Read the platform ID and store it in cpuinfo_x86->x86_platform_id.
There are lots of sites to set this new field. Place it near
the place c->microcode is established since the platform ID is
so closely intertwined with microcode updates.
Note: This should not grow the size of 'struct cpuinfo_x86' in
practice since the u8 fits next to another u8 in the structure.
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Thomas Gleixner <tglx@kernel.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
Cc: "Peter Zijlstra (Intel)" <peterz@infradead.org>
Cc: x86@kernel.org
Cc: Jon Kohler <jon@nutanix.com>
---
b/arch/x86/include/asm/processor.h | 2 ++
b/arch/x86/kernel/cpu/common.c | 4 +++-
b/arch/x86/kernel/cpu/intel.c | 1 +
3 files changed, 6 insertions(+), 1 deletion(-)
diff -puN arch/x86/include/asm/processor.h~cpu-x86_stepping arch/x86/include/asm/processor.h
--- a/arch/x86/include/asm/processor.h~cpu-x86_stepping 2026-02-06 15:14:23.528790212 -0800
+++ b/arch/x86/include/asm/processor.h 2026-02-06 15:14:23.567791582 -0800
@@ -140,6 +140,8 @@ struct cpuinfo_x86 {
__u32 x86_vfm;
};
__u8 x86_stepping;
+ /* Intel-only. 3 bits: */
+ __u8 x86_platform_id;
#ifdef CONFIG_X86_64
/* Number of 4K pages in DTLB/ITLB combined(in pages): */
int x86_tlbsize;
diff -puN arch/x86/kernel/cpu/common.c~cpu-x86_stepping arch/x86/kernel/cpu/common.c
--- a/arch/x86/kernel/cpu/common.c~cpu-x86_stepping 2026-02-06 15:14:23.552791055 -0800
+++ b/arch/x86/kernel/cpu/common.c 2026-02-06 15:14:23.568791618 -0800
@@ -1981,7 +1981,9 @@ static void identify_cpu(struct cpuinfo_
c->loops_per_jiffy = loops_per_jiffy;
c->x86_cache_size = 0;
c->x86_vendor = X86_VENDOR_UNKNOWN;
- c->x86_model = c->x86_stepping = 0; /* So far unknown... */
+ c->x86_model = 0;
+ c->x86_stepping = 0;
+ c->x86_platform_id = 0;
c->x86_vendor_id[0] = '\0'; /* Unset */
c->x86_model_id[0] = '\0'; /* Unset */
#ifdef CONFIG_X86_64
diff -puN arch/x86/kernel/cpu/intel.c~cpu-x86_stepping arch/x86/kernel/cpu/intel.c
--- a/arch/x86/kernel/cpu/intel.c~cpu-x86_stepping 2026-02-06 15:14:23.564791477 -0800
+++ b/arch/x86/kernel/cpu/intel.c 2026-02-06 15:14:23.568791618 -0800
@@ -205,6 +205,7 @@ static void early_init_intel(struct cpui
if (c->x86 >= 6 && !cpu_has(c, X86_FEATURE_IA64))
c->microcode = intel_get_microcode_revision();
+ c->x86_platform_id = intel_get_platform_id();
/* Now if any of them are set, check the blacklist and clear the lot */
if ((cpu_has(c, X86_FEATURE_SPEC_CTRL) ||
_
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 4/6] x86/cpu: Add platform ID to CPU info structure
2026-01-20 15:22 ` Dave Hansen
@ 2026-01-21 2:03 ` Chao Gao
0 siblings, 0 replies; 17+ messages in thread
From: Chao Gao @ 2026-01-21 2:03 UTC (permalink / raw)
To: Dave Hansen
Cc: Dave Hansen, linux-kernel, sohil.mehta, Borislav Petkov,
H. Peter Anvin, Ingo Molnar, Jon Kohler, Pawan Gupta,
Peter Zijlstra (Intel),
Thomas Gleixner, Tony Luck, x86
On Tue, Jan 20, 2026 at 07:22:54AM -0800, Dave Hansen wrote:
>On 1/19/26 19:14, Chao Gao wrote:
>>> __u8 x86_stepping;
>>> + __u8 x86_platform_id; /* Intel-only. 3 bits */
>> Tail comments are not preferred. I've seen tglx complain about them a few times.
>
>Yeah, you're right. It doesn't fit well with the rest of the structure.
>I'll fix it.
>
>> Also, "3 bits" is misleading since x86_platform_id actually stores a bit mask.
>
>Remember, there are two structures in play here. From the cover letter:
>
>> Treat the platform ID as a peer of model/family/stepping. Store it
>> in 'struct cpuinfo_x86', enable matching on it with with 'struct
>> x86_cpu_id', and flesh out the 'old_microcode' list with it.
>
>This hunk is patching 'cpuinfo_x86' which stores the 3 bits explicitly.
Hi Dave,
This patch has:
c->x86_platform_id = intel_get_platform_id();
but intel_get_platform_id() doesn't return the 3 bits; it returns a
single-bit mask (or 0 on old CPUs).
+static inline u32 intel_get_platform_id(void)
+{
+ unsigned int val[2];
+
+ /*
+ * This can be called early. Use CPUID directly to
+ * generate the VFM value for this CPU.
+ */
+ if (intel_cpuid_vfm() < INTEL_PENTIUM_III_DESCHUTES)
+ return 0;
+
+ /* get processor flags from MSR 0x17 */
+ native_rdmsr(MSR_IA32_PLATFORM_ID, val[0], val[1]);
+ return 1 << ((val[1] >> 18) & 7);
+}
>
>I think you're thinking of the mask in 'x86_cpu_id' which is used for
>_matching_ this field in patch 5.
>
>Could you double check that you're asking about the right structure,
>please? I've certainly gotten the two structures mixed up before.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 4/6] x86/cpu: Add platform ID to CPU info structure
2026-01-20 20:44 ` Andy Shevchenko
@ 2026-01-20 20:48 ` Dave Hansen
0 siblings, 0 replies; 17+ messages in thread
From: Dave Hansen @ 2026-01-20 20:48 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Dave Hansen, linux-kernel, sohil.mehta, Borislav Petkov,
H. Peter Anvin, Ingo Molnar, Jon Kohler, Pawan Gupta,
Peter Zijlstra (Intel),
Thomas Gleixner, Tony Luck, x86
On 1/20/26 12:44, Andy Shevchenko wrote:
> On Tue, Jan 20, 2026 at 07:06:56AM -0800, Dave Hansen wrote:
>> On 1/20/26 00:27, Andy Shevchenko wrote:
>> ...
>>>> Note: This should not grow the size of 'struct cpuinfo_x86' in
>>>> practice since the u8 fits next to another u8 in the structure.
>>> Have you run `pahole` to confirm?
>> I have not. If you'd like to contribute to the series by compiling this
>> and running pahole on it, I'd very much appreciate it!
> Okay, here is the diff:
>
> --- old 2026-01-20 21:40:39.170530703 +0100
> +++ new 2026-01-20 21:37:42.717138133 +0100
> @@ -19,8 +19,9 @@
> };
>
> __u8 x86_stepping; /* 4 1 */
> + __u8 x86_platform_id; /* 5 1 */
Thanks a lot for verifying that!
It appears that my built-in pahole is still working properly! Whew.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 4/6] x86/cpu: Add platform ID to CPU info structure
2026-01-20 15:06 ` Dave Hansen
@ 2026-01-20 20:44 ` Andy Shevchenko
2026-01-20 20:48 ` Dave Hansen
0 siblings, 1 reply; 17+ messages in thread
From: Andy Shevchenko @ 2026-01-20 20:44 UTC (permalink / raw)
To: Dave Hansen
Cc: Dave Hansen, linux-kernel, sohil.mehta, Borislav Petkov,
H. Peter Anvin, Ingo Molnar, Jon Kohler, Pawan Gupta,
Peter Zijlstra (Intel),
Thomas Gleixner, Tony Luck, x86
On Tue, Jan 20, 2026 at 07:06:56AM -0800, Dave Hansen wrote:
> On 1/20/26 00:27, Andy Shevchenko wrote:
> ...
> >> Note: This should not grow the size of 'struct cpuinfo_x86' in
> >> practice since the u8 fits next to another u8 in the structure.
> >
> > Have you run `pahole` to confirm?
>
> I have not. If you'd like to contribute to the series by compiling this
> and running pahole on it, I'd very much appreciate it!
Okay, here is the diff:
--- old 2026-01-20 21:40:39.170530703 +0100
+++ new 2026-01-20 21:37:42.717138133 +0100
@@ -19,8 +19,9 @@
};
__u8 x86_stepping; /* 4 1 */
+ __u8 x86_platform_id; /* 5 1 */
- /* XXX 3 bytes hole, try to pack */
+ /* XXX 2 bytes hole, try to pack */
int x86_tlbsize; /* 8 4 */
__u32 vmx_capability[5]; /* 12 20 */
@@ -75,8 +76,8 @@
unsigned int initialized:1; /* 332: 8 4 */
- /* size: 336, cachelines: 6, members: 27 */
- /* sum members: 319, holes: 5, sum holes: 14 */
+ /* size: 336, cachelines: 6, members: 28 */
+ /* sum members: 320, holes: 5, sum holes: 13 */
/* sum bitfield members: 1 bits (0 bytes) */
/* bit_padding: 23 bits */
/* last cacheline: 16 bytes */
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 4/6] x86/cpu: Add platform ID to CPU info structure
2026-01-20 3:14 ` Chao Gao
@ 2026-01-20 15:22 ` Dave Hansen
2026-01-21 2:03 ` Chao Gao
0 siblings, 1 reply; 17+ messages in thread
From: Dave Hansen @ 2026-01-20 15:22 UTC (permalink / raw)
To: Chao Gao, Dave Hansen
Cc: linux-kernel, sohil.mehta, Borislav Petkov, H. Peter Anvin,
Ingo Molnar, Jon Kohler, Pawan Gupta, Peter Zijlstra (Intel),
Thomas Gleixner, Tony Luck, x86
On 1/19/26 19:14, Chao Gao wrote:
>> __u8 x86_stepping;
>> + __u8 x86_platform_id; /* Intel-only. 3 bits */
> Tail comments are not preferred. I've seen tglx complain about them a few times.
Yeah, you're right. It doesn't fit well with the rest of the structure.
I'll fix it.
> Also, "3 bits" is misleading since x86_platform_id actually stores a bit mask.
Remember, there are two structures in play here. From the cover letter:
> Treat the platform ID as a peer of model/family/stepping. Store it
> in 'struct cpuinfo_x86', enable matching on it with with 'struct
> x86_cpu_id', and flesh out the 'old_microcode' list with it.
This hunk is patching 'cpuinfo_x86' which stores the 3 bits explicitly.
I think you're thinking of the mask in 'x86_cpu_id' which is used for
_matching_ this field in patch 5.
Could you double check that you're asking about the right structure,
please? I've certainly gotten the two structures mixed up before.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 4/6] x86/cpu: Add platform ID to CPU info structure
2026-01-20 8:27 ` Andy Shevchenko
@ 2026-01-20 15:06 ` Dave Hansen
2026-01-20 20:44 ` Andy Shevchenko
0 siblings, 1 reply; 17+ messages in thread
From: Dave Hansen @ 2026-01-20 15:06 UTC (permalink / raw)
To: Andy Shevchenko, Dave Hansen
Cc: linux-kernel, sohil.mehta, Borislav Petkov, H. Peter Anvin,
Ingo Molnar, Jon Kohler, Pawan Gupta, Peter Zijlstra (Intel),
Thomas Gleixner, Tony Luck, x86
On 1/20/26 00:27, Andy Shevchenko wrote:
...
>> Note: This should not grow the size of 'struct cpuinfo_x86' in
>> practice since the u8 fits next to another u8 in the structure.
>
> Have you run `pahole` to confirm?
I have not. If you'd like to contribute to the series by compiling this
and running pahole on it, I'd very much appreciate it!
> ...
>
>> c->x86_cache_size = 0;
>> c->x86_vendor = X86_VENDOR_UNKNOWN;
>> - c->x86_model = c->x86_stepping = 0; /* So far unknown... */
>
> Shan't we preserve the comment?
>
> /* So far model, stepping, and platform_id are unknown... */
... and cache size and vendor and everything else. It's not a super
useful comment.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 4/6] x86/cpu: Add platform ID to CPU info structure
2026-01-19 19:50 ` [PATCH 4/6] x86/cpu: Add platform ID to CPU info structure Dave Hansen
2026-01-20 3:14 ` Chao Gao
@ 2026-01-20 8:27 ` Andy Shevchenko
2026-01-20 15:06 ` Dave Hansen
1 sibling, 1 reply; 17+ messages in thread
From: Andy Shevchenko @ 2026-01-20 8:27 UTC (permalink / raw)
To: Dave Hansen
Cc: linux-kernel, sohil.mehta, Borislav Petkov, H. Peter Anvin,
Ingo Molnar, Jon Kohler, Pawan Gupta, Peter Zijlstra (Intel),
Thomas Gleixner, Tony Luck, x86
On Mon, Jan 19, 2026 at 11:50:55AM -0800, Dave Hansen wrote:
>
> The end goal here is to be able to do x86_match_cpu() and match on a
> specific platform ID. While it would be possible to stash this ID
> off somewhere or read it dynamically, that approaches would not be
> consistent with the other fields which can be matched.
>
> Read the platform ID and store it in cpuinfo_x86->x86_platform_id.
>
> There are lots of sites to set this new field. Place it near
> the place c->microcode is established since the platform ID is
> so closely intertwined with microcode updates.
>
> Note: This should not grow the size of 'struct cpuinfo_x86' in
> practice since the u8 fits next to another u8 in the structure.
Have you run `pahole` to confirm?
...
> c->x86_cache_size = 0;
> c->x86_vendor = X86_VENDOR_UNKNOWN;
> - c->x86_model = c->x86_stepping = 0; /* So far unknown... */
Shan't we preserve the comment?
/* So far model, stepping, and platform_id are unknown... */
> + c->x86_model = 0;
> + c->x86_stepping = 0;
> + c->x86_platform_id = 0;
> c->x86_vendor_id[0] = '\0'; /* Unset */
> c->x86_model_id[0] = '\0'; /* Unset */
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 4/6] x86/cpu: Add platform ID to CPU info structure
2026-01-19 19:50 ` [PATCH 4/6] x86/cpu: Add platform ID to CPU info structure Dave Hansen
@ 2026-01-20 3:14 ` Chao Gao
2026-01-20 15:22 ` Dave Hansen
2026-01-20 8:27 ` Andy Shevchenko
1 sibling, 1 reply; 17+ messages in thread
From: Chao Gao @ 2026-01-20 3:14 UTC (permalink / raw)
To: Dave Hansen
Cc: linux-kernel, sohil.mehta, Borislav Petkov, H. Peter Anvin,
Ingo Molnar, Jon Kohler, Pawan Gupta, Peter Zijlstra (Intel),
Thomas Gleixner, Tony Luck, x86
On Mon, Jan 19, 2026 at 11:50:55AM -0800, Dave Hansen wrote:
>
>From: Dave Hansen <dave.hansen@linux.intel.com>
>
>The end goal here is to be able to do x86_match_cpu() and match on a
>specific platform ID. While it would be possible to stash this ID
>off somewhere or read it dynamically, that approaches would not be
>consistent with the other fields which can be matched.
>
>Read the platform ID and store it in cpuinfo_x86->x86_platform_id.
>
>There are lots of sites to set this new field. Place it near
>the place c->microcode is established since the platform ID is
>so closely intertwined with microcode updates.
>
>Note: This should not grow the size of 'struct cpuinfo_x86' in
>practice since the u8 fits next to another u8 in the structure.
>
>Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
>Cc: Thomas Gleixner <tglx@kernel.org>
>Cc: Ingo Molnar <mingo@redhat.com>
>Cc: Borislav Petkov <bp@alien8.de>
>Cc: Dave Hansen <dave.hansen@linux.intel.com>
>Cc: "H. Peter Anvin" <hpa@zytor.com>
>Cc: Tony Luck <tony.luck@intel.com>
>Cc: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
>Cc: "Peter Zijlstra (Intel)" <peterz@infradead.org>
>Cc: x86@kernel.org
>Cc: Jon Kohler <jon@nutanix.com>
>---
>
> b/arch/x86/include/asm/processor.h | 1 +
> b/arch/x86/kernel/cpu/common.c | 4 +++-
> b/arch/x86/kernel/cpu/intel.c | 1 +
> 3 files changed, 5 insertions(+), 1 deletion(-)
>
>diff -puN arch/x86/include/asm/processor.h~cpu-x86_stepping arch/x86/include/asm/processor.h
>--- a/arch/x86/include/asm/processor.h~cpu-x86_stepping 2026-01-19 11:38:09.341914025 -0800
>+++ b/arch/x86/include/asm/processor.h 2026-01-19 11:38:09.444917962 -0800
>@@ -140,6 +140,7 @@ struct cpuinfo_x86 {
> __u32 x86_vfm;
> };
> __u8 x86_stepping;
>+ __u8 x86_platform_id; /* Intel-only. 3 bits */
Tail comments are not preferred. I've seen tglx complain about them a few times.
Also, "3 bits" is misleading since x86_platform_id actually stores a bit mask.
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 4/6] x86/cpu: Add platform ID to CPU info structure
2026-01-19 19:50 [PATCH 0/6] x86/cpu: Take Intel platform into account for old microcode checks Dave Hansen
@ 2026-01-19 19:50 ` Dave Hansen
2026-01-20 3:14 ` Chao Gao
2026-01-20 8:27 ` Andy Shevchenko
0 siblings, 2 replies; 17+ messages in thread
From: Dave Hansen @ 2026-01-19 19:50 UTC (permalink / raw)
To: linux-kernel
Cc: sohil.mehta, Dave Hansen, Borislav Petkov, H. Peter Anvin,
Ingo Molnar, Jon Kohler, Pawan Gupta, Peter Zijlstra (Intel),
Thomas Gleixner, Tony Luck, x86
From: Dave Hansen <dave.hansen@linux.intel.com>
The end goal here is to be able to do x86_match_cpu() and match on a
specific platform ID. While it would be possible to stash this ID
off somewhere or read it dynamically, that approaches would not be
consistent with the other fields which can be matched.
Read the platform ID and store it in cpuinfo_x86->x86_platform_id.
There are lots of sites to set this new field. Place it near
the place c->microcode is established since the platform ID is
so closely intertwined with microcode updates.
Note: This should not grow the size of 'struct cpuinfo_x86' in
practice since the u8 fits next to another u8 in the structure.
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Thomas Gleixner <tglx@kernel.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
Cc: "Peter Zijlstra (Intel)" <peterz@infradead.org>
Cc: x86@kernel.org
Cc: Jon Kohler <jon@nutanix.com>
---
b/arch/x86/include/asm/processor.h | 1 +
b/arch/x86/kernel/cpu/common.c | 4 +++-
b/arch/x86/kernel/cpu/intel.c | 1 +
3 files changed, 5 insertions(+), 1 deletion(-)
diff -puN arch/x86/include/asm/processor.h~cpu-x86_stepping arch/x86/include/asm/processor.h
--- a/arch/x86/include/asm/processor.h~cpu-x86_stepping 2026-01-19 11:38:09.341914025 -0800
+++ b/arch/x86/include/asm/processor.h 2026-01-19 11:38:09.444917962 -0800
@@ -140,6 +140,7 @@ struct cpuinfo_x86 {
__u32 x86_vfm;
};
__u8 x86_stepping;
+ __u8 x86_platform_id; /* Intel-only. 3 bits */
#ifdef CONFIG_X86_64
/* Number of 4K pages in DTLB/ITLB combined(in pages): */
int x86_tlbsize;
diff -puN arch/x86/kernel/cpu/common.c~cpu-x86_stepping arch/x86/kernel/cpu/common.c
--- a/arch/x86/kernel/cpu/common.c~cpu-x86_stepping 2026-01-19 11:38:09.428917350 -0800
+++ b/arch/x86/kernel/cpu/common.c 2026-01-19 11:38:09.445918000 -0800
@@ -1981,7 +1981,9 @@ static void identify_cpu(struct cpuinfo_
c->loops_per_jiffy = loops_per_jiffy;
c->x86_cache_size = 0;
c->x86_vendor = X86_VENDOR_UNKNOWN;
- c->x86_model = c->x86_stepping = 0; /* So far unknown... */
+ c->x86_model = 0;
+ c->x86_stepping = 0;
+ c->x86_platform_id = 0;
c->x86_vendor_id[0] = '\0'; /* Unset */
c->x86_model_id[0] = '\0'; /* Unset */
#ifdef CONFIG_X86_64
diff -puN arch/x86/kernel/cpu/intel.c~cpu-x86_stepping arch/x86/kernel/cpu/intel.c
--- a/arch/x86/kernel/cpu/intel.c~cpu-x86_stepping 2026-01-19 11:38:09.441917848 -0800
+++ b/arch/x86/kernel/cpu/intel.c 2026-01-19 11:38:09.445918000 -0800
@@ -205,6 +205,7 @@ static void early_init_intel(struct cpui
if (c->x86 >= 6 && !cpu_has(c, X86_FEATURE_IA64))
c->microcode = intel_get_microcode_revision();
+ c->x86_platform_id = intel_get_platform_id();
/* Now if any of them are set, check the blacklist and clear the lot */
if ((cpu_has(c, X86_FEATURE_SPEC_CTRL) ||
_
^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2026-02-12 15:22 UTC | newest]
Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-20 14:34 [PATCH 4/6] x86/cpu: Add platform ID to CPU info structure Maciej Wieczor-Retman
2026-01-20 15:13 ` Dave Hansen
2026-01-20 16:03 ` Maciej Wieczor-Retman
2026-01-20 16:12 ` Dave Hansen
-- strict thread matches above, loose matches on Subject: below --
2026-02-06 23:14 [PATCH 0/6] [v2] x86/cpu: Take Intel platform into account for old microcode checks Dave Hansen
2026-02-06 23:14 ` [PATCH 4/6] x86/cpu: Add platform ID to CPU info structure Dave Hansen
2026-02-08 21:37 ` Borislav Petkov
2026-02-11 18:40 ` Dave Hansen
2026-02-12 15:22 ` Borislav Petkov
2026-02-10 23:23 ` Sohil Mehta
2026-01-19 19:50 [PATCH 0/6] x86/cpu: Take Intel platform into account for old microcode checks Dave Hansen
2026-01-19 19:50 ` [PATCH 4/6] x86/cpu: Add platform ID to CPU info structure Dave Hansen
2026-01-20 3:14 ` Chao Gao
2026-01-20 15:22 ` Dave Hansen
2026-01-21 2:03 ` Chao Gao
2026-01-20 8:27 ` Andy Shevchenko
2026-01-20 15:06 ` Dave Hansen
2026-01-20 20:44 ` Andy Shevchenko
2026-01-20 20:48 ` Dave Hansen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®