[PATCH v2 12/14] perf tests: Check CoreSight syscall entry and exit

Leo Yan leo.yan at arm.com
Wed Sep 23 08:21:52 PDT 2026


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.

Assisted-by: Codex:gpt-6
Signed-off-by: Leo Yan <leo.yan at arm.com>
---
 .../tests/shell/coresight/syscall_entry_exit.sh     | 21 +++++++++++++++++++++
 1 file changed, 21 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..bf61b1fdf6f15e290295afc7577870c6864ddd93
--- /dev/null
+++ b/tools/perf/tests/shell/coresight/syscall_entry_exit.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# CoreSight syscall entry and exit (exclusive)
+
+# shellcheck source=../lib/coresight_exception.sh
+. "$(dirname "$0")/../lib/coresight_exception.sh"
+
+test_syscall_entry_exit()
+{
+	# callchain() invokes gettid() through SVC, which returns to PC + 4.
+	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 || return 1
+}
+
+setup_exception_test || exit $?
+test_syscall_entry_exit

-- 
2.34.1




More information about the linux-arm-kernel mailing list