Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

kselftest/arm64: sme: Provide streaming mode SVE stress test

One of the features of SME is the addition of streaming mode, in which we
have access to a set of streaming mode SVE registers at the SME vector
length. Since these are accessed using the SVE instructions let's reuse
the existing SVE stress test for testing with a compile time option for
controlling the few small differences needed:

- Enter streaming mode immediately on starting the program.
- In streaming mode FFR is removed so skip reading and writing FFR.

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-33-broonie@kernel.org
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>

authored by

Mark Brown and committed by
Catalin Marinas
4126bde0 a0f2eb64

+83
+1
tools/testing/selftests/arm64/fp/.gitignore
··· 5 5 sve-probe-vls 6 6 sve-ptrace 7 7 sve-test 8 + ssve-test 8 9 vec-syscfg 9 10 vlset
+3
tools/testing/selftests/arm64/fp/Makefile
··· 5 5 TEST_PROGS_EXTENDED := fp-pidbench fpsimd-test fpsimd-stress \ 6 6 rdvl-sme rdvl-sve \ 7 7 sve-test sve-stress \ 8 + ssve-test ssve-stress \ 8 9 vlset 9 10 10 11 all: $(TEST_GEN_PROGS) $(TEST_PROGS_EXTENDED) ··· 20 19 sve-probe-vls: sve-probe-vls.o rdvl.o 21 20 sve-test: sve-test.o asm-utils.o 22 21 $(CC) -nostdlib $^ -o $@ 22 + ssve-test: sve-test.S asm-utils.o 23 + $(CC) -DSSVE -nostdlib $^ -o $@ 23 24 vec-syscfg: vec-syscfg.o rdvl.o 24 25 vlset: vlset.o 25 26
+59
tools/testing/selftests/arm64/fp/ssve-stress
··· 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 + ./ssve-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
+20
tools/testing/selftests/arm64/fp/sve-test.S
··· 13 13 #include <asm/unistd.h> 14 14 #include "assembler.h" 15 15 #include "asm-offsets.h" 16 + #include "sme-inst.h" 16 17 17 18 #define NZR 32 18 19 #define NPR 16 ··· 157 156 // We fill the upper lanes of FFR with zeros. 158 157 // Beware: corrupts P0. 159 158 function setup_ffr 159 + #ifndef SSVE 160 160 mov x4, x30 161 161 162 162 and w0, w0, #0x3 ··· 180 178 wrffr p0.b 181 179 182 180 ret x4 181 + #else 182 + ret 183 + #endif 183 184 endfunction 184 185 185 186 // Trivial memory compare: compare x2 bytes starting at address x0 with ··· 265 260 // Beware -- corrupts P0. 266 261 // Clobbers x0-x5. 267 262 function check_ffr 263 + #ifndef SSVE 268 264 mov x3, x30 269 265 270 266 ldr x4, =scratch ··· 286 280 mov x2, x5 287 281 mov x30, x3 288 282 b memcmp 283 + #else 284 + ret 285 + #endif 289 286 endfunction 290 287 291 288 // Any SVE register modified here can cause corruption in the main ··· 304 295 movi v0.8b, #1 305 296 movi v9.16b, #2 306 297 movi v31.8b, #3 298 + #ifndef SSVE 307 299 // And P0 308 300 rdffr p0.b 309 301 // And FFR 310 302 wrffr p15.b 303 + #endif 311 304 312 305 ret 313 306 endfunction ··· 370 359 .globl _start 371 360 function _start 372 361 _start: 362 + #ifdef SSVE 363 + puts "Streaming mode " 364 + smstart_sm 365 + #endif 366 + 373 367 // Sanity-check and report the vector length 374 368 375 369 rdvl x19, #8 ··· 422 406 mov w2, #SA_SIGINFO 423 407 orr w2, w2, #SA_NODEFER 424 408 bl setsignal 409 + 410 + #ifdef SSVE 411 + smstart_sm // syscalls will have exited streaming mode 412 + #endif 425 413 426 414 mov x22, #0 // generation number, increments per iteration 427 415 .Ltest_loop: