Skip to content

Commit 5aa45cc

Browse files
brooniectmarinas
authored andcommitted
kselftest/arm64: Add stress test for SME ZA context switching
Add a stress test for context switching of the ZA register state based on the similar tests Dave Martin wrote for FPSIMD and SVE registers. The test loops indefinitely writing a data pattern to ZA then reading it back and verifying that it's what was expected. Unlike the other tests we manually assemble the SME instructions since at present no released toolchain has SME support integrated. Signed-off-by: Mark Brown <broonie@kernel.org> Reviewed-by: Shuah Khan <skhan@linuxfoundation.org> Acked-by: Catalin Marinas <catalin.marinas@arm.com> Link: https://lore.kernel.org/r/20220419112247.711548-35-broonie@kernel.org Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
1 parent 1a792b5 commit 5aa45cc

4 files changed

Lines changed: 451 additions & 0 deletions

File tree

tools/testing/selftests/arm64/fp/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ sve-test
88
ssve-test
99
vec-syscfg
1010
vlset
11+
za-test

tools/testing/selftests/arm64/fp/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ TEST_PROGS_EXTENDED := fp-pidbench fpsimd-test fpsimd-stress \
66
rdvl-sme rdvl-sve \
77
sve-test sve-stress \
88
ssve-test ssve-stress \
9+
za-test za-stress \
910
vlset
1011

1112
all: $(TEST_GEN_PROGS) $(TEST_PROGS_EXTENDED)
@@ -24,5 +25,7 @@ ssve-test: sve-test.S asm-utils.o
2425
$(CC) -DSSVE -nostdlib $^ -o $@
2526
vec-syscfg: vec-syscfg.o rdvl.o
2627
vlset: vlset.o
28+
za-test: za-test.o asm-utils.o
29+
$(CC) -nostdlib $^ -o $@
2730

2831
include ../../lib.mk
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#!/bin/bash
2+
# SPDX-License-Identifier: GPL-2.0-only
3+
# Copyright (C) 2015-2019 ARM Limited.
4+
# Original author: Dave Martin <Dave.Martin@arm.com>
5+
6+
set -ue
7+
8+
NR_CPUS=`nproc`
9+
10+
pids=
11+
logs=
12+
13+
cleanup () {
14+
trap - INT TERM CHLD
15+
set +e
16+
17+
if [ -n "$pids" ]; then
18+
kill $pids
19+
wait $pids
20+
pids=
21+
fi
22+
23+
if [ -n "$logs" ]; then
24+
cat $logs
25+
rm $logs
26+
logs=
27+
fi
28+
}
29+
30+
interrupt () {
31+
cleanup
32+
exit 0
33+
}
34+
35+
child_died () {
36+
cleanup
37+
exit 1
38+
}
39+
40+
trap interrupt INT TERM EXIT
41+
42+
for x in `seq 0 $((NR_CPUS * 4))`; do
43+
log=`mktemp`
44+
logs=$logs\ $log
45+
./za-test >$log &
46+
pids=$pids\ $!
47+
done
48+
49+
# Wait for all child processes to be created:
50+
sleep 10
51+
52+
while :; do
53+
kill -USR1 $pids
54+
done &
55+
pids=$pids\ $!
56+
57+
wait
58+
59+
exit 1

0 commit comments

Comments
 (0)