Re: [PATCH v2 2/5] x86/cpu: Initialize boot CPU cpuinfo defaults early

From: Borislav Petkov

Date: Mon Sep 14 2026 - 22:39:22 EST


On Fri, Aug 14, 2026 at 04:51:31PM -0700, Ihor Solodrai wrote:
> early_identify_cpu() clears the capability array, the CPUID table and
> extended_cpuid_level, but the architectural defaults for the rest of
> struct cpuinfo_x86 are set only later, in identify_cpu().

And I would've stopped here. I don't think we care too much about a CPU which
doesn't enumerate CLFLUSH. Or is there an aspect I am missing.

I mean, you can say something along the lines that now things like
->x86_cache_alignment are more correct but I don't think you need to go that
much into detail.

> On x86_64 x86_clflush_size defaults to 64. Until that default is
> applied it reads as zero, which get_cpu_address_sizes() interprets as
> "not enumerated" and replaces with 32. So on a CPU which does not
> enumerate CLFLUSH the boot CPU runs with an x86_clflush_size and an
> x86_cache_alignment of 32 until identify_cpu() resets them to 64.
>
> Use the same defaults from the start, so that the boot CPU does not
> depend on a later reset to end up with the right ones.
>
> The values the boot CPU ends up with do not change. Early users of
> cache_line_size() on a CPU which does not enumerate CLFLUSH now see the
> architectural 64 instead of the 32 fallback, which is what they should
> have been seeing all along.
>
> This change comes before the last patch because that one removes the
> reset: without the defaults established here the boot CPU would be
> left at 32 instead of 64 on an x86_64 CPU which does not enumerate
> CLFLUSH.

This paragraph goes...

>
> Signed-off-by: Ihor Solodrai <ihor.solodrai@xxxxxxxxx>
> ---

... here, after the "---" delimiter as it doesn't really belong in the commit
message.

Thx.

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette