Re: [PATCH] x86/cpu: Hide and rename static_cpu_has()

From: Borislav Petkov

Date: Sun Jun 21 2026 - 20:19:47 EST


On Mon, Jun 22, 2026 at 01:13:22AM +0300, Nikolay Borisov wrote:
> static_cpu_has is generally used in performance critical parts of the code.

cpu_feature_enabled() calls static_cpu_has().

> Your change basically adds a __builtin_constant_p() && DISABLED_MASK check
> which only evaluate during compile time so from a perf point of view this
> shouldn't bring any negative effects.

The point is that if you have disabled a feature at build time, static won't
see it. But it must. And that is one of the reasons for why we are moving
everything to cpu_feature_enabled(), with some small exceptions.

And this is one step in that direction.

Thx.

--
Regards/Gruss,
Boris.

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