mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson
synced 2025-08-28 18:10:32 +00:00

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>
60 lines
689 B
Bash
60 lines
689 B
Bash
#!/bin/bash
|
|
# SPDX-License-Identifier: GPL-2.0-only
|
|
# Copyright (C) 2015-2019 ARM Limited.
|
|
# Original author: Dave Martin <Dave.Martin@arm.com>
|
|
|
|
set -ue
|
|
|
|
NR_CPUS=`nproc`
|
|
|
|
pids=
|
|
logs=
|
|
|
|
cleanup () {
|
|
trap - INT TERM CHLD
|
|
set +e
|
|
|
|
if [ -n "$pids" ]; then
|
|
kill $pids
|
|
wait $pids
|
|
pids=
|
|
fi
|
|
|
|
if [ -n "$logs" ]; then
|
|
cat $logs
|
|
rm $logs
|
|
logs=
|
|
fi
|
|
}
|
|
|
|
interrupt () {
|
|
cleanup
|
|
exit 0
|
|
}
|
|
|
|
child_died () {
|
|
cleanup
|
|
exit 1
|
|
}
|
|
|
|
trap interrupt INT TERM EXIT
|
|
|
|
for x in `seq 0 $((NR_CPUS * 4))`; do
|
|
log=`mktemp`
|
|
logs=$logs\ $log
|
|
./za-test >$log &
|
|
pids=$pids\ $!
|
|
done
|
|
|
|
# Wait for all child processes to be created:
|
|
sleep 10
|
|
|
|
while :; do
|
|
kill -USR1 $pids
|
|
done &
|
|
pids=$pids\ $!
|
|
|
|
wait
|
|
|
|
exit 1
|