Skip to content

x86: Remove cpu_has_xfeatures() and add AVX-512 xor_gen()

Eric Biggers linux-crypto linux-raid linux-um lkml 5 versions – Applied

Status from this message: The following commit has been merged into the x86/fpu branch of tip:

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v5 Latest8 patches 5 repliesApplied
  2. v48 patches 0 repliesSuperseded
  3. v38 patches 2 repliesSuperseded
Earlier versions · 2
VersionPostedPatchesRepliesStatus
v28 patches21 repliesSuperseded
v18 patches10 repliesSuperseded

Changes in v5 from the cover letter

- Replaced benchmark results with the new xor_benchmark
- Consolidated the vzeroupper in xor-avx512.c into one location

Patches in v5 Applied

#Subject and filesSizeRepliesApplied
1/8x86/fpu: Check for missing AVX and AVX-512 xstate bitsarch/x86/kernel/fpu/xstate.c+23 -20 replies
2/8um: Check for missing AVX and AVX-512 xstate bitsarch/um/kernel/um_arch.c+77 -10 replies
3/8crypto: x86 - Stop using cpu_has_xfeatures()arch/x86/crypto/aegis128-aesni-glue.c arch/x86/crypto/aesni-intel_glue.c arch/x86/crypto/aria_aesni_avx2_glue.c +11 more+19 -1040 replies
4/8lib/crypto: x86: Stop using cpu_has_xfeatures()lib/crypto/x86/blake2s.h lib/crypto/x86/chacha.h lib/crypto/x86/nh.h +5 more+9 -230 replies
5/8lib/crc: x86: Stop using cpu_has_xfeatures()lib/crc/x86/crc-pclmul-template.h+2 -40 replies
6/8x86/fpu: Remove cpu_has_xfeatures()arch/x86/include/asm/fpu/api.h arch/x86/kernel/fpu/xstate.c+3 -504 replies
7/8xor: Remove redundant X86_FEATURE_OSXSAVE checklib/raid/xor/x86/xor_arch.h+1 -20 replies
8/8xor: Add AVX-512 optimized xor_gen()lib/raid/xor/Makefile lib/raid/xor/x86/xor-avx512.c lib/raid/xor/x86/xor_arch.h+143 -110 replies

Reviews trailers per patch

All 8 patches have a Reviewed-by or Acked-by.

PatchChristoph HellwigDavid Laight
1/8A-b
2/8A-b
3/8A-b
4/8A-b
5/8A-b
6/8A-b
7/8R-b A-b
8/8R-b A-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v5 thread

Cover letter [PATCH v5 0/8] x86: Remove cpu_has_xfeatures() and add AVX-512 xor_gen()

This series consolidates and cleans up how the kernel handles CPU feature flags for AVX and AVX-512 when the underlying OS or hypervisor (if any) doesn't enable the required xstate features in XCR0.

Specifically, it makes the checks for xstate features be done in a single place at boot time for both UML and native x86, instead of everywhere kernel code wants to check for AVX or AVX-512 support.

Patch 8 then adds an AVX-512 optimized implementation of xor_gen() for RAID, which had been blocked on confusion around cpu_has_xfeatures() and its lack of implementation on UML.

Please consider this series for the x86 tree for 7.4.

Changed in v5:
- Replaced benchmark results with the new xor_benchmark
- Consolidated the vzeroupper in xor-avx512.c into one location

Changed in v4:
- Added missing vzeroupper instructions in xor-avx512.c

Changed in v3:
- Updated the implementation of fpu__init_system_xstate() as suggested by Borislav
- Added Acked-by tags
- Used "xor:" commit subject

Changed in v2:
- Made x86 clear the AVX* bits if FPU or XSAVE features are missing.
- Updated comment in x86 arch_xor_init().
- Updated commit message for the UML commit to clarify that checking XCR0 is standard practice in userspace

Eric Biggers (8):
x86/fpu: Check for missing AVX and AVX-512 xstate bits
um: Check for missing AVX and AVX-512 xstate bits
crypto: x86 - Stop using cpu_has_xfeatures() lib/crypto: x86: Stop using cpu_has_xfeatures() lib/crc: x86: Stop using cpu_has_xfeatures() x86/fpu: Remove cpu_has_xfeatures()
xor: Remove redundant X86_FEATURE_OSXSAVE check
xor: Add AVX-512 optimized xor_gen()

 arch/um/kernel/um_arch.c                   |  78 ++++++++++++-
 arch/x86/crypto/aegis128-aesni-glue.c      |   3 +-
 arch/x86/crypto/aesni-intel_glue.c         |   7 +-
 arch/x86/crypto/aria_aesni_avx2_glue.c     |  11 +-
 arch/x86/crypto/aria_aesni_avx_glue.c      |  11 +-
 arch/x86/crypto/aria_gfni_avx512_glue.c    |  11 +-
 arch/x86/crypto/camellia_aesni_avx2_glue.c |  11 +-
 arch/x86/crypto/camellia_aesni_avx_glue.c  |  11 +-
 arch/x86/crypto/cast5_avx_glue.c           |   7 +-
 arch/x86/crypto/cast6_avx_glue.c           |   7 +-
 arch/x86/crypto/serpent_avx2_glue.c        |   9 +-
 arch/x86/crypto/serpent_avx_glue.c         |   7 +-
 arch/x86/crypto/sm4_aesni_avx2_glue.c      |  11 +-
 arch/x86/crypto/sm4_aesni_avx_glue.c       |  11 +-
 arch/x86/crypto/twofish_avx_glue.c         |   6 +-
 arch/x86/include/asm/fpu/api.h             |   9 --
 arch/x86/kernel/fpu/xstate.c               |  69 +++++-------
 lib/crc/x86/crc-pclmul-template.h          |   6 +-
 lib/crypto/x86/blake2s.h                   |   4 +-
 lib/crypto/x86/chacha.h                    |   3 +-
 lib/crypto/x86/nh.h                        |   4 +-
 lib/crypto/x86/poly1305.h                  |   7 +-
 lib/crypto/x86/sha1.h                      |   4 +-
 lib/crypto/x86/sha256.h                    |   4 +-
 lib/crypto/x86/sha512.h                    |   3 +-
 lib/crypto/x86/sm3.h                       |   3 +-
 lib/raid/xor/Makefile                      |   2 +-
 lib/raid/xor/x86/xor-avx512.c              | 122 +++++++++++++++++++++
 lib/raid/xor/x86/xor_arch.h                |  31 ++++--
 29 files changed, 276 insertions(+), 196 deletions(-)
 create mode 100644 lib/raid/xor/x86/xor-avx512.c

base-commit: cee9395acd8043be0644b25c34bfa86623f2b935

Signature · 1 line
2.55.0