Re: [PATCH v2 3/8] crypto: x86 - Stop using cpu_has_xfeatures()
Eric Biggers <[email protected]> Tue, 28 Jul 2026 16:40:25 -0700
| Newsgroups | org.infradead.lists.linux-um,org.kernel.vger.linux-crypto,org.kernel.vger.linux-kernel,org.kernel.vger.linux-raid |
|---|---|
| Message-ID | <20260728234025.GB3277@quark> |
On Tue, Jul 28, 2026 at 10:30:18AM +0100, David Laight wrote: > On Mon, 27 Jul 2026 19:15:58 -0700 > Eric Biggers <[email protected]> wrote: > > > Checking both boot_cpu_has(X86_FEATURE_AVX*) and cpu_has_xfeatures() has > > never really been needed in practice, and it's never been universally > > done (e.g., lib/raid/ omits cpu_has_xfeatures()). Nevertheless, both > > x86 and UML now explicitly clear the AVX and AVX-512 flags if their > > xfeatures are missing, which should remove any remaining doubts. > > > > Thus, remove all the calls to cpu_has_xfeatures(), as well as the > > related checks of boot_cpu_has(X86_FEATURE_OSXSAVE). > > > > In a few cases there was no corresponding boot_cpu_has(X86_FEATURE_AVX*) > > check, so add the missing ones. > > > > Signed-off-by: Eric Biggers <[email protected]> > > --- > ... > > --- a/arch/x86/crypto/aria_gfni_avx512_glue.c > > +++ b/arch/x86/crypto/aria_gfni_avx512_glue.c > > @@ -196,24 +196,15 @@ static struct skcipher_alg aria_algs[] = { > > > > static int __init aria_avx512_init(void) > > { > > - const char *feature_name; > > - > > if (!boot_cpu_has(X86_FEATURE_AVX) || > > !boot_cpu_has(X86_FEATURE_AVX2) || > > Doesn't AVX2 require AVX support? > > > !boot_cpu_has(X86_FEATURE_AVX512F) || > > !boot_cpu_has(X86_FEATURE_AVX512VL) || > > And (less sure) AVX512xxx require AVX2? > > So the extra checks could be reduced. Yes, but this patch is just intended to clean up the xfeatures and OSXSAVE checks. Further cleanups would be separate patches. - Eric