Record the existing callchain workload, which issues gettid() through SVC. The test requires syscall/sysret pairs to advance the PC by four bytes.
For example, an expected syscall/sysret pair is:
syscall bb76e4 => ffff800080010c00 insn: 01 00 00 d4 ... sysret ffff800080012284 => bb76e8 insn: e0 03 9f d6
The entry instruction is SVC #0 at 0xbb76e4. On syscall completion, ERET returns to 0xbb76e8, the instruction immediately after SVC.
Reviewed-by: James Clark james.clark@linaro.org Signed-off-by: Leo Yan leo.yan@arm.com --- .../tests/shell/coresight/syscall_entry_exit.sh | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+)
diff --git a/tools/perf/tests/shell/coresight/syscall_entry_exit.sh b/tools/perf/tests/shell/coresight/syscall_entry_exit.sh new file mode 100755 index 0000000000000000000000000000000000000000..cf49f9961bf710da2738ef92c12887d5fc1f06d1 --- /dev/null +++ b/tools/perf/tests/shell/coresight/syscall_entry_exit.sh @@ -0,0 +1,32 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0 +# CoreSight syscall entry and exit (exclusive) + +. "$(dirname "$0")/../lib/coresight_exception.sh" + +test_syscall_entry_exit() +{ + local attempt result + + # callchain() invokes gettid() through SVC, which returns to PC + 4. + for attempt in 1 2 3; do + echo "Recording syscalls (attempt $attempt/3)" + if ! record_trace callchain; then + cat "$tmpdir/record.log" + echo "Failed to record the callchain workload" + return 1 + fi + decode_trace || return 1 + check_exception_pairs "syscall" "sysret" 4 + result=$? + if [ "$result" -ne 2 ]; then + return "$result" + fi + done + + echo "FAIL: No complete syscall pair after three recordings" + return 1 +} + +setup_exception_test || exit $? +test_syscall_entry_exit