Re: [PATCH v2 4/8] lib/crypto: x86: Stop using cpu_has_xfeatures()

Borislav Petkov <[email protected]> Thu, 30 Jul 2026 21:26:03 -0700
Newsgroups org.infradead.lists.linux-um,org.kernel.vger.linux-crypto,org.kernel.vger.linux-kernel,org.kernel.vger.linux-raid
Message-ID <20260731042603.GOamwj2xjDHtpFfL9u@fat_crate.local>
On Thu, Jul 30, 2026 at 11:47:42PM +0000, Eric Biggers wrote:
> cpu_feature_enabled() turns into an alternative (code patching), which
> doesn't make much sense in any of the places you're asking for it to be
> used,

It is the interface to use for checking X86_FEATURE flags. The fact that it
alternative-patches doesn't really matter.

> I suppose that the static keys that are conditional on only one CPU
> feature can be replaced with cpu_feature_enabled(), which should be
> equally efficient.  However, many of the keys are conditional on two or
> more features.

Yes, they all can be converted to cpu_feature_enabled(). Just forget the
efficiency angle and think of this as us unifying the interfaces to a single
one instead of the zoo we have right now.

> After that, there would be a mix of both versions.  So sure, it could
> make sense to use cpu_feature_enabled() everywhere anyway,

Yap, that's the goal.

> I'm not sure it's clearly better than the status quo, though.

Yes, it is. See above.

Once everything is converted, there will be a single cpu_feature_enabled() and
all users will not care whether to use boot_cpu_has(), this_cpu_has(),
cpu_has(c, ...), static_cpu_has() and so on.

Thx.

-- 
Regards/Gruss,
    Boris.

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