linux/tools/testing/selftests/arm64/fp
Mark Brown 2b989c411a kselftest/arm64: Don't write to P0 in irritator on SME only systems
Commit 3e360ef0c0 ("kselftest/arm64: Corrupt P0 in the irritator when
testing SSVE") added corruption of P0 to the sve-test case in order to
ensure that the predicate registers were covered as part of the
corruption.  On SME only systems this results in an illegal instruction
since signal handlers are run out of streaming mode and the predicate
registers do not exist out of streaming mode without SVE.  Switch to
entering and exiting streaming mode in the irritator, this will reset
all relevant registers to 0 if they somehow weren't already by the
signal entry.

Fixes: 3e360ef0c0 ("kselftest/arm64: Corrupt P0 in the irritator when testing SSVE")
Reported-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Will Deacon <will@kernel.org>
2026-08-02 09:54:35 +00:00
..
.gitignore kselftest/arm64: Include kernel mode NEON in fp-stress 2024-06-12 15:50:36 +01:00
asm-offsets.h kselftest/arm64: Count SIGUSR2 deliveries in FP stress tests 2022-09-06 18:31:41 +01:00
asm-utils.S selftests: arm64: Factor out utility functions for assembly FP tests 2021-10-21 11:11:27 +01:00
assembler.h kselftest/arm64: Enable GCS for the FP stress tests 2024-10-04 12:04:46 +01:00
fp-pidbench.S kselftest/arm64: Raise default number of loops in fp-pidbench 2026-01-28 13:09:30 +00:00
fp-ptrace-asm.S kselftest/arm64: Add FPMR coverage to fp-ptrace 2024-11-12 13:28:49 +00:00
fp-ptrace.c kselftest/arm64: fp-ptrace: Fix checks for inactive SVE and SSVE regsets 2026-08-02 09:48:42 +00:00
fp-ptrace.h kselftest/arm64: Add FPMR coverage to fp-ptrace 2024-11-12 13:28:49 +00:00
fp-stress.c selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
fpsimd-stress selftests: arm64: Add wrapper scripts for stress tests 2020-09-18 14:17:58 +01:00
fpsimd-test.S Merge branches 'for-next/gcs', 'for-next/probes', 'for-next/asm-offsets', 'for-next/tlb', 'for-next/misc', 'for-next/mte', 'for-next/sysreg', 'for-next/stacktrace', 'for-next/hwcap3', 'for-next/kselftest', 'for-next/crc32', 'for-next/guest-cca', 'for-next/haft' and 'for-next/scs', remote-tracking branch 'arm64/for-next/perf' into for-next/core 2024-11-14 12:07:16 +00:00
kernel-test.c selftests/arm64: Fix grammatical error in string literals 2025-09-08 16:17:13 +01:00
Makefile kselftest/arm64: Include kernel mode NEON in fp-stress 2024-06-12 15:50:36 +01:00
rdvl-sme.c kselftest/arm64: Extend vector configuration API tests to cover SME 2022-04-28 17:57:11 +01:00
rdvl-sve.c kselftest/arm64: Provide a helper binary and "library" for SVE RDVL 2021-08-03 16:20:05 +01:00
rdvl.h kselftest/arm64: Extend vector configuration API tests to cover SME 2022-04-28 17:57:11 +01:00
rdvl.S kselftest/arm64: Extend vector configuration API tests to cover SME 2022-04-28 17:57:11 +01:00
README selftests: arm64: Add build and documentation for FP tests 2020-09-18 14:19:20 +01:00
sme-inst.h kselftest/arm64: Add FPMR coverage to fp-ptrace 2024-11-12 13:28:49 +00:00
ssve-stress kselftest/arm64: sme: Provide streaming mode SVE stress test 2022-04-28 17:57:11 +01:00
sve-probe-vls.c selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
sve-ptrace.c Significant patch series in this pull request: 2025-12-06 14:01:20 -08:00
sve-stress selftests: arm64: Add wrapper scripts for stress tests 2020-09-18 14:17:58 +01:00
sve-test.S kselftest/arm64: Don't write to P0 in irritator on SME only systems 2026-08-02 09:54:35 +00:00
TODO selftests: arm64: More comprehensively test the SVE ptrace interface 2021-09-29 14:40:32 +01:00
vec-syscfg.c selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
vlset.c kselftest/arm64: sme: Add SME support to vlset 2022-04-28 17:57:11 +01:00
za-fork-asm.S selftests/arm64: Add a testcase for handling of ZA on clone() 2022-04-28 17:57:12 +01:00
za-fork.c kselftest/arm64: Fix output formatting for za-fork 2023-11-23 14:16:15 +00:00
za-ptrace.c selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
za-stress kselftest/arm64: Add stress test for SME ZA context switching 2022-04-28 17:57:12 +01:00
za-test.S Merge branches 'for-next/gcs', 'for-next/probes', 'for-next/asm-offsets', 'for-next/tlb', 'for-next/misc', 'for-next/mte', 'for-next/sysreg', 'for-next/stacktrace', 'for-next/hwcap3', 'for-next/kselftest', 'for-next/crc32', 'for-next/guest-cca', 'for-next/haft' and 'for-next/scs', remote-tracking branch 'arm64/for-next/perf' into for-next/core 2024-11-14 12:07:16 +00:00
zt-ptrace.c selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
zt-test.S kselftest/arm64: Align zt-test register dumps 2025-11-07 20:00:49 +00:00

This directory contains a mix of tests integrated with kselftest and
standalone stress tests.

kselftest tests
===============

sve-probe-vls - Checks the SVE vector length enumeration interface
sve-ptrace - Checks the SVE ptrace interface

Running the non-kselftest tests
===============================

sve-stress performs an SVE context switch stress test, as described
below.

(The fpsimd-stress test works the same way; just substitute "fpsimd" for
"sve" in the following commands.)


The test runs until killed by the user.

If no context switch error was detected, you will see output such as
the following:

$ ./sve-stress
(wait for some time)
^C
Vector length:        512 bits
PID:    1573
Terminated by signal 15, no error, iterations=9467, signals=1014
Vector length:  512 bits
PID:    1575
Terminated by signal 15, no error, iterations=9448, signals=1028
Vector length:  512 bits
PID:    1577
Terminated by signal 15, no error, iterations=9436, signals=1039
Vector length:  512 bits
PID:    1579
Terminated by signal 15, no error, iterations=9421, signals=1039
Vector length:  512 bits
PID:    1581
Terminated by signal 15, no error, iterations=9403, signals=1039
Vector length:  512 bits
PID:    1583
Terminated by signal 15, no error, iterations=9385, signals=1036
Vector length:  512 bits
PID:    1585
Terminated by signal 15, no error, iterations=9376, signals=1039
Vector length:  512 bits
PID:    1587
Terminated by signal 15, no error, iterations=9361, signals=1039
Vector length:  512 bits
PID:    1589
Terminated by signal 15, no error, iterations=9350, signals=1039


If an error was detected, details of the mismatch will be printed
instead of "no error".

Ideally, the test should be allowed to run for many minutes or hours
to maximise test coverage.


KVM stress testing
==================

To try to reproduce the bugs that we have been observing, sve-stress
should be run in parallel in two KVM guests, while simultaneously
running on the host.

1) Start 2 guests, using the following command for each:

$ lkvm run --console=virtio -pconsole=hvc0 --sve Image

(Depending on the hardware GIC implementation, you may also need
--irqchip=gicv3.  New kvmtool defaults to that if appropriate, but I
can't remember whether my branch is new enough for that.  Try without
the option first.)

Kvmtool occupies the terminal until you kill it (Ctrl+A x),
or until the guest terminates.  It is therefore recommended to run
each instance in separate terminal (use screen or ssh etc.)  This
allows multiple guests to be run in parallel while running other
commands on the host.

Within the guest, the host filesystem is accessible, mounted on /host.

2) Run the sve-stress on *each* guest with the Vector-Length set to 32:
guest$ ./vlset --inherit 32 ./sve-stress

3) Run the sve-stress on the host with the maximum Vector-Length:
host$ ./vlset --inherit --max ./sve-stress


Again, the test should be allowed to run for many minutes or hours to
maximise test coverage.

If no error is detected, you will see output from each sve-stress
instance similar to that illustrated above; otherwise details of the
observed mismatches will be printed.