Re: [PATCH v3 10/12] perf tests: Fix the Intel PT virtual LBR check
From: Ian Rogers
Date: Sun Nov 15 2026 - 16:50:40 EST
On Sat, Nov 14, 2026 at 5:41 PM Arnaldo Carvalho de Melo
<acme@xxxxxxxxxx> wrote:
>
> The record this check uses writes aux samples, and with the single data
> page the other tests ask for they are lost:
>
> Warning: Processed 29 samples and lost 100.00%
>
> so no branches are decoded and the check fails with "Failed with virtual
> lbr". Record with 4 data pages and 128 auxtrace pages: the same trace
> decodes 64 branches and still fits the mlock budget.
>
> Require the python perf module to provide session, not just to be
> importable: a perf whose python bindings are not found can pick up an
> unrelated module and fail with
>
> Error processing events: module 'perf' has no attribute 'session'
>
> instead of skipping the subtest.
>
> Detected building perf on fedora:44 on the runner with Intel PT hardware,
> where the subtest failed with "Failed with virtual lbr" in the container,
> and with the python error when run as root on the same machine.
>
> Fixes: 915d6b14dc0c ("perf test: Migrate Intel PT virtual LBR test to Python API")
> Signed-off-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
Reviewed-by: Ian Rogers <irogers@xxxxxxxxxx>
Thanks,
Ian
> ---
> 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..511440b5956a6897 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 \
> + # Check if virtual lbr is working. This records aux samples, which a
> + # single data page overruns, so give it more room than the other tests.
> + perf_record_no_bpf -m 4,128 -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
>