diff options
| author | James Clark <james.clark@linaro.org> | 2025-08-13 14:38:51 +0100 |
|---|---|---|
| committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2025-10-01 15:31:49 -0300 |
| commit | 9f0fa213790e3633d37e981386da99149573135b (patch) | |
| tree | 7731bde94ae25719c245a3e6423661b6e17ebeea /tools/perf/tests/shell/test_brstack.sh | |
| parent | 11e59335b0d1c4bc259ee6f0533e04c4b3a9f1dd (diff) | |
| download | lwn-9f0fa213790e3633d37e981386da99149573135b.tar.gz lwn-9f0fa213790e3633d37e981386da99149573135b.zip | |
perf test: Extend branch stack sampling test for Arm64 BRBE
BRBE emits IRQ and ERET branches for branching and returning from
trapped instructions. Add a test that loops on a trapped instruction
(MRS - Read special register) for this.
Extend the expected 'any_call' branches to include FAULT_DATA and
FAULT_INST as these are emitted by BRBE.
Reviewed-by: Ian Rogers <irogers@google.com>
Co-developed-by: German Gomez <german.gomez@arm.com>
Signed-off-by: German Gomez <german.gomez@arm.com>
Signed-off-by: James Clark <james.clark@linaro.org>
Cc: Adam Young <admiyo@os.amperecomputing.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Anshuman Khandual <anshuman.khandual@arm.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rob Herring <robh@kernel.org>
Cc: Will Deacon <will@kernel.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/tests/shell/test_brstack.sh')
| -rwxr-xr-x | tools/perf/tests/shell/test_brstack.sh | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/tools/perf/tests/shell/test_brstack.sh b/tools/perf/tests/shell/test_brstack.sh index 252d22d39c7b..85233d435be6 100755 --- a/tools/perf/tests/shell/test_brstack.sh +++ b/tools/perf/tests/shell/test_brstack.sh @@ -34,6 +34,10 @@ trap_cleanup() { } trap trap_cleanup EXIT TERM INT +is_arm64() { + [ "$(uname -m)" = "aarch64" ]; +} + check_branches() { if ! tr -s ' ' '\n' < "$TMPDIR/perf.script" | grep -E -m1 -q "$1"; then echo "Branches missing $1" @@ -76,9 +80,24 @@ test_user_branches() { err=1 fi # some branch types are still not being tested: - # IND COND_CALL COND_RET SYSRET IRQ SERROR NO_TX + # IND COND_CALL COND_RET SYSRET SERROR NO_TX } +test_trap_eret_branches() { + echo "Testing trap & eret branches" + if ! is_arm64; then + echo "skip: not arm64" + else + perf record -o $TMPDIR/perf.data --branch-filter any,save_type,u,k -- \ + perf test -w traploop 1000 + perf script -i $TMPDIR/perf.data --fields brstacksym | \ + tr ' ' '\n' > $TMPDIR/perf.script + + # BRBINF<n>.TYPE == TRAP are mapped to PERF_BR_IRQ by the BRBE driver + check_branches "^trap_bench\+[^ ]+/[^ ]/IRQ/" + check_branches "^[^ ]+/trap_bench\+[^ ]+/ERET/" + fi +} test_kernel_branches() { echo "Testing that k option only includes kernel source addresses" @@ -162,9 +181,14 @@ set -e test_user_branches test_syscall test_kernel_branches +test_trap_eret_branches any_call="CALL|IND_CALL|COND_CALL|SYSCALL|IRQ" +if is_arm64; then + any_call="$any_call|FAULT_DATA|FAULT_INST" +fi + test_filter "any_call" "$any_call" test_filter "call" "CALL|SYSCALL" test_filter "cond" "COND" |
