On Mon, Aug 11, 2025 at 11:26:28AM -0700, Eric Biggers wrote:
> This series updates crc_kunit to use the same interrupt context testing
> strategy that I used in the crypto KUnit tests. I.e., test CRC
> computation in hardirq, softirq, and task context concurrently. This
> detect issues related to use of the FPU/SIMD/vector registers.
>
> To allow lib/crc/tests/ and lib/crypto/tests/ to share code, move the
> needed helper function to include/kunit/run-in-irq-context.h.
> include/kunit/ seems like the most relevant location for this sort of
> thing, but let me know if there is any other preference.
>
> The third patch replaces the calls to crypto_simd_usable() in lib/crc/
> with calls to the underlying functions, now that we have a better
> solution that doesn't rely on the test injecting values. (Note that
> crc_kunit wasn't actually using the injection solution, anyway.)
>
> I'd like to take this series via crc-next.
>
> Eric Biggers (3):
> kunit, lib/crypto: Move run_irq_test() to common header
> lib/crc: crc_kunit: Test CRC computation in interrupt contexts
> lib/crc: Use underlying functions instead of crypto_simd_usable()
>
> include/kunit/run-in-irq-context.h | 129 ++++++++++++++++++++++++++
> lib/crc/arm/crc-t10dif.h | 6 +-
> lib/crc/arm/crc32.h | 6 +-
> lib/crc/arm64/crc-t10dif.h | 6 +-
> lib/crc/arm64/crc32.h | 11 ++-
> lib/crc/powerpc/crc-t10dif.h | 5 +-
> lib/crc/powerpc/crc32.h | 5 +-
> lib/crc/tests/crc_kunit.c | 62 +++++++++++--
> lib/crc/x86/crc-pclmul-template.h | 3 +-
> lib/crc/x86/crc32.h | 2 +-
> lib/crypto/tests/hash-test-template.h | 123 +-----------------------
> 11 files changed, 206 insertions(+), 152 deletions(-)
> create mode 100644 include/kunit/run-in-irq-context.h
Applied to https://git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux.git/log/?h=crc-next
But, reviews and acks would be greatly appreciated!
- Eric