[PATCH v6 11/13] perf tests: Fix the Intel PT virtual LBR check

From: Arnaldo Carvalho de Melo

Date: Tue Nov 17 2026 - 15:10:21 EST


From: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>

With one data page the virtual LBR record loses its AUX samples:

Warning: Processed 29 samples and lost 100.00%

Use --per-thread with 4 data and 64 AUX pages. Its single 276 KiB
buffer (including metadata on 4 KiB pages) fits the default 516 KiB
mlock allowance, regardless of CPU count. Also require the Python perf
module to export session: importing an unrelated perf module used
to fail the check instead of skipping it.

Fixes: 915d6b14dc0c ("perf test: Migrate Intel PT virtual LBR test to Python API")
Signed-off-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
---
tools/perf/tests/shell/test_intel_pt.sh | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/tools/perf/tests/shell/test_intel_pt.sh b/tools/perf/tests/shell/test_intel_pt.sh
index c0ecece0a8255124..ba4ed6dc6dd87a5b 100755
--- a/tools/perf/tests/shell/test_intel_pt.sh
+++ b/tools/perf/tests/shell/test_intel_pt.sh
@@ -384,13 +384,14 @@ test_virtual_lbr()
# shellcheck source=lib/setup_python.sh
. "${shelldir}"/lib/setup_python.sh

- if ! "$PYTHON" -c 'import perf' > /dev/null 2>&1; then
- echo "SKIP: Python perf module not found"
+ if ! "$PYTHON" -c 'import perf; perf.session' > /dev/null 2>&1; then
+ echo "SKIP: Python perf module with session support not found"
return 2
fi

- # Check if virtual lbr is working
- perf_record_no_bpf -o "${tmpfile}" --aux-sample \
+ # A single data page overruns aux samples; use one per-thread buffer
+ # with 4 data and 64 aux pages, plus a metadata page (276 KiB).
+ perf_record_no_bpf --per-thread -m 4,64 -o "${tmpfile}" --aux-sample \
-e '{intel_pt//,cycles}:u' perf test -w brstack || return 1
perf inject --itrace=L -i "${tmpfile}" -o "${perfdatafile}" || return 1
output=$("$PYTHON" "${shelldir}/lib/perf_brstack_max.py" -i "${perfdatafile}") || return 1
--
2.56.0