Re: [PATCH v3] lib/raid/xor: x86: Add AVX-512 optimized xor_gen()

From: Borislav Petkov

Date: Mon Jun 15 2026 - 17:17:45 EST


On June 15, 2026 8:10:50 PM UTC, Eric Biggers <ebiggers@xxxxxxxxxx> wrote:
>
>But I wanted to ask: do we really care about the case where features are
>"supported" but their XCR0 bits aren't set? Perhaps the kernel just
>doesn't/shouldn't support weird cases like "-cpu max,xsave=off"?
>

Yes, our aim is to support only configurations which are actually present in real hardware and not a "oh, it would be good if it did that, just because..."

>If this case indeed needs to be handled, could we make things easier for
>the kernel's AVX and AVX-512 optimized code? Currently AVX-512 needs:
>
> if (boot_cpu_has(X86_FEATURE_AVX512F) &&
> cpu_has_xfeatures(XFEATURE_MASK_FP | XFEATURE_MASK_SSE |
> XFEATURE_MASK_YMM | XFEATURE_MASK_AVX512, NULL))
>
>How about we make X86_FEATURE_AVX512F depend on XCR0=111xx111, and
>X86_FEATURE_AVX depend on XCR0=xxxxx111? Then the cpu_has_xfeatures()
>check wouldn't be needed. Is there any reason not to do that?

How do you want to accomplish that? Very early during boot on the BSP you sanity-check XCR0 and clear feature flags if components are not set?

Thx.

--
Small device. Typos and formatting crap