Wire up CRC-T10DIF library functions to arch-optimized code
Subsystems (12)
Eric Biggers
maintainerv2 cover Wire up CRC-T10DIF library functions to arch-optimized code
This patchset is also available in git via:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux.git crc-t10dif-lib-v2
This patchset updates the kernel's CRC-T10DIF library functions to be directly optimized for x86, arm, arm64, and powerpc without taking an unnecessary and inefficient detour through the crypto API. It follows the same approach that I'm taking for CRC32 in the patchset
https://lore.kernel.org/lkml/[email protected]/
This patchset also adds a CRC KUnit test suite that covers multiple CRC variants, and deletes some older ad-hoc tests that are obsoleted by it.
This patchset applies to v6.13-rc1 plus my CRC32 patchset. It can be retrieved from git using above command. This is targeting 6.14.
Changed in v2:
- Rebased onto v6.13-rc1.
- Tweaked crc_t10dif_arch() for arm32 and arm64 to not call crypto_simd_usable() more times than is necessary.
- Added patch removing redundant crc16_kunit.c which got added in v6.13-rc1.
- Made some small tweaks to crc_kunit.c.
- Listed Ard as a reviewer in the MAINTAINERS entry.
- Dropped scripts/crc from MAINTAINERS entry, as it hasn't been added yet.
- Clarified a commit message.
- Added Reviewed-by and Acked-by's.
Eric Biggers (12):
lib/crc-t10dif: stop wrapping the crypto API lib/crc-t10dif: add support for arch overrides
crypto: crct10dif - expose arch-optimized lib function x86/crc-t10dif: expose CRC-T10DIF function through lib arm/crc-t10dif: expose CRC-T10DIF function through lib arm64/crc-t10dif: expose CRC-T10DIF function through lib powerpc/crc-t10dif: expose CRC-T10DIF function through lib lib/crc_kunit.c: add KUnit test suite for CRC library functions lib/crc16_kunit: delete obsolete crc16_kunit.c lib/crc32test: delete obsolete crc32test.c powerpc/crc: delete obsolete crc-vpmsum_test.c
MAINTAINERS: add entry for CRC library
MAINTAINERS | 11 +
arch/arm/Kconfig | 1 +
arch/arm/crypto/Kconfig | 11 -
arch/arm/crypto/Makefile | 2 -
arch/arm/crypto/crct10dif-ce-glue.c | 124 ---
arch/arm/lib/Makefile | 3 +
.../crc-t10dif-core.S} | 0
arch/arm/lib/crc-t10dif-glue.c | 80 ++
arch/arm64/Kconfig | 1 +
arch/arm64/configs/defconfig | 1 -
arch/arm64/crypto/Kconfig | 10 -
arch/arm64/crypto/Makefile | 3 -
arch/arm64/crypto/crct10dif-ce-glue.c | 132 ---
arch/arm64/lib/Makefile | 3 +
.../crc-t10dif-core.S} | 0
arch/arm64/lib/crc-t10dif-glue.c | 81 ++
arch/m68k/configs/amiga_defconfig | 1 -
arch/m68k/configs/apollo_defconfig | 1 -
arch/m68k/configs/atari_defconfig | 1 -
arch/m68k/configs/bvme6000_defconfig | 1 -
arch/m68k/configs/hp300_defconfig | 1 -
arch/m68k/configs/mac_defconfig | 1 -
arch/m68k/configs/multi_defconfig | 1 -
arch/m68k/configs/mvme147_defconfig | 1 -
arch/m68k/configs/mvme16x_defconfig | 1 -
arch/m68k/configs/q40_defconfig | 1 -
arch/m68k/configs/sun3_defconfig | 1 -
arch/m68k/configs/sun3x_defconfig | 1 -
arch/powerpc/Kconfig | 1 +
arch/powerpc/configs/powernv_defconfig | 1 -
arch/powerpc/configs/ppc64_defconfig | 2 -
arch/powerpc/crypto/Kconfig | 20 -
arch/powerpc/crypto/Makefile | 3 -
arch/powerpc/crypto/crc-vpmsum_test.c | 133 ---
arch/powerpc/lib/Makefile | 3 +
.../crc-t10dif-glue.c} | 69 +-
.../{crypto => lib}/crct10dif-vpmsum_asm.S | 2 +-
arch/s390/configs/debug_defconfig | 1 -
arch/x86/Kconfig | 1 +
arch/x86/crypto/Kconfig | 10 -
arch/x86/crypto/Makefile | 3 -
arch/x86/crypto/crct10dif-pclmul_glue.c | 143 ---
arch/x86/lib/Makefile | 3 +
arch/x86/lib/crc-t10dif-glue.c | 51 ++
.../{crypto => lib}/crct10dif-pcl-asm_64.S | 0
crypto/Kconfig | 1 +
crypto/Makefile | 3 +-
crypto/crct10dif_common.c | 82 --
crypto/crct10dif_generic.c | 82 +-
include/linux/crc-t10dif.h | 28 +-
lib/Kconfig | 43 +-
lib/Kconfig.debug | 29 +-
lib/Makefile | 3 +-
lib/crc-t10dif.c | 156 +---
lib/crc16_kunit.c | 155 ----
lib/crc32test.c | 852 ------------------
lib/crc_kunit.c | 435 +++++++++
.../testing/selftests/arm64/fp/kernel-test.c | 3 +-
58 files changed, 880 insertions(+), 1913 deletions(-)
delete mode 100644 arch/arm/crypto/crct10dif-ce-glue.c
rename arch/arm/{crypto/crct10dif-ce-core.S => lib/crc-t10dif-core.S} (100%)
create mode 100644 arch/arm/lib/crc-t10dif-glue.c
delete mode 100644 arch/arm64/crypto/crct10dif-ce-glue.c
rename arch/arm64/{crypto/crct10dif-ce-core.S => lib/crc-t10dif-core.S} (100%)
create mode 100644 arch/arm64/lib/crc-t10dif-glue.c
delete mode 100644 arch/powerpc/crypto/crc-vpmsum_test.c
rename arch/powerpc/{crypto/crct10dif-vpmsum_glue.c => lib/crc-t10dif-glue.c} (50%)
rename arch/powerpc/{crypto => lib}/crct10dif-vpmsum_asm.S (99%)
delete mode 100644 arch/x86/crypto/crct10dif-pclmul_glue.c
create mode 100644 arch/x86/lib/crc-t10dif-glue.c
rename arch/x86/{crypto => lib}/crct10dif-pcl-asm_64.S (100%)
delete mode 100644 crypto/crct10dif_common.c
delete mode 100644 lib/crc16_kunit.c
delete mode 100644 lib/crc32test.c
create mode 100644 lib/crc_kunit.cbase-commit: 40384c840ea1944d7c5a392e8975ed088ecf0b37
prerequisite-patch-id: f8b995a05288ddc7f06f93d5eb7ffc71f53232d4
prerequisite-patch-id: cda9f22081116d690534a921473af93d06ab7539
prerequisite-patch-id: 12e0b107ed65a4d61fe3c9aa29451b082276f84f
prerequisite-patch-id: 292ec37c4a28e33cce4c13ad75a3ad2104799352
prerequisite-patch-id: b1cf6138d2a225dcda1adedc89d20d36a54bb309
prerequisite-patch-id: 1a7519c0d1fc64926480c8be838a98b5095534ec
prerequisite-patch-id: 0f22f1d50b6c17c93825e4a0651d51f4de9efe47
prerequisite-patch-id: 285ac22e7e2bad4920c3872992aa45e7f04d3702
prerequisite-patch-id: 9b085b26ff8fe55cf7cd343e9123e742f82a1fbb
prerequisite-patch-id: a4e94f9bb7c2c1d4d5486877b660ca6d606a46ef
prerequisite-patch-id: 5d541cd572220aa5c1885a639693fc78210c6112
prerequisite-patch-id: 95195b4e2e9d9e0e7b1cafa37d0cf2b3373f007f
prerequisite-patch-id: da2e5649997b6265ef0e6ad90b8be6a7a1509705
prerequisite-patch-id: e4b967a2d11e31bb8ee1402313bc0c70b34af26b
prerequisite-patch-id: d535ea87c7ac3b194abc358567b97b5fd524c144
prerequisite-patch-id: 1b919d5298106e9014f09f6e9ca5c75cbb157399
prerequisite-patch-id: 19f12966c5081d27bc64bced052814b15f16b087
prerequisite-patch-id: a4251f6e980b8ac54aeb6cfb09f0ffe92396331d
prerequisite-patch-id: 6fad2aeaf54145934d2dfd52bed0464b18445fb5
Signature · 1 line
2.47.1
Eric Biggers
maintainerPATCH v2 1/12 lib/crc-t10dif: stop wrapping the crypto API
From: Eric Biggers <[email protected]>
In preparation for making the CRC-T10DIF library directly optimized for each architecture, like what has been done for CRC32, get rid of the weird layering where crc_t10dif_update() calls into the crypto API. Instead, move crc_t10dif_generic() into the crc-t10dif library module, and make crc_t10dif_update() just call crc_t10dif_generic(). Acceleration will be reintroduced via crc_t10dif_arch() in the following patches.
--- crypto/Kconfig | 1 + crypto/Makefile | 2 +- crypto/crct10dif_common.c | 82 ------------------- include/linux/crc-t10dif.h | 16 ++-- lib/Kconfig | 2 - lib/crc-t10dif.c | 156 +++++++++++-------------------------- 6 files changed, 58 insertions(+), 201 deletions(-) delete mode 100644 crypto/crct10dif_common.c
crypto/Kconfig +1 -0
@@ -1100,10 +1100,11 @@ config CRYPTO_CRC32 Used by RoCEv2 and f2fs. config CRYPTO_CRCT10DIF tristate "CRCT10DIF" select CRYPTO_HASH + select CRC_T10DIF help CRC16 CRC algorithm used for the T10 (SCSI) Data Integrity Field (DIF) CRC algorithm used by the SCSI Block Commands standard.
crypto/Makefile +1 -1
@@ -155,11 +155,11 @@ obj-$(CONFIG_CRYPTO_DEFLATE) += deflate.o obj-$(CONFIG_CRYPTO_MICHAEL_MIC) += michael_mic.o obj-$(CONFIG_CRYPTO_CRC32C) += crc32c_generic.o obj-$(CONFIG_CRYPTO_CRC32) += crc32_generic.o CFLAGS_crc32c_generic.o += -DARCH=$(ARCH) CFLAGS_crc32_generic.o += -DARCH=$(ARCH) -obj-$(CONFIG_CRYPTO_CRCT10DIF) += crct10dif_common.o crct10dif_generic.o +obj-$(CONFIG_CRYPTO_CRCT10DIF) += crct10dif_generic.o obj-$(CONFIG_CRYPTO_CRC64_ROCKSOFT) += crc64_rocksoft_generic.o obj-$(CONFIG_CRYPTO_AUTHENC) += authenc.o authencesn.o obj-$(CONFIG_CRYPTO_LZO) += lzo.o lzo-rle.o obj-$(CONFIG_CRYPTO_LZ4) += lz4.o obj-$(CONFIG_CRYPTO_LZ4HC) += lz4hc.o
crypto/crct10dif_common.c deleted +0 -82
82 lines not on this page · raw message
include/linux/crc-t10dif.h +11 -5
@@ -4,13 +4,19 @@#include <linux/types.h> #define CRC_T10DIF_DIGEST_SIZE 2#define CRC_T10DIF_BLOCK_SIZE 1 -#define CRC_T10DIF_STRING "crct10dif" -extern __u16 crc_t10dif_generic (__u16 crc,const unsigned char *buffer, -size_t len); -extern __u16 crc_t10dif (unsigned char const *,size_t ); -extern __u16 crc_t10dif_update (__u16 crc,unsigned char const *,size_t ); +u16 crc_t10dif_generic (u16 crc,const u8 *p,size_t len); + +static inline u16 crc_t10dif_update (u16 crc,const u8 *p,size_t len) +{ +return crc_t10dif_generic (crc, p, len); +} + +static inline u16 crc_t10dif (const u8 *p,size_t len) +{ +return crc_t10dif_update (0 , p, len); +}#endif
lib/Kconfig +0 -2
@@ -154,12 +154,10 @@ config CRC16 the kernel tree does. Such modules that use library CRC16 functions require M here. config CRC_T10DIF tristate "CRC calculation for the T10 Data Integrity Field" - select CRYPTO - select CRYPTO_CRCT10DIF help This option is only needed if a module that's not in the kernel tree needs to calculate CRC checks for use with the SCSI data integrity subsystem.
lib/crc-t10dif.c +45 -111
170 lines not on this page · raw message
Signature · 1 line
2.47.1
Eric Biggers
maintainerPATCH v2 2/12 lib/crc-t10dif: add support for arch overrides
In reply to Eric BiggersFrom: Eric Biggers <[email protected]>
Following what was done for CRC32, add support for architecture-specific override of the CRC-T10DIF library. This will allow the CRC-T10DIF library functions to access architecture-optimized code directly.
--- include/linux/crc-t10dif.h | 12 ++++++++++++ lib/Kconfig | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+)
include/linux/crc-t10dif.h +12 -0
@@ -5,18 +5,30 @@#include <linux/types.h> #define CRC_T10DIF_DIGEST_SIZE 2#define CRC_T10DIF_BLOCK_SIZE 1 +u16 crc_t10dif_arch (u16 crc,const u8 *p,size_t len);u16 crc_t10dif_generic (u16 crc,const u8 *p,size_t len);static inline u16 crc_t10dif_update (u16 crc,const u8 *p,size_t len) { +if (IS_ENABLED (CONFIG_CRC_T10DIF_ARCH )) +return crc_t10dif_arch (crc, p, len);return crc_t10dif_generic (crc, p, len); }static inline u16 crc_t10dif (const u8 *p,size_t len) {return crc_t10dif_update (0 , p, len); } +#if IS_ENABLED (CONFIG_CRC_T10DIF_ARCH ) +bool crc_t10dif_is_optimized (void ); +#else +static inline bool crc_t10dif_is_optimized (void ) +{ +return false; +} +#endif +#endif
lib/Kconfig +32 -0
@@ -159,10 +159,42 @@ config CRC_T10DIF help This option is only needed if a module that's not in the kernel tree needs to calculate CRC checks for use with the SCSI data integrity subsystem. +config ARCH_HAS_CRC_T10DIF + bool + +choice + prompt "CRC-T10DIF implementation" + depends on CRC_T10DIF + default CRC_T10DIF_IMPL_ARCH if ARCH_HAS_CRC_T10DIF + default CRC_T10DIF_IMPL_GENERIC if !ARCH_HAS_CRC_T10DIF + help + This option allows you to override the default choice of CRC-T10DIF + implementation. + +config CRC_T10DIF_IMPL_ARCH + bool "Architecture-optimized" if ARCH_HAS_CRC_T10DIF + help + Use the optimized implementation of CRC-T10DIF for the selected + architecture. It is recommended to keep this enabled, as it can + greatly improve CRC-T10DIF performance. + +config CRC_T10DIF_IMPL_GENERIC + bool "Generic implementation" + help + Use the generic table-based implementation of CRC-T10DIF. Selecting + this will reduce code size slightly but can greatly reduce CRC-T10DIF + performance. + +endchoice + +config CRC_T10DIF_ARCH + tristate + default CRC_T10DIF if CRC_T10DIF_IMPL_ARCH + config CRC64_ROCKSOFT tristate "CRC calculation for the Rocksoft model CRC64" select CRC64 select CRYPTO select CRYPTO_CRC64_ROCKSOFT
Signature · 1 line
2.47.1
Eric Biggers
maintainerPATCH v2 3/12 crypto: crct10dif - expose arch-optimized lib function
In reply to Eric BiggersFrom: Eric Biggers <[email protected]>
Now that crc_t10dif_update() may be directly optimized for each architecture, make the shash driver for crct10dif register a crct10dif-$arch algorithm that uses it, instead of only crct10dif-generic which uses crc_t10dif_generic().
The result is that architecture-optimized crct10dif will remain available through the shash API once the architectures implement crc_t10dif_arch() instead of the shash API.
--- crypto/Makefile | 1 + crypto/crct10dif_generic.c | 82 +++++++++++++++++++++++++++++--------- 2 files changed, 65 insertions(+), 18 deletions(-)
crypto/Makefile +1 -0
@@ -156,10 +156,11 @@ obj-$(CONFIG_CRYPTO_MICHAEL_MIC) += michael_mic.o obj-$(CONFIG_CRYPTO_CRC32C) += crc32c_generic.o obj-$(CONFIG_CRYPTO_CRC32) += crc32_generic.o CFLAGS_crc32c_generic.o += -DARCH=$(ARCH) CFLAGS_crc32_generic.o += -DARCH=$(ARCH) obj-$(CONFIG_CRYPTO_CRCT10DIF) += crct10dif_generic.o +CFLAGS_crct10dif_generic.o += -DARCH=$(ARCH) obj-$(CONFIG_CRYPTO_CRC64_ROCKSOFT) += crc64_rocksoft_generic.o obj-$(CONFIG_CRYPTO_AUTHENC) += authenc.o authencesn.o obj-$(CONFIG_CRYPTO_LZO) += lzo.o lzo-rle.o obj-$(CONFIG_CRYPTO_LZ4) += lz4.o obj-$(CONFIG_CRYPTO_LZ4HC) += lz4hc.o
crypto/crct10dif_generic.c +64 -18
123 lines not on this page · raw message
Signature · 1 line
2.47.1
Eric Biggers
maintainerPATCH v2 4/12 x86/crc-t10dif: expose CRC-T10DIF function through lib
In reply to Eric BiggersFrom: Eric Biggers <[email protected]>
Move the x86 CRC-T10DIF assembly code into the lib directory and wire it up to the library interface. This allows it to be used without going through the crypto API. It remains usable via the crypto API too via the shash algorithms that use the library interface. Thus all the arch-specific "shash" code becomes unnecessary and is removed.
---
arch/x86/Kconfig | 1 +
arch/x86/crypto/Kconfig | 10 --
arch/x86/crypto/Makefile | 3 -
arch/x86/crypto/crct10dif-pclmul_glue.c | 143 ------------------
arch/x86/lib/Makefile | 3 +
arch/x86/lib/crc-t10dif-glue.c | 51 +++++++
.../{crypto => lib}/crct10dif-pcl-asm_64.S | 0
7 files changed, 55 insertions(+), 156 deletions(-)
delete mode 100644 arch/x86/crypto/crct10dif-pclmul_glue.c
create mode 100644 arch/x86/lib/crc-t10dif-glue.c
rename arch/x86/{crypto => lib}/crct10dif-pcl-asm_64.S (100%)arch/x86/Kconfig +1 -0
@@ -75,10 +75,11 @@ config X86 select ARCH_HAS_CACHE_LINE_SIZE select ARCH_HAS_CPU_CACHE_INVALIDATE_MEMREGION select ARCH_HAS_CPU_FINALIZE_INIT select ARCH_HAS_CPU_PASID if IOMMU_SVA select ARCH_HAS_CRC32 + select ARCH_HAS_CRC_T10DIF if X86_64 select ARCH_HAS_CURRENT_STACK_POINTER select ARCH_HAS_DEBUG_VIRTUAL select ARCH_HAS_DEBUG_VM_PGTABLE if !X86_PAE select ARCH_HAS_DEVMEM_IS_ALLOWED select ARCH_HAS_DMA_OPS if GART_IOMMU || XEN
arch/x86/crypto/Kconfig +0 -10
@@ -490,16 +490,6 @@ config CRYPTO_GHASH_CLMUL_NI_INTEL GCM GHASH hash function (NIST SP800-38D) Architecture: x86_64 using: - CLMUL-NI (carry-less multiplication new instructions) -config CRYPTO_CRCT10DIF_PCLMUL - tristate "CRCT10DIF (PCLMULQDQ)" - depends on X86 && 64BIT && CRC_T10DIF - select CRYPTO_HASH - help - CRC16 CRC algorithm used for the T10 (SCSI) Data Integrity Field (DIF) - - Architecture: x86_64 using: - - PCLMULQDQ (carry-less multiplication) - endmenu
arch/x86/crypto/Makefile +0 -3
@@ -73,13 +73,10 @@ obj-$(CONFIG_CRYPTO_GHASH_CLMUL_NI_INTEL) += ghash-clmulni-intel.o ghash-clmulni-intel-y := ghash-clmulni-intel_asm.o ghash-clmulni-intel_glue.o obj-$(CONFIG_CRYPTO_POLYVAL_CLMUL_NI) += polyval-clmulni.o polyval-clmulni-y := polyval-clmulni_asm.o polyval-clmulni_glue.o -obj-$(CONFIG_CRYPTO_CRCT10DIF_PCLMUL) += crct10dif-pclmul.o -crct10dif-pclmul-y := crct10dif-pcl-asm_64.o crct10dif-pclmul_glue.o - obj-$(CONFIG_CRYPTO_POLY1305_X86_64) += poly1305-x86_64.o poly1305-x86_64-y := poly1305-x86_64-cryptogams.o poly1305_glue.o targets += poly1305-x86_64-cryptogams.S obj-$(CONFIG_CRYPTO_NHPOLY1305_SSE2) += nhpoly1305-sse2.o
arch/x86/crypto/crct10dif-pclmul_glue.c deleted +0 -143
143 lines not on this page · raw message
arch/x86/lib/Makefile +3 -0
@@ -40,10 +40,13 @@ lib-$(CONFIG_MITIGATION_RETPOLINE) += retpoline.o obj-$(CONFIG_CRC32_ARCH) += crc32-x86.o crc32-x86-y := crc32-glue.o crc32-pclmul.o crc32-x86-$(CONFIG_64BIT) += crc32c-3way.o +obj-$(CONFIG_CRC_T10DIF_ARCH) += crc-t10dif-x86.o +crc-t10dif-x86-y := crc-t10dif-glue.o crct10dif-pcl-asm_64.o + obj-y += msr.o msr-reg.o msr-reg-export.o hweight.o obj-y += iomem.o ifeq ($(CONFIG_X86_32),y) obj-y += atomic64_32.o
arch/x86/lib/crc-t10dif-glue.c new file +51 -0
51 lines not on this page · raw message
arch/x86/lib/crct10dif-pcl-asm_64.S renamed from arch/x86/crypto/crct10dif-pcl-asm_64.S +0 -0
Signature · 1 line
2.47.1
Eric Biggers
maintainerPATCH v2 5/12 arm/crc-t10dif: expose CRC-T10DIF function through lib
In reply to Eric BiggersFrom: Eric Biggers <[email protected]>
Move the arm CRC-T10DIF assembly code into the lib directory and wire it up to the library interface. This allows it to be used without going through the crypto API. It remains usable via the crypto API too via the shash algorithms that use the library interface. Thus all the arch-specific "shash" code becomes unnecessary and is removed.
Note: to see the diff from arch/arm/crypto/crct10dif-ce-glue.c to arch/arm/lib/crc-t10dif-glue.c, view this commit with 'git show -M10'.
---
arch/arm/Kconfig | 1 +
arch/arm/crypto/Kconfig | 11 --
arch/arm/crypto/Makefile | 2 -
arch/arm/crypto/crct10dif-ce-glue.c | 124 ------------------
arch/arm/lib/Makefile | 3 +
.../crc-t10dif-core.S} | 0
arch/arm/lib/crc-t10dif-glue.c | 80 +++++++++++
7 files changed, 84 insertions(+), 137 deletions(-)
delete mode 100644 arch/arm/crypto/crct10dif-ce-glue.c
rename arch/arm/{crypto/crct10dif-ce-core.S => lib/crc-t10dif-core.S} (100%)
create mode 100644 arch/arm/lib/crc-t10dif-glue.carch/arm/Kconfig +1 -0
@@ -6,10 +6,11 @@ config ARM select ARCH_CORRECT_STACKTRACE_ON_KRETPROBE if HAVE_KRETPROBES && FRAME_POINTER && !ARM_UNWIND select ARCH_HAS_BINFMT_FLAT select ARCH_HAS_CPU_CACHE_ALIASING select ARCH_HAS_CPU_FINALIZE_INIT if MMU select ARCH_HAS_CRC32 if KERNEL_MODE_NEON + select ARCH_HAS_CRC_T10DIF if KERNEL_MODE_NEON select ARCH_HAS_CURRENT_STACK_POINTER select ARCH_HAS_DEBUG_VIRTUAL if MMU select ARCH_HAS_DMA_ALLOC if MMU select ARCH_HAS_DMA_OPS select ARCH_HAS_DMA_WRITE_COMBINE if !ARM_DMA_MEM_BUFFERABLE
arch/arm/crypto/Kconfig +0 -11
@@ -220,18 +220,7 @@ config CRYPTO_CHACHA20_NEON stream cipher algorithms Architecture: arm using: - NEON (Advanced SIMD) extensions -config CRYPTO_CRCT10DIF_ARM_CE - tristate "CRCT10DIF" - depends on KERNEL_MODE_NEON - depends on CRC_T10DIF - select CRYPTO_HASH - help - CRC16 CRC algorithm used for the T10 (SCSI) Data Integrity Field (DIF) - - Architecture: arm using: - - PMULL (Polynomial Multiply Long) instructions - endmenu
arch/arm/crypto/Makefile +0 -2
@@ -18,11 +18,10 @@ obj-$(CONFIG_CRYPTO_CURVE25519_NEON) += curve25519-neon.o obj-$(CONFIG_CRYPTO_AES_ARM_CE) += aes-arm-ce.o obj-$(CONFIG_CRYPTO_SHA1_ARM_CE) += sha1-arm-ce.o obj-$(CONFIG_CRYPTO_SHA2_ARM_CE) += sha2-arm-ce.o obj-$(CONFIG_CRYPTO_GHASH_ARM_CE) += ghash-arm-ce.o -obj-$(CONFIG_CRYPTO_CRCT10DIF_ARM_CE) += crct10dif-arm-ce.o aes-arm-y := aes-cipher-core.o aes-cipher-glue.o aes-arm-bs-y := aes-neonbs-core.o aes-neonbs-glue.o sha1-arm-y := sha1-armv4-large.o sha1_glue.o sha1-arm-neon-y := sha1-armv7-neon.o sha1_neon_glue.o
@@ -34,11 +33,10 @@ libblake2s-arm-y:= blake2s-core.o blake2s-glue.o blake2b-neon-y := blake2b-neon-core.o blake2b-neon-glue.o sha1-arm-ce-y := sha1-ce-core.o sha1-ce-glue.o sha2-arm-ce-y := sha2-ce-core.o sha2-ce-glue.o aes-arm-ce-y := aes-ce-core.o aes-ce-glue.o ghash-arm-ce-y := ghash-ce-core.o ghash-ce-glue.o -crct10dif-arm-ce-y := crct10dif-ce-core.o crct10dif-ce-glue.o chacha-neon-y := chacha-scalar-core.o chacha-glue.o chacha-neon-$(CONFIG_KERNEL_MODE_NEON) += chacha-neon-core.o poly1305-arm-y := poly1305-core.o poly1305-glue.o nhpoly1305-neon-y := nh-neon-core.o nhpoly1305-neon-glue.o curve25519-neon-y := curve25519-core.o curve25519-glue.o
arch/arm/crypto/crct10dif-ce-glue.c deleted +0 -124
124 lines not on this page · raw message
arch/arm/lib/Makefile +3 -0
@@ -46,5 +46,8 @@ endif obj-$(CONFIG_FUNCTION_ERROR_INJECTION) += error-inject.o obj-$(CONFIG_CRC32_ARCH) += crc32-arm.o crc32-arm-y := crc32-glue.o crc32-core.o + +obj-$(CONFIG_CRC_T10DIF_ARCH) += crc-t10dif-arm.o +crc-t10dif-arm-y := crc-t10dif-glue.o crc-t10dif-core.o
arch/arm/lib/crc-t10dif-core.S renamed from arch/arm/crypto/crct10dif-ce-core.S +0 -0
arch/arm/lib/crc-t10dif-glue.c new file +80 -0
80 lines not on this page · raw message
Signature · 1 line
2.47.1
Eric Biggers
maintainerPATCH v2 6/12 arm64/crc-t10dif: expose CRC-T10DIF function through lib
In reply to Eric BiggersFrom: Eric Biggers <[email protected]>
Move the arm64 CRC-T10DIF assembly code into the lib directory and wire it up to the library interface. This allows it to be used without going through the crypto API. It remains usable via the crypto API too via the shash algorithms that use the library interface. Thus all the arch-specific "shash" code becomes unnecessary and is removed.
Note: to see the diff from arch/arm64/crypto/crct10dif-ce-glue.c to arch/arm64/lib/crc-t10dif-glue.c, view this commit with 'git show -M10'.
---
arch/arm64/Kconfig | 1 +
arch/arm64/configs/defconfig | 1 -
arch/arm64/crypto/Kconfig | 10 --
arch/arm64/crypto/Makefile | 3 -
arch/arm64/crypto/crct10dif-ce-glue.c | 132 ------------------
arch/arm64/lib/Makefile | 3 +
.../crc-t10dif-core.S} | 0
arch/arm64/lib/crc-t10dif-glue.c | 81 +++++++++++
.../testing/selftests/arm64/fp/kernel-test.c | 3 +-
9 files changed, 86 insertions(+), 148 deletions(-)
delete mode 100644 arch/arm64/crypto/crct10dif-ce-glue.c
rename arch/arm64/{crypto/crct10dif-ce-core.S => lib/crc-t10dif-core.S} (100%)
create mode 100644 arch/arm64/lib/crc-t10dif-glue.carch/arm64/Kconfig +1 -0
@@ -20,10 +20,11 @@ config ARM64 select ARCH_ENABLE_SPLIT_PMD_PTLOCK if PGTABLE_LEVELS > 2 select ARCH_ENABLE_THP_MIGRATION if TRANSPARENT_HUGEPAGE select ARCH_HAS_CACHE_LINE_SIZE select ARCH_HAS_CC_PLATFORM select ARCH_HAS_CRC32 + select ARCH_HAS_CRC_T10DIF if KERNEL_MODE_NEON select ARCH_HAS_CURRENT_STACK_POINTER select ARCH_HAS_DEBUG_VIRTUAL select ARCH_HAS_DEBUG_VM_PGTABLE select ARCH_HAS_DMA_OPS if XEN select ARCH_HAS_DMA_PREP_COHERENT
arch/arm64/configs/defconfig +0 -1
@@ -1696,11 +1696,10 @@ CONFIG_CRYPTO_SHA512_ARM64_CE=m CONFIG_CRYPTO_SHA3_ARM64=m CONFIG_CRYPTO_SM3_ARM64_CE=m CONFIG_CRYPTO_AES_ARM64_CE_BLK=y CONFIG_CRYPTO_AES_ARM64_BS=m CONFIG_CRYPTO_AES_ARM64_CE_CCM=y -CONFIG_CRYPTO_CRCT10DIF_ARM64_CE=m CONFIG_CRYPTO_DEV_SUN8I_CE=m CONFIG_CRYPTO_DEV_FSL_CAAM=m CONFIG_CRYPTO_DEV_FSL_DPAA2_CAAM=m CONFIG_CRYPTO_DEV_QCE=m CONFIG_CRYPTO_DEV_QCOM_RNG=m
arch/arm64/crypto/Kconfig +0 -10
@@ -310,17 +310,7 @@ config CRYPTO_SM4_ARM64_CE_GCM Architecture: arm64 using: - ARMv8 Crypto Extensions - PMULL (Polynomial Multiply Long) instructions - NEON (Advanced SIMD) extensions -config CRYPTO_CRCT10DIF_ARM64_CE - tristate "CRCT10DIF (PMULL)" - depends on KERNEL_MODE_NEON && CRC_T10DIF - select CRYPTO_HASH - help - CRC16 CRC algorithm used for the T10 (SCSI) Data Integrity Field (DIF) - - Architecture: arm64 using - - PMULL (Polynomial Multiply Long) instructions - endmenu
arch/arm64/crypto/Makefile +0 -3
@@ -42,13 +42,10 @@ obj-$(CONFIG_CRYPTO_GHASH_ARM64_CE) += ghash-ce.o ghash-ce-y := ghash-ce-glue.o ghash-ce-core.o obj-$(CONFIG_CRYPTO_POLYVAL_ARM64_CE) += polyval-ce.o polyval-ce-y := polyval-ce-glue.o polyval-ce-core.o -obj-$(CONFIG_CRYPTO_CRCT10DIF_ARM64_CE) += crct10dif-ce.o -crct10dif-ce-y := crct10dif-ce-core.o crct10dif-ce-glue.o - obj-$(CONFIG_CRYPTO_AES_ARM64_CE) += aes-ce-cipher.o aes-ce-cipher-y := aes-ce-core.o aes-ce-glue.o obj-$(CONFIG_CRYPTO_AES_ARM64_CE_CCM) += aes-ce-ccm.o aes-ce-ccm-y := aes-ce-ccm-glue.o aes-ce-ccm-core.o
arch/arm64/crypto/crct10dif-ce-glue.c deleted +0 -132
132 lines not on this page · raw message
arch/arm64/lib/Makefile +3 -0
@@ -14,10 +14,13 @@ endif lib-$(CONFIG_ARCH_HAS_UACCESS_FLUSHCACHE) += uaccess_flushcache.o obj-$(CONFIG_CRC32_ARCH) += crc32-arm64.o crc32-arm64-y := crc32.o crc32-glue.o +obj-$(CONFIG_CRC_T10DIF_ARCH) += crc-t10dif-arm64.o +crc-t10dif-arm64-y := crc-t10dif-glue.o crc-t10dif-core.o + obj-$(CONFIG_FUNCTION_ERROR_INJECTION) += error-inject.o obj-$(CONFIG_ARM64_MTE) += mte.o obj-$(CONFIG_KASAN_SW_TAGS) += kasan_sw_tags.o
arch/arm64/lib/crc-t10dif-core.S renamed from arch/arm64/crypto/crct10dif-ce-core.S +0 -0
arch/arm64/lib/crc-t10dif-glue.c new file +81 -0
81 lines not on this page · raw message
tools/testing/selftests/arm64/fp/kernel-test.c +1 -2
@@ -44,12 +44,11 @@ static void handle_kick_signal(int sig, siginfo_t *info, void *context) { sigs++; }static char *drivers[] = { -"crct10dif-arm64-ce" , -/* "crct10dif-arm64-neon", - Same priority as generic */ +"crct10dif-arm64" ,"sha1-ce" ,"sha224-arm64" ,"sha224-arm64-neon" ,"sha224-ce" ,"sha256-arm64" ,
Signature · 1 line
2.47.1
Eric Biggers
maintainerPATCH v2 7/12 powerpc/crc-t10dif: expose CRC-T10DIF function through lib
In reply to Eric BiggersFrom: Eric Biggers <[email protected]>
Move the powerpc CRC-T10DIF assembly code into the lib directory and wire it up to the library interface. This allows it to be used without going through the crypto API. It remains usable via the crypto API too via the shash algorithms that use the library interface. Thus all the arch-specific "shash" code becomes unnecessary and is removed.
Note: to see the diff from arch/powerpc/crypto/crct10dif-vpmsum_glue.c to arch/powerpc/lib/crc-t10dif-glue.c, view this commit with 'git show -M10'.
---
arch/powerpc/Kconfig | 1 +
arch/powerpc/configs/powernv_defconfig | 1 -
arch/powerpc/configs/ppc64_defconfig | 1 -
arch/powerpc/crypto/Kconfig | 15 +---
arch/powerpc/crypto/Makefile | 2 -
arch/powerpc/lib/Makefile | 3 +
.../crc-t10dif-glue.c} | 69 +++++--------------
.../{crypto => lib}/crct10dif-vpmsum_asm.S | 2 +-
8 files changed, 23 insertions(+), 71 deletions(-)
rename arch/powerpc/{crypto/crct10dif-vpmsum_glue.c => lib/crc-t10dif-glue.c} (50%)
rename arch/powerpc/{crypto => lib}/crct10dif-vpmsum_asm.S (99%)arch/powerpc/Kconfig +1 -0
@@ -126,10 +126,11 @@ config PPC select ARCH_DMA_DEFAULT_COHERENT if !NOT_COHERENT_CACHE select ARCH_ENABLE_MEMORY_HOTPLUG select ARCH_ENABLE_MEMORY_HOTREMOVE select ARCH_HAS_COPY_MC if PPC64 select ARCH_HAS_CRC32 if PPC64 && ALTIVEC + select ARCH_HAS_CRC_T10DIF if PPC64 && ALTIVEC select ARCH_HAS_CURRENT_STACK_POINTER select ARCH_HAS_DEBUG_VIRTUAL select ARCH_HAS_DEBUG_VM_PGTABLE select ARCH_HAS_DEBUG_WX if STRICT_KERNEL_RWX select ARCH_HAS_DEVMEM_IS_ALLOWED
arch/powerpc/configs/powernv_defconfig +0 -1
@@ -318,11 +318,10 @@ CONFIG_FTR_FIXUP_SELFTEST=y CONFIG_MSI_BITMAP_SELFTEST=y CONFIG_XMON=y CONFIG_CRYPTO_TEST=m CONFIG_CRYPTO_PCBC=m CONFIG_CRYPTO_HMAC=y -CONFIG_CRYPTO_CRCT10DIF_VPMSUM=m CONFIG_CRYPTO_MD5_PPC=m CONFIG_CRYPTO_MICHAEL_MIC=m CONFIG_CRYPTO_SHA1_PPC=m CONFIG_CRYPTO_SHA256=y CONFIG_CRYPTO_WP512=m
arch/powerpc/configs/ppc64_defconfig +0 -1
@@ -387,11 +387,10 @@ CONFIG_CRYPTO_TWOFISH=m CONFIG_CRYPTO_PCBC=m CONFIG_CRYPTO_MICHAEL_MIC=m CONFIG_CRYPTO_SHA256=y CONFIG_CRYPTO_WP512=m CONFIG_CRYPTO_LZO=m -CONFIG_CRYPTO_CRCT10DIF_VPMSUM=m CONFIG_CRYPTO_VPMSUM_TESTER=m CONFIG_CRYPTO_MD5_PPC=m CONFIG_CRYPTO_SHA1_PPC=m CONFIG_CRYPTO_AES_GCM_P10=m CONFIG_CRYPTO_DEV_NX=y
arch/powerpc/crypto/Kconfig +2 -13
@@ -11,25 +11,14 @@ config CRYPTO_CURVE25519_PPC64 Curve25519 algorithm Architecture: PowerPC64 - Little-endian -config CRYPTO_CRCT10DIF_VPMSUM - tristate "CRC32T10DIF" - depends on PPC64 && ALTIVEC && CRC_T10DIF - select CRYPTO_HASH - help - CRC16 CRC algorithm used for the T10 (SCSI) Data Integrity Field (DIF) - - Architecture: powerpc64 using - - AltiVec extensions - - Enable on POWER8 and newer processors for improved performance. - config CRYPTO_VPMSUM_TESTER tristate "CRC32c and CRC32T10DIF hardware acceleration tester" - depends on CRYPTO_CRCT10DIF_VPMSUM && CRYPTO_CRC32C && CRC32_ARCH + depends on CRYPTO_CRC32C && CRC32_ARCH + depends on CRYPTO_CRCT10DIF && CRC_T10DIF_ARCH help Stress test for CRC32c and CRCT10DIF algorithms implemented with powerpc64 AltiVec extensions (POWER8 vpmsum instructions). Unless you are testing these algorithms, you don't need this.
arch/powerpc/crypto/Makefile +0 -2
@@ -8,11 +8,10 @@ obj-$(CONFIG_CRYPTO_AES_PPC_SPE) += aes-ppc-spe.o obj-$(CONFIG_CRYPTO_MD5_PPC) += md5-ppc.o obj-$(CONFIG_CRYPTO_SHA1_PPC) += sha1-powerpc.o obj-$(CONFIG_CRYPTO_SHA1_PPC_SPE) += sha1-ppc-spe.o obj-$(CONFIG_CRYPTO_SHA256_PPC_SPE) += sha256-ppc-spe.o -obj-$(CONFIG_CRYPTO_CRCT10DIF_VPMSUM) += crct10dif-vpmsum.o obj-$(CONFIG_CRYPTO_VPMSUM_TESTER) += crc-vpmsum_test.o obj-$(CONFIG_CRYPTO_AES_GCM_P10) += aes-gcm-p10-crypto.o obj-$(CONFIG_CRYPTO_CHACHA20_P10) += chacha-p10-crypto.o obj-$(CONFIG_CRYPTO_POLY1305_P10) += poly1305-p10-crypto.o obj-$(CONFIG_CRYPTO_DEV_VMX_ENCRYPT) += vmx-crypto.o
@@ -21,11 +20,10 @@ obj-$(CONFIG_CRYPTO_CURVE25519_PPC64) += curve25519-ppc64le.o aes-ppc-spe-y := aes-spe-core.o aes-spe-keys.o aes-tab-4k.o aes-spe-modes.o aes-spe-glue.o md5-ppc-y := md5-asm.o md5-glue.o sha1-powerpc-y := sha1-powerpc-asm.o sha1.o sha1-ppc-spe-y := sha1-spe-asm.o sha1-spe-glue.o sha256-ppc-spe-y := sha256-spe-asm.o sha256-spe-glue.o -crct10dif-vpmsum-y := crct10dif-vpmsum_asm.o crct10dif-vpmsum_glue.o aes-gcm-p10-crypto-y := aes-gcm-p10-glue.o aes-gcm-p10.o ghashp10-ppc.o aesp10-ppc.o chacha-p10-crypto-y := chacha-p10-glue.o chacha-p10le-8x.o poly1305-p10-crypto-y := poly1305-p10-glue.o poly1305-p10le_64.o vmx-crypto-objs := vmx.o aesp8-ppc.o ghashp8-ppc.o aes.o aes_cbc.o aes_ctr.o aes_xts.o ghash.o curve25519-ppc64le-y := curve25519-ppc64le-core.o curve25519-ppc64le_asm.o
arch/powerpc/lib/Makefile +3 -0
@@ -79,6 +79,9 @@ CFLAGS_xor_vmx.o += -mhard-float -maltivec $(call cc-option,-mabi=altivec) CFLAGS_xor_vmx.o += -isystem $(shell $(CC) -print-file-name=include) obj-$(CONFIG_CRC32_ARCH) += crc32-powerpc.o crc32-powerpc-y := crc32-glue.o crc32c-vpmsum_asm.o +obj-$(CONFIG_CRC_T10DIF_ARCH) += crc-t10dif-powerpc.o +crc-t10dif-powerpc-y := crc-t10dif-glue.o crct10dif-vpmsum_asm.o + obj-$(CONFIG_PPC64) += $(obj64-y)
arch/powerpc/lib/crc-t10dif-glue.c renamed from arch/powerpc/crypto/crct10dif-vpmsum_glue.c +16 -53
115 lines not on this page · raw message
arch/powerpc/lib/crct10dif-vpmsum_asm.S renamed from arch/powerpc/crypto/crct10dif-vpmsum_asm.S +1 -1
@@ -840,6 +840,6 @@ .octa 0x000000000000000000000001f65a57f8 /* x^64 div p(x) */ /* Barrett constant n */ .octa 0x0000000000000000000000018bb70000 #define CRC_FUNCTION_NAME __crct10dif_vpmsum -#include "../lib/crc32-vpmsum_core.S" +#include "crc32-vpmsum_core.S"
Signature · 1 line
2.47.1
Eric Biggers
maintainerPATCH v2 8/12 lib/crc_kunit.c: add KUnit test suite for CRC library functions
In reply to Eric BiggersFrom: Eric Biggers <[email protected]>
Add a KUnit test suite for the crc16, crc_t10dif, crc32_le, crc32_be, crc32c, and crc64_be library functions. It avoids code duplication by sharing most logic among all CRC variants. The test suite includes:
- Differential fuzz test of each CRC function against a simple bit-at-a-time reference implementation.
- Test for CRC combination, when implemented by a CRC variant.
- Optional benchmark of each CRC function with various data lengths.
This is intended as a replacement for crc32test and crc16_kunit, as well as a new test for CRC variants which didn't previously have a test.
--- lib/Kconfig.debug | 20 +++ lib/Makefile | 1 + lib/crc_kunit.c | 435 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 456 insertions(+) create mode 100644 lib/crc_kunit.c
lib/Kconfig.debug +20 -0
@@ -2836,10 +2836,30 @@ config HW_BREAKPOINT_KUNIT_TEST help Tests for hw_breakpoint constraints accounting. If unsure, say N. +config CRC_KUNIT_TEST + tristate "KUnit tests for CRC functions" if !KUNIT_ALL_TESTS + depends on KUNIT + default KUNIT_ALL_TESTS + select CRC16 + select CRC_T10DIF + select CRC32 + select CRC64 + help + Unit tests for the CRC library functions. + + This is intended to help people writing architecture-specific + optimized versions. If unsure, say N. + +config CRC_BENCHMARK + bool "Benchmark for the CRC functions" + depends on CRC_KUNIT_TEST + help + Include benchmarks in the KUnit test suite for the CRC functions. + config SIPHASH_KUNIT_TEST tristate "Perform selftest on siphash functions" if !KUNIT_ALL_TESTS depends on KUNIT default KUNIT_ALL_TESTS help
lib/Makefile +1 -0
@@ -389,10 +389,11 @@ obj-$(CONFIG_STACKINIT_KUNIT_TEST) += stackinit_kunit.o CFLAGS_fortify_kunit.o += $(call cc-disable-warning, unsequenced) CFLAGS_fortify_kunit.o += $(call cc-disable-warning, stringop-overread) CFLAGS_fortify_kunit.o += $(call cc-disable-warning, stringop-truncation) CFLAGS_fortify_kunit.o += $(DISABLE_STRUCTLEAK_PLUGIN) obj-$(CONFIG_FORTIFY_KUNIT_TEST) += fortify_kunit.o +obj-$(CONFIG_CRC_KUNIT_TEST) += crc_kunit.o obj-$(CONFIG_SIPHASH_KUNIT_TEST) += siphash_kunit.o obj-$(CONFIG_USERCOPY_KUNIT_TEST) += usercopy_kunit.o obj-$(CONFIG_CRC16_KUNIT_TEST) += crc16_kunit.o obj-$(CONFIG_GENERIC_LIB_DEVMEM_IS_ALLOWED) += devmem_is_allowed.o
lib/crc_kunit.c new file +435 -0
435 lines not on this page · raw message
Signature · 1 line
2.47.1
Re: [PATCH v2 08/12] lib/crc_kunit.c: add KUnit test suite for CRC library functions
Hi,
Quoted 19 lines · Eric Biggers
From: Eric Biggers <[email protected]>
Add a KUnit test suite for the crc16,
crc_t10dif,crc32_le,crc32_be, crc32c, andcrc64_belibrary functions. It avoids code duplication by sharing most logic among all CRC variants. The test suite includes:- Differential fuzz test of each CRC function against a simple bit-at-a-time reference implementation.
- Test for CRC combination, when implemented by a CRC variant.
- Optional benchmark of each CRC function with various data lengths.This is intended as a replacement for crc32test and
crc16_kunit, as well as a new test for CRC variants which didn't previously have a test.Reviewed-by Ard Biesheuvel <[email protected]>Reviewed-by Martin K. Petersen <[email protected]>Cc Vinicius Peixoto <[email protected]>Signed-off-by Eric Biggers <[email protected]>---
...
lib/crc_kunit.c line 181
Quoted 13 lines
lib/crc_kunit.c new file +13
-0+ + nosimd =rand32 () %8 ==0 ; + +/* +* Compute the CRC, and verify that it equals the CRC computed +* by a simple bit-at-a-time reference implementation. +*/ + expected_crc =crc_ref (v, init_crc, &test_buffer[offset], len); +if (nosimd) +local_irq_disable (); + actual_crc = v->func (init_crc, &test_buffer[offset], len); +if (nosimd) +local_irq_enable ();
This triggers a traceback on some arm systems.
[ 7.810000] ok 2 crc16_benchmark # SKIP not enabled [ 7.810000] ------------[ cut here ]------------ [ 7.810000] WARNING: CPU: 0 PID: 1145 at kernel/softirq.c:369 __local_bh_enable_ip+0x118/0x194 [ 7.810000] Modules linked in: [ 7.810000] CPU: 0 UID: 0 PID: 1145 Comm: kunit_try_catch Tainted: G N 6.14.0-rc7-00196-g88d324e69ea9 #1 [ 7.810000] Tainted: [N]=TEST [ 7.810000] Hardware name: NPCM7XX Chip family [ 7.810000] Call trace: [ 7.810000] unwind_backtrace from show_stack+0x10/0x14 [ 7.810000] show_stack from dump_stack_lvl+0x7c/0xac [ 7.810000] dump_stack_lvl from __warn+0x7c/0x1b8 [ 7.810000] __warn from warn_slowpath_fmt+0x19c/0x1a4 [ 7.810000] warn_slowpath_fmt from __local_bh_enable_ip+0x118/0x194 [ 7.810000] __local_bh_enable_ip from crc_t10dif_arch+0xd4/0xe8 [ 7.810000] crc_t10dif_arch from crc_t10dif_wrapper+0x14/0x1c [ 7.810000] crc_t10dif_wrapper from crc_main_test+0x178/0x360 [ 7.810000] crc_main_test from kunit_try_run_case+0x78/0x1e0 [ 7.810000] kunit_try_run_case from kunit_generic_run_threadfn_adapter+0x1c/0x34 [ 7.810000] kunit_generic_run_threadfn_adapter from kthread+0x118/0x254 [ 7.810000] kthread from ret_from_fork+0x14/0x28 [ 7.810000] Exception stack(0xe3651fb0 to 0xe3651ff8) [ 7.810000] 1fa0: 00000000 00000000 00000000 00000000 [ 7.810000] 1fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 [ 7.810000] 1fe0: 00000000 00000000 00000000 00000000 00000013 00000000 [ 7.810000] irq event stamp: 29 [ 7.810000] hardirqs last enabled at (27): [<c037875c>] __local_bh_enable_ip+0xb4/0x194 [ 7.810000] hardirqs last disabled at (28): [<c0b09684>] crc_main_test+0x2e4/0x360 [ 7.810000] softirqs last enabled at (26): [<c032a3ac>] kernel_neon_end+0x0/0x1c [ 7.810000] softirqs last disabled at (29): [<c032a3c8>] kernel_neon_begin+0x0/0x70 [ 7.810000] ---[ end trace 0000000000000000 ]--- [ 8.050000] # crc_t10dif_test: pass:1 fail:0 skip:0 total:1
kernel_neon_end() calls local_bh_enable() which apparently conflicts with the local_irq_disable() in above code.
Guenter
Ard Biesheuvel
reviewerRe: [PATCH v2 08/12] lib/crc_kunit.c: add KUnit test suite for CRC library functions
Quoted 72 lines · Guenter Roeck
Hi,
Quoted 19 lines · Eric Biggers
From: Eric Biggers <[email protected]>
Add a KUnit test suite for the crc16,
crc_t10dif,crc32_le,crc32_be, crc32c, andcrc64_belibrary functions. It avoids code duplication by sharing most logic among all CRC variants. The test suite includes:- Differential fuzz test of each CRC function against a simple bit-at-a-time reference implementation.
- Test for CRC combination, when implemented by a CRC variant.
- Optional benchmark of each CRC function with various data lengths.This is intended as a replacement for crc32test and
crc16_kunit, as well as a new test for CRC variants which didn't previously have a test.Reviewed-by Ard Biesheuvel <[email protected]>Reviewed-by Martin K. Petersen <[email protected]>Cc Vinicius Peixoto <[email protected]>Signed-off-by Eric Biggers <[email protected]>---
...
Review
Quoted 13 lines
(quoted diff) +13
-0+ + nosimd = rand32() % 8 == 0; + + /* + * Compute the CRC, and verify that it equals the CRC computed + * by a simple bit-at-a-time reference implementation. + */ + expected_crc = crc_ref(v, init_crc, &test_buffer[offset], len); + if (nosimd) + local_irq_disable(); + actual_crc = v->func(init_crc, &test_buffer[offset], len); + if (nosimd) + local_irq_enable();This triggers a traceback on some arm systems.
[ 7.810000] ok 2 crc16_benchmark # SKIP not enabled [ 7.810000] ------------[ cut here ]------------ [ 7.810000] WARNING: CPU: 0 PID: 1145 at kernel/softirq.c:369 __local_bh_enable_ip+0x118/0x194 [ 7.810000] Modules linked in: [ 7.810000] CPU: 0 UID: 0 PID: 1145 Comm: kunit_try_catch Tainted: G N 6.14.0-rc7-00196-g88d324e69ea9 #1 [ 7.810000] Tainted: [N]=TEST [ 7.810000] Hardware name: NPCM7XX Chip family [ 7.810000] Call trace: [ 7.810000] unwind_backtrace from show_stack+0x10/0x14 [ 7.810000] show_stack from dump_stack_lvl+0x7c/0xac [ 7.810000] dump_stack_lvl from __warn+0x7c/0x1b8 [ 7.810000] __warn from warn_slowpath_fmt+0x19c/0x1a4 [ 7.810000] warn_slowpath_fmt from __local_bh_enable_ip+0x118/0x194 [ 7.810000] __local_bh_enable_ip from crc_t10dif_arch+0xd4/0xe8 [ 7.810000] crc_t10dif_arch from crc_t10dif_wrapper+0x14/0x1c [ 7.810000] crc_t10dif_wrapper from crc_main_test+0x178/0x360 [ 7.810000] crc_main_test from kunit_try_run_case+0x78/0x1e0 [ 7.810000] kunit_try_run_case from kunit_generic_run_threadfn_adapter+0x1c/0x34 [ 7.810000] kunit_generic_run_threadfn_adapter from kthread+0x118/0x254 [ 7.810000] kthread from ret_from_fork+0x14/0x28 [ 7.810000] Exception stack(0xe3651fb0 to 0xe3651ff8) [ 7.810000] 1fa0: 00000000 00000000 00000000 00000000 [ 7.810000] 1fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 [ 7.810000] 1fe0: 00000000 00000000 00000000 00000000 00000013 00000000 [ 7.810000] irq event stamp: 29 [ 7.810000] hardirqs last enabled at (27): [<c037875c>] __local_bh_enable_ip+0xb4/0x194 [ 7.810000] hardirqs last disabled at (28): [<c0b09684>] crc_main_test+0x2e4/0x360 [ 7.810000] softirqs last enabled at (26): [<c032a3ac>] kernel_neon_end+0x0/0x1c [ 7.810000] softirqs last disabled at (29): [<c032a3c8>] kernel_neon_begin+0x0/0x70 [ 7.810000] ---[ end trace 0000000000000000 ]--- [ 8.050000] # crc_t10dif_test: pass:1 fail:0 skip:0 total:1
Quoted 3 lines
kernel_neon_end()callslocal_bh_enable()which apparently conflicts with thelocal_irq_disable()in above code.
This seems to be an oversight on my part. Can you try the below please?
arch/arm/include/asm/simd.h +2 -1
@@ -4,5 +4,6 @@static __must_check inline bool may_use_simd (void ) { -return IS_ENABLED (CONFIG_KERNEL_MODE_NEON ) && !in_hardirq (); +return IS_ENABLED (CONFIG_KERNEL_MODE_NEON ) && + !in_hardirq () && !irqs_disabled (); }
However, this test code also appears to assume that SIMD is forbidden on any architecture when IRQs are disabled, but this not guaranteed.
Re: [PATCH v2 08/12] lib/crc_kunit.c: add KUnit test suite for CRC library functions
On 3/23/25 08:35, Ard Biesheuvel wrote:
[ ... ]
Quoted 12 lines
Quoted 3 lines
kernel_neon_end()callslocal_bh_enable()which apparently conflicts with thelocal_irq_disable()in above code.This seems to be an oversight on my part. Can you try the below please?
arch/arm/include/asm/simd.h +0
-0
arch/arm/include/asm/simd.h line 9
Quoted 7 lines
arch/arm/include/asm/simd.h +2
-1@@ -4,5 +4,6 @@static __must_check inline bool may_use_simd (void ) { -return IS_ENABLED (CONFIG_KERNEL_MODE_NEON ) && !in_hardirq (); +return IS_ENABLED (CONFIG_KERNEL_MODE_NEON ) && + !in_hardirq () && !irqs_disabled (); }
Yes, that fixes the problem.
Thanks,
Guenter
Eric Biggers
maintainerRe: [PATCH v2 08/12] lib/crc_kunit.c: add KUnit test suite for CRC library functions
In reply to Ard BiesheuvelQuoted 84 lines · Ard Biesheuvel
Quoted 72 lines · Guenter Roeck
Hi,
Quoted 19 lines · Eric Biggers
From: Eric Biggers <[email protected]>
Add a KUnit test suite for the crc16,
crc_t10dif,crc32_le,crc32_be, crc32c, andcrc64_belibrary functions. It avoids code duplication by sharing most logic among all CRC variants. The test suite includes:- Differential fuzz test of each CRC function against a simple bit-at-a-time reference implementation.
- Test for CRC combination, when implemented by a CRC variant.
- Optional benchmark of each CRC function with various data lengths.This is intended as a replacement for crc32test and
crc16_kunit, as well as a new test for CRC variants which didn't previously have a test.Reviewed-by Ard Biesheuvel <[email protected]>Reviewed-by Martin K. Petersen <[email protected]>Cc Vinicius Peixoto <[email protected]>Signed-off-by Eric Biggers <[email protected]>---
...
Review
Quoted 13 lines
(quoted diff) +13
-0+ + nosimd = rand32() % 8 == 0; + + /* + * Compute the CRC, and verify that it equals the CRC computed + * by a simple bit-at-a-time reference implementation. + */ + expected_crc = crc_ref(v, init_crc, &test_buffer[offset], len); + if (nosimd) + local_irq_disable(); + actual_crc = v->func(init_crc, &test_buffer[offset], len); + if (nosimd) + local_irq_enable();This triggers a traceback on some arm systems.
[ 7.810000] ok 2 crc16_benchmark # SKIP not enabled [ 7.810000] ------------[ cut here ]------------ [ 7.810000] WARNING: CPU: 0 PID: 1145 at kernel/softirq.c:369 __local_bh_enable_ip+0x118/0x194 [ 7.810000] Modules linked in: [ 7.810000] CPU: 0 UID: 0 PID: 1145 Comm: kunit_try_catch Tainted: G N 6.14.0-rc7-00196-g88d324e69ea9 #1 [ 7.810000] Tainted: [N]=TEST [ 7.810000] Hardware name: NPCM7XX Chip family [ 7.810000] Call trace: [ 7.810000] unwind_backtrace from show_stack+0x10/0x14 [ 7.810000] show_stack from dump_stack_lvl+0x7c/0xac [ 7.810000] dump_stack_lvl from __warn+0x7c/0x1b8 [ 7.810000] __warn from warn_slowpath_fmt+0x19c/0x1a4 [ 7.810000] warn_slowpath_fmt from __local_bh_enable_ip+0x118/0x194 [ 7.810000] __local_bh_enable_ip from crc_t10dif_arch+0xd4/0xe8 [ 7.810000] crc_t10dif_arch from crc_t10dif_wrapper+0x14/0x1c [ 7.810000] crc_t10dif_wrapper from crc_main_test+0x178/0x360 [ 7.810000] crc_main_test from kunit_try_run_case+0x78/0x1e0 [ 7.810000] kunit_try_run_case from kunit_generic_run_threadfn_adapter+0x1c/0x34 [ 7.810000] kunit_generic_run_threadfn_adapter from kthread+0x118/0x254 [ 7.810000] kthread from ret_from_fork+0x14/0x28 [ 7.810000] Exception stack(0xe3651fb0 to 0xe3651ff8) [ 7.810000] 1fa0: 00000000 00000000 00000000 00000000 [ 7.810000] 1fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 [ 7.810000] 1fe0: 00000000 00000000 00000000 00000000 00000013 00000000 [ 7.810000] irq event stamp: 29 [ 7.810000] hardirqs last enabled at (27): [<c037875c>] __local_bh_enable_ip+0xb4/0x194 [ 7.810000] hardirqs last disabled at (28): [<c0b09684>] crc_main_test+0x2e4/0x360 [ 7.810000] softirqs last enabled at (26): [<c032a3ac>] kernel_neon_end+0x0/0x1c [ 7.810000] softirqs last disabled at (29): [<c032a3c8>] kernel_neon_begin+0x0/0x70 [ 7.810000] ---[ end trace 0000000000000000 ]--- [ 8.050000] # crc_t10dif_test: pass:1 fail:0 skip:0 total:1Quoted 3 lines
kernel_neon_end()callslocal_bh_enable()which apparently conflicts with thelocal_irq_disable()in above code.This seems to be an oversight on my part. Can you try the below please?
arch/arm/include/asm/simd.h +0
-0
arch/arm/include/asm/simd.h line 9
Quoted 7 lines
arch/arm/include/asm/simd.h +2
-1@@ -4,5 +4,6 @@static __must_check inline bool may_use_simd (void ) { -return IS_ENABLED (CONFIG_KERNEL_MODE_NEON ) && !in_hardirq (); +return IS_ENABLED (CONFIG_KERNEL_MODE_NEON ) && + !in_hardirq () && !irqs_disabled (); }
Thanks Ard, you beat me to it. Yes, may_use_simd() needs to be consistent with kernel_neon_begin(). On x86 there is a case where the equivalent function is expected to work when irqs_disabled(), but if there is no such case on arm this fix looks good. Can you send it out as a formal patch? Presumably for the arm maintainer to pick up.
Quoted 2 lines
However, this test code also appears to assume that SIMD is forbidden on any architecture when IRQs are disabled, but this not guaranteed.
Yes, to reliably test the no-SIMD code paths, I need to finish refactoring the crypto_simd_disabled_for_test stuff to be disentangled from the crypto subsystem so that crc_kunit.c can use it. It's on my list of things to do, and I'm planning to get it done in 6.16. Disabling hardirqs is just a trick to get there more easily on some architectures. But as this shows it's a useful test to have anyway, so we'll want to keep that too. The CRC functions need to work in any context, and any context that we can easily test we should do so.
- Eric
Ard Biesheuvel
reviewerRe: [PATCH v2 08/12] lib/crc_kunit.c: add KUnit test suite for CRC library functions
Quoted 87 lines · Eric Biggers
Quoted 85 lines · Ard Biesheuvel
Quoted 72 lines · Guenter Roeck
Hi,
Quoted 19 lines · Eric Biggers
From: Eric Biggers <[email protected]>
Add a KUnit test suite for the crc16,
crc_t10dif,crc32_le,crc32_be, crc32c, andcrc64_belibrary functions. It avoids code duplication by sharing most logic among all CRC variants. The test suite includes:- Differential fuzz test of each CRC function against a simple bit-at-a-time reference implementation.
- Test for CRC combination, when implemented by a CRC variant.
- Optional benchmark of each CRC function with various data lengths.This is intended as a replacement for crc32test and
crc16_kunit, as well as a new test for CRC variants which didn't previously have a test.Reviewed-by Ard Biesheuvel <[email protected]>Reviewed-by Martin K. Petersen <[email protected]>Cc Vinicius Peixoto <[email protected]>Signed-off-by Eric Biggers <[email protected]>---
...
Review
Quoted 13 lines
(quoted diff) +13
-0+ + nosimd = rand32() % 8 == 0; + + /* + * Compute the CRC, and verify that it equals the CRC computed + * by a simple bit-at-a-time reference implementation. + */ + expected_crc = crc_ref(v, init_crc, &test_buffer[offset], len); + if (nosimd) + local_irq_disable(); + actual_crc = v->func(init_crc, &test_buffer[offset], len); + if (nosimd) + local_irq_enable();This triggers a traceback on some arm systems.
[ 7.810000] ok 2 crc16_benchmark # SKIP not enabled [ 7.810000] ------------[ cut here ]------------ [ 7.810000] WARNING: CPU: 0 PID: 1145 at kernel/softirq.c:369 __local_bh_enable_ip+0x118/0x194 [ 7.810000] Modules linked in: [ 7.810000] CPU: 0 UID: 0 PID: 1145 Comm: kunit_try_catch Tainted: G N 6.14.0-rc7-00196-g88d324e69ea9 #1 [ 7.810000] Tainted: [N]=TEST [ 7.810000] Hardware name: NPCM7XX Chip family [ 7.810000] Call trace: [ 7.810000] unwind_backtrace from show_stack+0x10/0x14 [ 7.810000] show_stack from dump_stack_lvl+0x7c/0xac [ 7.810000] dump_stack_lvl from __warn+0x7c/0x1b8 [ 7.810000] __warn from warn_slowpath_fmt+0x19c/0x1a4 [ 7.810000] warn_slowpath_fmt from __local_bh_enable_ip+0x118/0x194 [ 7.810000] __local_bh_enable_ip from crc_t10dif_arch+0xd4/0xe8 [ 7.810000] crc_t10dif_arch from crc_t10dif_wrapper+0x14/0x1c [ 7.810000] crc_t10dif_wrapper from crc_main_test+0x178/0x360 [ 7.810000] crc_main_test from kunit_try_run_case+0x78/0x1e0 [ 7.810000] kunit_try_run_case from kunit_generic_run_threadfn_adapter+0x1c/0x34 [ 7.810000] kunit_generic_run_threadfn_adapter from kthread+0x118/0x254 [ 7.810000] kthread from ret_from_fork+0x14/0x28 [ 7.810000] Exception stack(0xe3651fb0 to 0xe3651ff8) [ 7.810000] 1fa0: 00000000 00000000 00000000 00000000 [ 7.810000] 1fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 [ 7.810000] 1fe0: 00000000 00000000 00000000 00000000 00000013 00000000 [ 7.810000] irq event stamp: 29 [ 7.810000] hardirqs last enabled at (27): [<c037875c>] __local_bh_enable_ip+0xb4/0x194 [ 7.810000] hardirqs last disabled at (28): [<c0b09684>] crc_main_test+0x2e4/0x360 [ 7.810000] softirqs last enabled at (26): [<c032a3ac>] kernel_neon_end+0x0/0x1c [ 7.810000] softirqs last disabled at (29): [<c032a3c8>] kernel_neon_begin+0x0/0x70 [ 7.810000] ---[ end trace 0000000000000000 ]--- [ 8.050000] # crc_t10dif_test: pass:1 fail:0 skip:0 total:1Quoted 3 lines
kernel_neon_end()callslocal_bh_enable()which apparently conflicts with thelocal_irq_disable()in above code.This seems to be an oversight on my part. Can you try the below please?
arch/arm/include/asm/simd.h +0
-0@@ -4,5 +4,6 @@
Quoted 13 lines
arch/arm/include/asm/simd.h line 9
Quoted 6 lines
arch/arm/include/asm/simd.h +2
-1static __must_check inline bool may_use_simd (void ) { -return IS_ENABLED (CONFIG_KERNEL_MODE_NEON ) && !in_hardirq (); +return IS_ENABLED (CONFIG_KERNEL_MODE_NEON ) && + !in_hardirq () && !irqs_disabled (); }Thanks Ard, you beat me to it. Yes,
may_use_simd()needs to be consistent withkernel_neon_begin(). On x86 there is a case where the equivalent function is expected to work whenirqs_disabled(), but if there is no such case on arm this fix looks good. Can you send it out as a formal patch? Presumably for the arm maintainer to pick up.
Sure.
On other architectures, we might just turn this logic around, and only disable softirqs when IRQs are enabled, as otherwise, there is no
need: we don't care about whether or not IRQs are disabled, only the softirq plumbing that we need to call into does, and no softirqs can be delivered over the back of a hard IRQ when those are disabled to begin with.
Quoted 11 lines
Quoted 2 lines
However, this test code also appears to assume that SIMD is forbidden on any architecture when IRQs are disabled, but this not guaranteed.
Yes, to reliably test the no-SIMD code paths, I need to finish refactoring the
crypto_simd_disabled_for_teststuff to be disentangled from the crypto subsystem so thatcrc_kunit.ccan use it. It's on my list of things to do, and I'm planning to get it done in 6.16. Disabling hardirqs is just a trick to get there more easily on some architectures. But as this shows it's a useful test to have anyway, so we'll want to keep that too. The CRC functions need to work in any context, and any context that we can easily test we should do so.
Sounds good.
Eric Biggers
maintainerPATCH v2 9/12 lib/crc16_kunit: delete obsolete crc16_kunit.c
In reply to Eric BiggersFrom: Eric Biggers <[email protected]>
This new test showed up in v6.13-rc1. Delete it since it is being superseded by crc_kunit.c, which is more comprehensive (tests multiple CRC variants without duplicating code, includes a benchmark, etc.).
--- lib/Kconfig.debug | 9 --- lib/Makefile | 1 - lib/crc16_kunit.c | 155 ---------------------------------------------- 3 files changed, 165 deletions(-) delete mode 100644 lib/crc16_kunit.c
lib/Kconfig.debug +0 -9
@@ -2876,19 +2876,10 @@ config USERCOPY_KUNIT_TEST help This builds the "usercopy_kunit" module that runs sanity checks on the copy_to/from_user infrastructure, making sure basic user/kernel boundary testing is working. -config CRC16_KUNIT_TEST - tristate "KUnit tests for CRC16" - depends on KUNIT - default KUNIT_ALL_TESTS - select CRC16 - help - Enable this option to run unit tests for the kernel's CRC16 - implementation (<linux/crc16.h>). - config TEST_UDELAY tristate "udelay test driver" help This builds the "udelay_test" module that helps to make sure that udelay() is working properly.
lib/Makefile +0 -1
@@ -392,11 +392,10 @@ CFLAGS_fortify_kunit.o += $(call cc-disable-warning, stringop-truncation) CFLAGS_fortify_kunit.o += $(DISABLE_STRUCTLEAK_PLUGIN) obj-$(CONFIG_FORTIFY_KUNIT_TEST) += fortify_kunit.o obj-$(CONFIG_CRC_KUNIT_TEST) += crc_kunit.o obj-$(CONFIG_SIPHASH_KUNIT_TEST) += siphash_kunit.o obj-$(CONFIG_USERCOPY_KUNIT_TEST) += usercopy_kunit.o -obj-$(CONFIG_CRC16_KUNIT_TEST) += crc16_kunit.o obj-$(CONFIG_GENERIC_LIB_DEVMEM_IS_ALLOWED) += devmem_is_allowed.o obj-$(CONFIG_FIRMWARE_TABLE) += fw_table.o
lib/crc16_kunit.c deleted +0 -155
155 lines not on this page · raw message
Signature · 1 line
2.47.1
Eric Biggers
maintainerPATCH v2 10/12 lib/crc32test: delete obsolete crc32test.c
In reply to Eric BiggersFrom: Eric Biggers <[email protected]>
Delete crc32test.c, since it has been superseded by crc_kunit.c.
--- arch/m68k/configs/amiga_defconfig | 1 - arch/m68k/configs/apollo_defconfig | 1 - arch/m68k/configs/atari_defconfig | 1 - arch/m68k/configs/bvme6000_defconfig | 1 - arch/m68k/configs/hp300_defconfig | 1 - arch/m68k/configs/mac_defconfig | 1 - arch/m68k/configs/multi_defconfig | 1 - arch/m68k/configs/mvme147_defconfig | 1 - arch/m68k/configs/mvme16x_defconfig | 1 - arch/m68k/configs/q40_defconfig | 1 - arch/m68k/configs/sun3_defconfig | 1 - arch/m68k/configs/sun3x_defconfig | 1 - arch/s390/configs/debug_defconfig | 1 - lib/Kconfig | 9 - lib/Makefile | 1 - lib/crc32test.c | 852 --------------------------- 16 files changed, 875 deletions(-) delete mode 100644 lib/crc32test.c
arch/m68k/configs/amiga_defconfig +0 -1
@@ -604,11 +604,10 @@ CONFIG_CRYPTO_USER_API_HASH=m CONFIG_CRYPTO_USER_API_SKCIPHER=m CONFIG_CRYPTO_USER_API_RNG=m CONFIG_CRYPTO_USER_API_AEAD=m # CONFIG_CRYPTO_HW is not set CONFIG_PRIME_NUMBERS=m -CONFIG_CRC32_SELFTEST=m CONFIG_XZ_DEC_TEST=m CONFIG_GLOB_SELFTEST=m # CONFIG_SECTION_MISMATCH_WARN_ONLY is not set CONFIG_MAGIC_SYSRQ=y CONFIG_TEST_LOCKUP=m
arch/m68k/configs/apollo_defconfig +0 -1
@@ -561,11 +561,10 @@ CONFIG_CRYPTO_USER_API_HASH=m CONFIG_CRYPTO_USER_API_SKCIPHER=m CONFIG_CRYPTO_USER_API_RNG=m CONFIG_CRYPTO_USER_API_AEAD=m # CONFIG_CRYPTO_HW is not set CONFIG_PRIME_NUMBERS=m -CONFIG_CRC32_SELFTEST=m CONFIG_XZ_DEC_TEST=m CONFIG_GLOB_SELFTEST=m # CONFIG_SECTION_MISMATCH_WARN_ONLY is not set CONFIG_MAGIC_SYSRQ=y CONFIG_TEST_LOCKUP=m
arch/m68k/configs/atari_defconfig +0 -1
@@ -581,11 +581,10 @@ CONFIG_CRYPTO_USER_API_HASH=m CONFIG_CRYPTO_USER_API_SKCIPHER=m CONFIG_CRYPTO_USER_API_RNG=m CONFIG_CRYPTO_USER_API_AEAD=m # CONFIG_CRYPTO_HW is not set CONFIG_PRIME_NUMBERS=m -CONFIG_CRC32_SELFTEST=m CONFIG_XZ_DEC_TEST=m CONFIG_GLOB_SELFTEST=m # CONFIG_SECTION_MISMATCH_WARN_ONLY is not set CONFIG_MAGIC_SYSRQ=y CONFIG_TEST_LOCKUP=m
arch/m68k/configs/bvme6000_defconfig +0 -1
@@ -553,11 +553,10 @@ CONFIG_CRYPTO_USER_API_HASH=m CONFIG_CRYPTO_USER_API_SKCIPHER=m CONFIG_CRYPTO_USER_API_RNG=m CONFIG_CRYPTO_USER_API_AEAD=m # CONFIG_CRYPTO_HW is not set CONFIG_PRIME_NUMBERS=m -CONFIG_CRC32_SELFTEST=m CONFIG_XZ_DEC_TEST=m CONFIG_GLOB_SELFTEST=m # CONFIG_SECTION_MISMATCH_WARN_ONLY is not set CONFIG_MAGIC_SYSRQ=y CONFIG_TEST_LOCKUP=m
arch/m68k/configs/hp300_defconfig +0 -1
@@ -563,11 +563,10 @@ CONFIG_CRYPTO_USER_API_HASH=m CONFIG_CRYPTO_USER_API_SKCIPHER=m CONFIG_CRYPTO_USER_API_RNG=m CONFIG_CRYPTO_USER_API_AEAD=m # CONFIG_CRYPTO_HW is not set CONFIG_PRIME_NUMBERS=m -CONFIG_CRC32_SELFTEST=m CONFIG_XZ_DEC_TEST=m CONFIG_GLOB_SELFTEST=m # CONFIG_SECTION_MISMATCH_WARN_ONLY is not set CONFIG_MAGIC_SYSRQ=y CONFIG_TEST_LOCKUP=m
arch/m68k/configs/mac_defconfig +0 -1
@@ -580,11 +580,10 @@ CONFIG_CRYPTO_USER_API_HASH=m CONFIG_CRYPTO_USER_API_SKCIPHER=m CONFIG_CRYPTO_USER_API_RNG=m CONFIG_CRYPTO_USER_API_AEAD=m # CONFIG_CRYPTO_HW is not set CONFIG_PRIME_NUMBERS=m -CONFIG_CRC32_SELFTEST=m CONFIG_XZ_DEC_TEST=m CONFIG_GLOB_SELFTEST=m # CONFIG_SECTION_MISMATCH_WARN_ONLY is not set CONFIG_MAGIC_SYSRQ=y CONFIG_TEST_LOCKUP=m
arch/m68k/configs/multi_defconfig +0 -1
@@ -667,11 +667,10 @@ CONFIG_CRYPTO_USER_API_HASH=m CONFIG_CRYPTO_USER_API_SKCIPHER=m CONFIG_CRYPTO_USER_API_RNG=m CONFIG_CRYPTO_USER_API_AEAD=m # CONFIG_CRYPTO_HW is not set CONFIG_PRIME_NUMBERS=m -CONFIG_CRC32_SELFTEST=m CONFIG_XZ_DEC_TEST=m CONFIG_GLOB_SELFTEST=m # CONFIG_SECTION_MISMATCH_WARN_ONLY is not set CONFIG_MAGIC_SYSRQ=y CONFIG_TEST_LOCKUP=m
arch/m68k/configs/mvme147_defconfig +0 -1
@@ -553,11 +553,10 @@ CONFIG_CRYPTO_USER_API_HASH=m CONFIG_CRYPTO_USER_API_SKCIPHER=m CONFIG_CRYPTO_USER_API_RNG=m CONFIG_CRYPTO_USER_API_AEAD=m # CONFIG_CRYPTO_HW is not set CONFIG_PRIME_NUMBERS=m -CONFIG_CRC32_SELFTEST=m CONFIG_XZ_DEC_TEST=m CONFIG_GLOB_SELFTEST=m # CONFIG_SECTION_MISMATCH_WARN_ONLY is not set CONFIG_MAGIC_SYSRQ=y CONFIG_TEST_LOCKUP=m
arch/m68k/configs/mvme16x_defconfig +0 -1
@@ -554,11 +554,10 @@ CONFIG_CRYPTO_USER_API_HASH=m CONFIG_CRYPTO_USER_API_SKCIPHER=m CONFIG_CRYPTO_USER_API_RNG=m CONFIG_CRYPTO_USER_API_AEAD=m # CONFIG_CRYPTO_HW is not set CONFIG_PRIME_NUMBERS=m -CONFIG_CRC32_SELFTEST=m CONFIG_XZ_DEC_TEST=m CONFIG_GLOB_SELFTEST=m # CONFIG_SECTION_MISMATCH_WARN_ONLY is not set CONFIG_MAGIC_SYSRQ=y CONFIG_TEST_LOCKUP=m
arch/m68k/configs/q40_defconfig +0 -1
@@ -570,11 +570,10 @@ CONFIG_CRYPTO_USER_API_HASH=m CONFIG_CRYPTO_USER_API_SKCIPHER=m CONFIG_CRYPTO_USER_API_RNG=m CONFIG_CRYPTO_USER_API_AEAD=m # CONFIG_CRYPTO_HW is not set CONFIG_PRIME_NUMBERS=m -CONFIG_CRC32_SELFTEST=m CONFIG_XZ_DEC_TEST=m CONFIG_GLOB_SELFTEST=m # CONFIG_SECTION_MISMATCH_WARN_ONLY is not set CONFIG_MAGIC_SYSRQ=y CONFIG_TEST_LOCKUP=m
arch/m68k/configs/sun3_defconfig +0 -1
@@ -551,11 +551,10 @@ CONFIG_CRYPTO_USER_API_HASH=m CONFIG_CRYPTO_USER_API_SKCIPHER=m CONFIG_CRYPTO_USER_API_RNG=m CONFIG_CRYPTO_USER_API_AEAD=m # CONFIG_CRYPTO_HW is not set CONFIG_PRIME_NUMBERS=m -CONFIG_CRC32_SELFTEST=m CONFIG_XZ_DEC_TEST=m CONFIG_GLOB_SELFTEST=m # CONFIG_SECTION_MISMATCH_WARN_ONLY is not set CONFIG_MAGIC_SYSRQ=y CONFIG_TEST_LOCKUP=m
arch/m68k/configs/sun3x_defconfig +0 -1
@@ -551,11 +551,10 @@ CONFIG_CRYPTO_USER_API_HASH=m CONFIG_CRYPTO_USER_API_SKCIPHER=m CONFIG_CRYPTO_USER_API_RNG=m CONFIG_CRYPTO_USER_API_AEAD=m # CONFIG_CRYPTO_HW is not set CONFIG_PRIME_NUMBERS=m -CONFIG_CRC32_SELFTEST=m CONFIG_XZ_DEC_TEST=m CONFIG_GLOB_SELFTEST=m # CONFIG_SECTION_MISMATCH_WARN_ONLY is not set CONFIG_MAGIC_SYSRQ=y CONFIG_TEST_LOCKUP=m
arch/s390/configs/debug_defconfig +0 -1
@@ -815,11 +815,10 @@ CONFIG_CRYPTO_PAES_S390=m CONFIG_CRYPTO_DEV_VIRTIO=m CONFIG_SYSTEM_BLACKLIST_KEYRING=y CONFIG_CORDIC=m CONFIG_CRYPTO_LIB_CURVE25519=m CONFIG_CRYPTO_LIB_CHACHA20POLY1305=m -CONFIG_CRC32_SELFTEST=y CONFIG_CRC4=m CONFIG_CRC7=m CONFIG_CRC8=m CONFIG_RANDOM32_SELFTEST=y CONFIG_XZ_DEC_MICROLZMA=y
lib/Kconfig +0 -9
@@ -221,19 +221,10 @@ config CRC32 functions require M here. config ARCH_HAS_CRC32 bool -config CRC32_SELFTEST - tristate "CRC32 perform self test on init" - depends on CRC32 - help - This option enables the CRC32 library functions to perform a - self test on initialization. The self test computes crc32_le - and crc32_be over byte strings with random alignment and length - and computes the total elapsed time and number of bytes processed. - choice prompt "CRC32 implementation" depends on CRC32 default CRC32_IMPL_ARCH_PLUS_SLICEBY8 if ARCH_HAS_CRC32 default CRC32_IMPL_SLICEBY8 if !ARCH_HAS_CRC32
lib/Makefile +0 -1
@@ -162,11 +162,10 @@ obj-$(CONFIG_CRC_CCITT) += crc-ccitt.o obj-$(CONFIG_CRC16) += crc16.o obj-$(CONFIG_CRC_T10DIF)+= crc-t10dif.o obj-$(CONFIG_CRC_ITU_T) += crc-itu-t.o obj-$(CONFIG_CRC32) += crc32.o obj-$(CONFIG_CRC64) += crc64.o -obj-$(CONFIG_CRC32_SELFTEST) += crc32test.o obj-$(CONFIG_CRC4) += crc4.o obj-$(CONFIG_CRC7) += crc7.o obj-$(CONFIG_CRC8) += crc8.o obj-$(CONFIG_CRC64_ROCKSOFT) += crc64-rocksoft.o obj-$(CONFIG_XXHASH) += xxhash.o
lib/crc32test.c deleted +0 -852
852 lines not on this page · raw message
Signature · 1 line
2.47.1
Re: [PATCH v2 10/12] lib/crc32test: delete obsolete crc32test.c
Quoted 8 lines · Eric Biggers
From: Eric Biggers <[email protected]>
Delete
crc32test.c, since it has been superseded bycrc_kunit.c.Reviewed-by Ard Biesheuvel <[email protected]>Reviewed-by Martin K. Petersen <[email protected]>Cc Vinicius Peixoto <[email protected]>Signed-off-by Eric Biggers <[email protected]>
Quoted 13 lines
--- arch/m68k/configs/amiga_defconfig | 1 - arch/m68k/configs/apollo_defconfig | 1 - arch/m68k/configs/atari_defconfig | 1 - arch/m68k/configs/bvme6000_defconfig | 1 - arch/m68k/configs/hp300_defconfig | 1 - arch/m68k/configs/mac_defconfig | 1 - arch/m68k/configs/multi_defconfig | 1 - arch/m68k/configs/mvme147_defconfig | 1 - arch/m68k/configs/mvme16x_defconfig | 1 - arch/m68k/configs/q40_defconfig | 1 - arch/m68k/configs/sun3_defconfig | 1 - arch/m68k/configs/sun3x_defconfig | 1 -
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Eric Biggers
maintainerPATCH v2 11/12 powerpc/crc: delete obsolete crc-vpmsum_test.c
In reply to Eric BiggersFrom: Eric Biggers <[email protected]>
Delete crc-vpmsum_test.c, since its functionality is now covered by the new crc_kunit.c as well as the crypto subsystem's fuzz tests.
--- arch/powerpc/configs/ppc64_defconfig | 1 - arch/powerpc/crypto/Kconfig | 9 -- arch/powerpc/crypto/Makefile | 1 - arch/powerpc/crypto/crc-vpmsum_test.c | 133 -------------------------- 4 files changed, 144 deletions(-) delete mode 100644 arch/powerpc/crypto/crc-vpmsum_test.c
arch/powerpc/configs/ppc64_defconfig +0 -1
@@ -387,11 +387,10 @@ CONFIG_CRYPTO_TWOFISH=m CONFIG_CRYPTO_PCBC=m CONFIG_CRYPTO_MICHAEL_MIC=m CONFIG_CRYPTO_SHA256=y CONFIG_CRYPTO_WP512=m CONFIG_CRYPTO_LZO=m -CONFIG_CRYPTO_VPMSUM_TESTER=m CONFIG_CRYPTO_MD5_PPC=m CONFIG_CRYPTO_SHA1_PPC=m CONFIG_CRYPTO_AES_GCM_P10=m CONFIG_CRYPTO_DEV_NX=y CONFIG_CRYPTO_DEV_NX_ENCRYPT=m
arch/powerpc/crypto/Kconfig +0 -9
@@ -11,19 +11,10 @@ config CRYPTO_CURVE25519_PPC64 Curve25519 algorithm Architecture: PowerPC64 - Little-endian -config CRYPTO_VPMSUM_TESTER - tristate "CRC32c and CRC32T10DIF hardware acceleration tester" - depends on CRYPTO_CRC32C && CRC32_ARCH - depends on CRYPTO_CRCT10DIF && CRC_T10DIF_ARCH - help - Stress test for CRC32c and CRCT10DIF algorithms implemented with - powerpc64 AltiVec extensions (POWER8 vpmsum instructions). - Unless you are testing these algorithms, you don't need this. - config CRYPTO_MD5_PPC tristate "Digests: MD5" depends on PPC select CRYPTO_HASH help
arch/powerpc/crypto/Makefile +0 -1
@@ -8,11 +8,10 @@ obj-$(CONFIG_CRYPTO_AES_PPC_SPE) += aes-ppc-spe.o obj-$(CONFIG_CRYPTO_MD5_PPC) += md5-ppc.o obj-$(CONFIG_CRYPTO_SHA1_PPC) += sha1-powerpc.o obj-$(CONFIG_CRYPTO_SHA1_PPC_SPE) += sha1-ppc-spe.o obj-$(CONFIG_CRYPTO_SHA256_PPC_SPE) += sha256-ppc-spe.o -obj-$(CONFIG_CRYPTO_VPMSUM_TESTER) += crc-vpmsum_test.o obj-$(CONFIG_CRYPTO_AES_GCM_P10) += aes-gcm-p10-crypto.o obj-$(CONFIG_CRYPTO_CHACHA20_P10) += chacha-p10-crypto.o obj-$(CONFIG_CRYPTO_POLY1305_P10) += poly1305-p10-crypto.o obj-$(CONFIG_CRYPTO_DEV_VMX_ENCRYPT) += vmx-crypto.o obj-$(CONFIG_CRYPTO_CURVE25519_PPC64) += curve25519-ppc64le.o
arch/powerpc/crypto/crc-vpmsum_test.c deleted +0 -133
133 lines not on this page · raw message
Signature · 1 line
2.47.1
Eric Biggers
maintainerPATCH v2 12/12 MAINTAINERS: add entry for CRC library
In reply to Eric BiggersFrom: Eric Biggers <[email protected]>
I am volunteering to maintain the kernel's CRC library code.
Ard has volunteered to be a reviewer.
--- MAINTAINERS | 11 +++++++++++ 1 file changed, 11 insertions(+)
MAINTAINERS +11 -0
@@ -6054,10 +6054,21 @@ CRAMFS FILESYSTEM M: Nicolas Pitre <[email protected]> S: Maintained F: Documentation/filesystems/cramfs.rst F: fs/cramfs/ +CRC LIBRARY +M: Eric Biggers <[email protected]> +R: Ard Biesheuvel <[email protected]> +L: [email protected] +S: Maintained +T: git https://git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux.git crc-next +F: Documentation/staging/crc* +F: arch/*/lib/crc* +F: include/linux/crc* +F: lib/crc* + CREATIVE SB0540 M: Bastien Nocera <[email protected]> L: [email protected] S: Maintained F: drivers/hid/hid-creative-sb0540.c
Signature · 1 line
2.47.1
Eric Biggers
maintainerQuoted 16 lines · Eric Biggers
This patchset is also available in git via:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux.git crc-t10dif-lib-v2
This patchset updates the kernel's CRC-T10DIF library functions to be directly optimized for x86, arm, arm64, and powerpc without taking an unnecessary and inefficient detour through the crypto API. It follows the same approach that I'm taking for CRC32 in the patchset
https://lore.kernel.org/lkml/[email protected]/This patchset also adds a CRC KUnit test suite that covers multiple CRC variants, and deletes some older ad-hoc tests that are obsoleted by it.
This patchset applies to v6.13-rc1 plus my CRC32 patchset. It can be retrieved from git using above command. This is targeting 6.14.
Quoted 10 lines
Changed in v2:
- Rebased onto v6.13-rc1.
- Tweakedcrc_t10dif_arch()for arm32 and arm64 to not callcrypto_simd_usable()more times than is necessary.
- Added patch removing redundantcrc16_kunit.cwhich got added in v6.13-rc1.
- Made some small tweaks tocrc_kunit.c.
- Listed Ard as a reviewer in theMAINTAINERSentry.
- Droppedscripts/crcfromMAINTAINERSentry, as it hasn't been added yet.
- Clarified a commit message.
- Added Reviewed-by and Acked-by's.
FYI, this patchset is now in linux-next via the crc-next branch in my repo. Additional reviews and acks would always be appreciated, of course.
- Eric