Re: [PATCH v6 10/90] x86/cpu: Rescan CPUID table after disabling PSN

"Ahmed S. Darwish" <[email protected]> Wed, 13 May 2026 18:06:37 +0200
Newsgroups dev.linux.lists.x86-cpuid,org.kernel.vger.linux-kernel
Message-ID <agShjbCo_HSs9YOf@lx-t490>
On Wed, 13 May 2026, Borislav Petkov wrote:
>
> index 01b64d04eb3b..c51cdcad7875 100644
> --- a/arch/x86/kernel/cpu/common.c
> +++ b/arch/x86/kernel/cpu/common.c
...
>  	clear_cpu_cap(c, X86_FEATURE_PN);
...
>
> -	rescan_from = min_t(int, l0->max_std_leaf, c->cpuid_level) + 1;
> -	cpuid_refresh_range(c, rescan_from, CPUID_BASE_END);
>  	c->cpuid_level = l0->max_std_leaf;
> +
> +	/* Rescan from the whole range. */
> +	cpuid_refresh_range(c, 0, CPUID_BASE_END);
>  }
>

That will break the clear_cpu_cap() just some few lines above it.  That is,
it will reset all feature flags force set or unset by the kernel.

I'm sending another patch queue iteration shortly that have a new API
function abstracting this min_t() logic in its own parser function, along
with better documentation:

    https://lkml.kernel.org/agSfWTxs9pRPHJxl@lx-t490/

The few CPUID patches now merged at tip:x86/cpu will also be in that patch
queue so that everything applies cleanly over -rc3.

Sounds good?

Thanks!
Ahmed