kselftest/arm64: Include kernel mode NEON in fp-stress
authorMark Brown <broonie@kernel.org>
Tue, 21 May 2024 18:18:26 +0000 (19:18 +0100)
committerCatalin Marinas <catalin.marinas@arm.com>
Wed, 12 Jun 2024 14:50:36 +0000 (15:50 +0100)
commitd5859510d35d8e7d63fed5169f1775317f40fb03
treef37b403a07160ca85a3afa123d5f032a7f2836ac
parent83a7eefedc9b56fe7bfeff13b6c7356688ffa670
kselftest/arm64: Include kernel mode NEON in fp-stress

Currently fp-stress only covers userspace use of floating point, it does
not cover any kernel mode uses.  Since currently kernel mode floating
point usage can't be preempted and there are explicit preemption points in
the existing implementations this isn't so important for fp-stress but
when we readd preemption it will be good to try to exercise it.

When the arm64 accelerated crypto operations are implemented we can
relatively straightforwardly trigger kernel mode floating point usage by
using the crypto userspace API to hash data, using the splice() support
in an effort to minimise copying.  We use /proc/crypto to check which
accelerated implementations are available, picking the first symmetric
hash we find.  We run the kernel mode test unconditionally, replacing the
second copy of the FPSIMD testcase for systems with FPSIMD only. If we
don't think there are any suitable kernel mode implementations we fall back
to running another copy of fpsimd-stress.

There are a number issues with this approach, we don't actually verify
that we are using an accelerated (or even CPU) implementation of the
algorithm being tested and even with attempting to use splice() to
minimise copying there are sizing limits on how much data gets spliced
at once.

Signed-off-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20240521-arm64-fp-stress-kernel-v1-1-e38f107baad4@kernel.org
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
tools/testing/selftests/arm64/fp/.gitignore
tools/testing/selftests/arm64/fp/Makefile
tools/testing/selftests/arm64/fp/fp-stress.c
tools/testing/selftests/arm64/fp/kernel-test.c [new file with mode: 0644]