perf tests: Restore -p flag to lock contention test
Ian Rogers
reviewerPATCH 1/1 perf tests: Restore -p flag to lock contention test
Commit ae42a2a2a3ae ("perf tests: Speed up lock contention analysis shell test") in linux-next heavily optimized the test runtimes by switching the workload from the default of 10 process groups down to 1 (perf bench sched messaging -g 1).
However, this change inadvertently dropped the original -p flag, causing the benchmark to default to socketpair() instead of pipe(). While socketpair() still generates some lock events on x86, it fails to trigger enough samples on architectures like s390, causing the test suite to fail due to lack of captured data.
Restore the omitted -p pipe flag. The test retains the massive speedups achieved through the -g 1 scaling, while producing a massive density of lock events across all architectures to fully satisfy the BPF trace filtering logic.
--- tools/perf/tests/shell/lock_contention.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/perf/tests/shell/lock_contention.sh +2 -1
@@ -11,7 +11,8 @@ errout=$(mktemp /tmp/__perf_test.errout.XXXXX) # Workload to generate lock contention. # Using 1 group (-g 1) keeps runtime low while generating sufficient lock events. -msg_workload="perf bench sched messaging -g 1" +# We include -p (pipes) because socketpairs don't generate enough lock events on s390. +msg_workload="perf bench sched messaging -g 1 -p" cleanup() { rm -f ${perfdata}
Signature · 1 line
2.55.0.795.g602f6c329a-goog
[email protected]
AI reviewThank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] Adding the `-p` (pipe) flag to the global workload unconditionally disables the stack filter…
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Adding the -p (pipe) flag to the global workload unconditionally disables the stack filter tests. --
--- Patch [1]: [PATCH v1] perf tests: Restore -p flag to lock contention test --- commit b4bb7054950dea7123c601308622ddcd596c94cf
Author: Ian Rogers <[email protected]>
perf tests: Restore -p flag to lock contention test
This commit restores the -p flag to the perf bench sched messaging workload used by the lock contention test. By defaulting to pipes instead of socketpairs, it ensures architectures like s390 generate sufficient lock events for the BPF trace filtering logic to pass.
tools/perf/tests/shell/lock_contention.sh errout=$(mktemp /tmp/__perf_test.errout.XXXXX) · line 15
Quoted 11 lines
tools/perf/tests/shell/lock_contention.sh +2
-1@@ -11,7 +11,8 @@ errout=$(mktemp /tmp/__perf_test.errout.XXXXX) # Workload to generate lock contention. # Using 1 group (-g 1) keeps runtime low while generating sufficient lock events. -msg_workload="perf bench sched messaging -g 1" +# We include -p (pipes) because socketpairs don't generate enough lock events on s390. +msg_workload="perf bench sched messaging -g 1 -p"
[Severity: Medium]
Will adding the -p flag cause test_stack_filter() and test_aggr_task_stack_filter() to unconditionally skip?
These tests explicitly verify filtering behavior by searching for unix_stream locks in tools/perf/tests/shell/lock_contention.sh:
test_stack_filter()
{
echo "Testing perf lock contention --callstack-filter (w/ unix_stream)"
perf lock contention -i ${perfdata} -v -q 2> ${result}
if [ "$(grep -c unix_stream "${result}")" = "0" ]; then
echo "[Skip] Could not find 'unix_stream'"
return
fiSince pipes use pipe locks instead of AF_UNIX stream socket locks (unix_stream), the shared perfdata profile will no longer contain these locks.
Does this mean we lose test suite coverage for the --callstack-filter option across all architectures because the grep will always return 0?
Quoted 3 lines
tools/perf/tests/shell/lock_contention.sh +0
-0cleanup() { rm -f ${perfdata}
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Namhyung Kim
maintainerQuoted 43 lines · On Wed, Jul 08, 2026 at 05:59:47PM +0000, [email protected] wrote:
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Adding the-p(pipe) flag to the global workload unconditionally disables the stack filter tests. ----- Patch [1]: [PATCH v1] perf tests: Restore -p flag to lock contention test --- commit
b4bb7054950dea7123c601308622ddcd596c94cf
Author: Ian Rogers <[email protected]>perf tests: Restore -p flag to lock contention test
This commit restores the -p flag to the perf bench sched messaging workload used by the lock contention test. By defaulting to pipes instead of socketpairs, it ensures architectures like s390 generate sufficient lock events for the BPF trace filtering logic to pass.
tools/perf/tests/shell/lock_contention.sh errout=$(mktemp /tmp/__perf_test.errout.XXXXX) · line 15
Quoted 11 lines
tools/perf/tests/shell/lock_contention.sh +2
-1@@ -11,7 +11,8 @@ errout=$(mktemp /tmp/__perf_test.errout.XXXXX) # Workload to generate lock contention. # Using 1 group (-g 1) keeps runtime low while generating sufficient lock events. -msg_workload="perf bench sched messaging -g 1" +# We include -p (pipes) because socketpairs don't generate enough lock events on s390. +msg_workload="perf bench sched messaging -g 1 -p"[Severity: Medium]
Will adding the -p flag causetest_stack_filter()andtest_aggr_task_stack_filter()to unconditionally skip?These tests explicitly verify filtering behavior by searching for
unix_streamlocks intools/perf/tests/shell/lock_contention.sh:
test_stack_filter(){ echo "Testing perf lock contention --callstack-filter (w/ unix_stream)" perf lock contention -i ${perfdata} -v -q 2> ${result} if [ "$(grep -c unix_stream "${result}")" = "0" ]; then echo "[Skip] Could not find 'unix_stream'" return fi
Quoted 5 lines
Since pipes use pipe locks instead of
AF_UNIXstream socket locks (unix_stream), the shared perfdata profile will no longer contain these locks.Does this mean we lose test suite coverage for the --callstack-filter option across all architectures because the grep will always return 0?
I think it's a valid concern but it didn't come from this change. Maybe we need to check different symbols like "pipe_".
Thanks,
Namhyung
Quoted 26 lines · Ian Rogers
Commit
ae42a2a2a3ae("perf tests: Speed up lock contention analysis shell test") in linux-next heavily optimized the test runtimes by switching the workload from the default of 10 process groups down to 1 (perf bench sched messaging -g 1).However, this change inadvertently dropped the original
-pflag, causing the benchmark to default tosocketpair()instead ofpipe(). Whilesocketpair()still generates some lock events on x86, it fails to trigger enough samples on architectures like s390, causing the test suite to fail due to lack of captured data.Restore the omitted
-ppipe flag. The test retains the massive speedups achieved through the-g 1scaling, while producing a massive density of lock events across all architectures to fully satisfy the BPF trace filtering logic.Fixes ae42a2a2a3ae ("perf tests: Speed up lock contention analysis shell test")Signed-off-by Ian Rogers <[email protected]>Assisted-by Antigravity:gemini-3.1-pro--- tools/perf/tests/shell/lock_contention.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)tools/perf/tests/shell/lock_contention.sh +0
-0
tools/perf/tests/shell/lock_contention.sh errout=$(mktemp /tmp/__perf_test.errout.XXXXX) · line 18
Quoted 9 lines
tools/perf/tests/shell/lock_contention.sh +2
-1@@ -11,7 +11,8 @@ errout=$(mktemp /tmp/__perf_test.errout.XXXXX) # Workload to generate lock contention. # Using 1 group (-g 1) keeps runtime low while generating sufficient lock events. -msg_workload="perf bench sched messaging -g 1" +# We include -p (pipes) because socketpairs don't generate enough lock events on s390. +msg_workload="perf bench sched messaging -g 1 -p" cleanup() { rm -f ${perfdata}
Thanks a lot
Signature · 9 lines
Thomas Richter, Dept 3303, IBM s390 Linux Development, Boeblingen, Germany -- IBM Deutschland Research & Development GmbH Vorsitzender des Aufsichtsrats: Wolfgang Wendt Geschäftsführung: David Faller Sitz der Gesellschaft: Böblingen / Registergericht: Amtsgericht Stuttgart, HRB 243294
Quoted 11 lines · Ian Rogers
Commit
ae42a2a2a3ae("perf tests: Speed up lock contention analysis shell test") in linux-next heavily optimized the test runtimes by switching the workload from the default of 10 process groups down to 1 (perf bench sched messaging -g 1).However, this change inadvertently dropped the original
-pflag, causing the benchmark to default tosocketpair()instead ofpipe(). Whilesocketpair()still generates some lock events on x86, it fails to trigger enough samples on architectures like s390, causing the test suite to fail due to lack of captured data.[...]
Applied to perf-tools-next, thanks!
Best regards,
Namhyung