* [PATCH] perf test: Add LBR call stack branch filter test
@ 2026-11-02 11:02 lv.yating
2026-11-02 12:36 ` sashiko-bot
0 siblings, 1 reply; 2+ messages in thread
From: lv.yating @ 2026-11-02 11:02 UTC (permalink / raw)
To: irogers, acme, peterz, mingo, namhyung, mark.rutland,
alexander.shishkin, jolsa, adrian.hunter, james.clark
Cc: linux-perf-users, linux-kernel, liu.qingtao2, he.yilin,
zhang.cheng35, ye.zhihao1, shen.lin1, dai.hualiang
From: lvyating <lv.yating@zte.com.cn>
While debugging a NULL deref in resolve_lbr_callchain_sample()
triggered by "perf record -j stack" (fixed in commit
4626d370ae89b8af4d46a45372b269f926ec662d "perf machine:
Fix NULL deref in thread__resolve_callchain_sample()"), the "-j
stack" filter was found to lack coverage in the perf record LBR
tests.
Add "call stack" tests, sequentially and in parallel.
Use a 100% empty stack threshold, as with ind_jmp and ind_call,u,
since the stack filter is more restrictive and can leave branch
stacks empty more often.
Signed-off-by: lvyating <lv.yating@zte.com.cn>
---
tools/perf/tests/shell/record_lbr.sh | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/tools/perf/tests/shell/record_lbr.sh b/tools/perf/tests/shell/record_lbr.sh
index 8d51afeb437b..d52124355f06 100755
--- a/tools/perf/tests/shell/record_lbr.sh
+++ b/tools/perf/tests/shell/record_lbr.sh
@@ -109,7 +109,7 @@ lbr_test() {
sam_nr=$(echo "$out" | grep -c 'PERF_RECORD_SAMPLE' || true)
echo "$test: $sam_nr samples"
- bs_nr=$(echo "$out" | grep -c 'branch stack: nr:' || true)
+ bs_nr=$(echo "$out" | grep -cE 'branch (call)?stack: nr:' || true)
if [ $sam_nr -ne $bs_nr ]
then
echo "$test [Failed samples missing branch stacks]"
@@ -146,6 +146,7 @@ lbr_test "-j ind_call" "any indirect call" 2
lbr_test "-j ind_jmp" "any indirect jump" 100
lbr_test "-j call" "direct calls" 2
lbr_test "-j ind_call,u" "any indirect user call" 100
+lbr_test "-j stack" "call stack" 100
if ! ParanoidAndNotRoot 1
then
lbr_test "-a -b" "system wide any branch" 2
@@ -177,8 +178,10 @@ else
parallel_lbr_test "-a -j any_call" "parallel system wide any call" 100 &
pid9=$!
fi
+parallel_lbr_test "-j stack" "parallel call stack" 100 &
+pid10=$!
-for pid in $pid1 $pid2 $pid3 $pid4 $pid5 $pid6 $pid7 $pid8 $pid9
+for pid in $pid1 $pid2 $pid3 $pid4 $pid5 $pid6 $pid7 $pid8 $pid9 $pid10
do
set +e
wait $pid
--
2.27.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] perf test: Add LBR call stack branch filter test
2026-11-02 11:02 [PATCH] perf test: Add LBR call stack branch filter test lv.yating
@ 2026-11-02 12:36 ` sashiko-bot
0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-11-02 12:36 UTC (permalink / raw)
To: lv.yating; +Cc: linux-perf-users
> From: lvyating <lv.yating@zte.com.cn>
>
> While debugging a NULL deref in resolve_lbr_callchain_sample()
> triggered by "perf record -j stack" (fixed in commit
> 4626d370ae89b8af4d46a45372b269f926ec662d "perf machine:
> Fix NULL deref in thread__resolve_callchain_sample()"), the "-j
> stack" filter was found to lack coverage in the perf record LBR
> tests.
>
> Add "call stack" tests, sequentially and in parallel.
> Use a 100% empty stack threshold, as with ind_jmp and ind_call,u,
> since the stack filter is more restrictive and can leave branch
> stacks empty more often.
>
> Signed-off-by: lvyating <lv.yating@zte.com.cn>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/202611021227.6A2CRwkO000175@mse-fl1.zte.com.cn?part=1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-02 12:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-02 11:02 [PATCH] perf test: Add LBR call stack branch filter test lv.yating
2026-11-02 12:36 ` sashiko-bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox