perf test: Add cgroup summary test case for perf trace
Namhyung Kim
maintainerPATCH 1/1 perf test: Add cgroup summary test case for perf trace
$ sudo ./perf test -vv 112 112: perf trace summary: --- start --- test child forked, pid 1018940 testing: perf trace -s -- true testing: perf trace -S -- true testing: perf trace -s --summary-mode=thread -- true testing: perf trace -S --summary-mode=total -- true testing: perf trace -as --summary-mode=thread --no-bpf-summary -- true testing: perf trace -as --summary-mode=total --no-bpf-summary -- true testing: perf trace -as --summary-mode=thread --bpf-summary -- true testing: perf trace -as --summary-mode=total --bpf-summary -- true testing: perf trace -aS --summary-mode=total --bpf-summary -- true testing: perf trace -as --summary-mode=cgroup --bpf-summary -- true testing: perf trace -aS --summary-mode=cgroup --bpf-summary -- true ---- end(0) ---- 112: perf trace summary : Ok
--- tools/perf/tests/shell/trace_summary.sh | 6 ++++++ 1 file changed, 6 insertions(+)
tools/perf/tests/shell/trace_summary.sh +6 -0
@@ -62,4 +62,10 @@ test_perf_trace "-as --summary-mode=total --bpf-summary" # summary with normal output for system wide - total summary mode with BPF test_perf_trace "-aS --summary-mode=total --bpf-summary" +# summary only for system wide - cgroup summary mode with BPF +test_perf_trace "-as --summary-mode=cgroup --bpf-summary" + +# summary with normal output for system wide - cgroup summary mode with BPF +test_perf_trace "-aS --summary-mode=cgroup --bpf-summary" + rm -f ${OUTPUT}
Signature · 1 line
2.49.0.1164.gab81da1b16-goog
Hello Namhyung,
$ sudo /tmp/perf/perf test -vv 112 112: perf trace summary: 112: perf trace summary --- start --- test child forked, pid 1574993 testing: perf trace -s -- true testing: perf trace -S -- true testing: perf trace -s --summary-mode=thread -- true testing: perf trace -S --summary-mode=total -- true testing: perf trace -as --summary-mode=thread --no-bpf-summary -- true testing: perf trace -as --summary-mode=total --no-bpf-summary -- true testing: perf trace -as --summary-mode=thread --bpf-summary -- true testing: perf trace -as --summary-mode=total --bpf-summary -- true testing: perf trace -aS --summary-mode=total --bpf-summary -- true testing: perf trace -as --summary-mode=cgroup --bpf-summary -- true testing: perf trace -aS --summary-mode=cgroup --bpf-summary -- true ---- end(0) ---- 112: perf trace summary : Ok
Quoted 19 lines · Namhyung Kim
$ sudo ./perf test -vv 112 112: perf trace summary: --- start --- test child forked, pid 1018940 testing: perf trace -s -- true testing: perf trace -S -- true testing: perf trace -s --summary-mode=thread -- true testing: perf trace -S --summary-mode=total -- true testing: perf trace -as --summary-mode=thread --no-bpf-summary -- true testing: perf trace -as --summary-mode=total --no-bpf-summary -- true testing: perf trace -as --summary-mode=thread --bpf-summary -- true testing: perf trace -as --summary-mode=total --bpf-summary -- true testing: perf trace -aS --summary-mode=total --bpf-summary -- true testing: perf trace -as --summary-mode=cgroup --bpf-summary -- true testing: perf trace -aS --summary-mode=cgroup --bpf-summary -- true ---- end(0) ---- 112: perf trace summary : Ok
Quoted 2 lines
Cc Howard Chu <[email protected]>Signed-off-by Namhyung Kim <[email protected]>
Thanks,
Howard
Arnaldo Carvalho de Melo
maintainerQuoted 12 lines · Howard Chu
Hello Namhyung,
$ sudo /tmp/perf/perf test -vv 112 112: perf trace summary: 112: perf trace summary --- start --- test child forked, pid 1574993 testing: perf trace -s -- true testing: perf trace -S -- true testing: perf trace -s --summary-mode=thread -- true testing: perf trace -S --summary-mode=total -- true testing: perf trace -as --summary-mode=thread --no-bpf-summary -- true
Quoted 8 lines
testing: perf trace -as --summary-mode=total --no-bpf-summary -- true testing: perf trace -as --summary-mode=thread --bpf-summary -- true testing: perf trace -as --summary-mode=total --bpf-summary -- true testing: perf trace -aS --summary-mode=total --bpf-summary -- true testing: perf trace -as --summary-mode=cgroup --bpf-summary -- true testing: perf trace -aS --summary-mode=cgroup --bpf-summary -- true ---- end(0) ---- 112: perf trace summary : Ok
Thanks, tested and applied to perf-tools-next,
- Arnaldo
Quoted 28 lines · Namhyung Kim
Quoted 19 lines
$ sudo ./perf test -vv 112 112: perf trace summary: --- start --- test child forked, pid 1018940 testing: perf trace -s -- true testing: perf trace -S -- true testing: perf trace -s --summary-mode=thread -- true testing: perf trace -S --summary-mode=total -- true testing: perf trace -as --summary-mode=thread --no-bpf-summary -- true testing: perf trace -as --summary-mode=total --no-bpf-summary -- true testing: perf trace -as --summary-mode=thread --bpf-summary -- true testing: perf trace -as --summary-mode=total --bpf-summary -- true testing: perf trace -aS --summary-mode=total --bpf-summary -- true testing: perf trace -as --summary-mode=cgroup --bpf-summary -- true testing: perf trace -aS --summary-mode=cgroup --bpf-summary -- true ---- end(0) ---- 112: perf trace summary : OkQuoted 2 lines
Cc Howard Chu <[email protected]>Signed-off-by Namhyung Kim <[email protected]>Reviewed-by Howard Chu <[email protected]>Thanks,
Howard
Arnaldo Carvalho de Melo
maintainerQuoted 20 lines · Arnaldo Carvalho de Melo
Quoted 10 lines · Howard Chu
$ sudo /tmp/perf/perf test -vv 112 112: perf trace summary: 112: perf trace summary --- start --- test child forked, pid 1574993 testing: perf trace -s -- true testing: perf trace -S -- true testing: perf trace -s --summary-mode=thread -- true testing: perf trace -S --summary-mode=total -- true testing: perf trace -as --summary-mode=thread --no-bpf-summary -- trueQuoted 8 lines
testing: perf trace -as --summary-mode=total --no-bpf-summary -- true testing: perf trace -as --summary-mode=thread --bpf-summary -- true testing: perf trace -as --summary-mode=total --bpf-summary -- true testing: perf trace -aS --summary-mode=total --bpf-summary -- true testing: perf trace -as --summary-mode=cgroup --bpf-summary -- true testing: perf trace -aS --summary-mode=cgroup --bpf-summary -- true ---- end(0) ---- 112: perf trace summary : Ok
Quoted 1 line
Thanks, tested and applied to perf-tools-next,
But then when running all the tests, since this does system wide tracing, it fails:
112: perf trace summary : FAILED!
It works with the following patch applied, please check and ack/review:
From 8c868979d886e2e88aa89f4e3d884e1b6450a7b2 Mon Sep 17 00:00:00 2001
From: Arnaldo Carvalho de Melo <[email protected]>
Date: Thu, 22 May 2025 19:01:47 -0300
Subject: [PATCH 1/1] perf tests trace_summary.sh: Run in exclusive mode
And it is being successfull only when running alone, probably because there are some tests that add the vfs_getname probe that gets used by 'perf trace' and alter how it does syscall arg pathname resolution.
This should be removed or made a fallback to the preferred BPF mode of getting syscall parameters, but till then, run this in exclusive mode.
For reference, here are some of the tests that run close to this one:
127: perf record offcpu profiling tests : Ok 128: perf all PMU test : Ok 129: perf stat --bpf-counters test : Ok 130: Check Arm CoreSight trace data recording and synthesized samples: Skip 131: Check Arm CoreSight disassembly script completes without errors : Skip 132: Check Arm SPE trace data recording and synthesized samples : Skip 133: Test data symbol : Ok 134: Miscellaneous Intel PT testing : Skip 135: test Intel TPEBS counting mode : Skip 136: perf script task-analyzer tests : Ok 137: Check open filename arg using perf trace + vfs_getname : Ok 138: perf trace summary : Ok
--- tools/perf/tests/shell/trace_summary.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/tests/shell/trace_summary.sh +1 -1
@@ -1,5 +1,5 @@ #!/bin/sh -# perf trace summary +# perf trace summary (exclusive) # SPDX-License-Identifier: GPL-2.0 # Check that perf trace works with various summary mode
Signature · 1 line
2.49.0
Hello Arnaldo,
Quoted 22 lines · Arnaldo Carvalho de Melo
Quoted 19 lines · Arnaldo Carvalho de Melo
Quoted 18 lines · Howard Chu
$ sudo /tmp/perf/perf test -vv 112 112: perf trace summary: 112: perf trace summary --- start --- test child forked, pid 1574993 testing: perf trace -s -- true testing: perf trace -S -- true testing: perf trace -s --summary-mode=thread -- true testing: perf trace -S --summary-mode=total -- true testing: perf trace -as --summary-mode=thread --no-bpf-summary -- true testing: perf trace -as --summary-mode=total --no-bpf-summary -- true testing: perf trace -as --summary-mode=thread --bpf-summary -- true testing: perf trace -as --summary-mode=total --bpf-summary -- true testing: perf trace -aS --summary-mode=total --bpf-summary -- true testing: perf trace -as --summary-mode=cgroup --bpf-summary -- true testing: perf trace -aS --summary-mode=cgroup --bpf-summary -- true ---- end(0) ---- 112: perf trace summary : Ok
Quoted 6 lines
Quoted 1 line
Thanks, tested and applied to perf-tools-next,
But then when running all the tests, since this does system wide tracing, it fails:
112: perf trace summary : FAILED!
Yeah I've been trying to diagnose the parallel problem for days... I just can't find documentation about why 'returning 1' (in syscall_unaugmented) can emit a sample in tp/raw_syscalls/sys_(exit|enter)...
Thanks,
Howard
Quoted 57 lines · Arnaldo Carvalho de Melo
Quoted 20 lines · Arnaldo Carvalho de Melo
Quoted 10 lines · Howard Chu
$ sudo /tmp/perf/perf test -vv 112 112: perf trace summary: 112: perf trace summary --- start --- test child forked, pid 1574993 testing: perf trace -s -- true testing: perf trace -S -- true testing: perf trace -s --summary-mode=thread -- true testing: perf trace -S --summary-mode=total -- true testing: perf trace -as --summary-mode=thread --no-bpf-summary -- trueQuoted 8 lines
testing: perf trace -as --summary-mode=total --no-bpf-summary -- true testing: perf trace -as --summary-mode=thread --bpf-summary -- true testing: perf trace -as --summary-mode=total --bpf-summary -- true testing: perf trace -aS --summary-mode=total --bpf-summary -- true testing: perf trace -as --summary-mode=cgroup --bpf-summary -- true testing: perf trace -aS --summary-mode=cgroup --bpf-summary -- true ---- end(0) ---- 112: perf trace summary : OkQuoted 1 line
Thanks, tested and applied to perf-tools-next,
But then when running all the tests, since this does system wide tracing, it fails:
112: perf trace summary : FAILED!
It works with the following patch applied, please check and ack/review:
From
8c868979d886e2e88aa89f4e3d884e1b6450a7b2Mon Sep 17 00:00:00 2001
From: Arnaldo Carvalho de Melo <[email protected]>
Date: Thu, 22 May 2025 19:01:47 -0300
Subject: [PATCH 1/1] perf teststrace_summary.sh: Run in exclusive modeAnd it is being successfull only when running alone, probably because there are some tests that add the
vfs_getnameprobe that gets used by 'perf trace' and alter how it does syscall arg pathname resolution.This should be removed or made a fallback to the preferred BPF mode of getting syscall parameters, but till then, run this in exclusive mode.
For reference, here are some of the tests that run close to this one:
127: perf record offcpu profiling tests : Ok 128: perf all PMU test : Ok 129: perf stat --bpf-counters test : Ok 130: Check Arm CoreSight trace data recording and synthesized samples: Skip 131: Check Arm CoreSight disassembly script completes without errors : Skip 132: Check Arm SPE trace data recording and synthesized samples : Skip 133: Test data symbol : Ok 134: Miscellaneous Intel PT testing : Skip 135: test Intel TPEBS counting mode : Skip 136: perf script task-analyzer tests : Ok 137: Check open filename arg using perf trace + vfs_getname : Ok 138: perf trace summary : Ok
Quoted 8 lines
Cc Adrian Hunter <[email protected]>Cc Howard Chu <[email protected]>Cc Ian Rogers <[email protected]>Cc James Clark <[email protected]>Cc Jiri Olsa <[email protected]>Cc Kan Liang <[email protected]>Cc Namhyung Kim <[email protected]>Signed-off-by Arnaldo Carvalho de Melo <[email protected]>
Looks good to me.
Thanks,
Namhyung
Quoted 18 lines
--- tools/perf/tests/shell/trace_summary.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/perf/tests/shell/trace_summary.sh +1
-1@@ -1,5 +1,5 @@ #!/bin/sh -# perf trace summary +# perf trace summary (exclusive) # SPDX-License-Identifier: GPL-2.0 # Check that perf trace works with various summary modeSignature · 1 line
2.49.0
Hello Arnaldo and Namhyung,
Quoted 68 lines · Namhyung Kim
Quoted 57 lines · Arnaldo Carvalho de Melo
Quoted 20 lines · Arnaldo Carvalho de Melo
Quoted 10 lines · Howard Chu
$ sudo /tmp/perf/perf test -vv 112 112: perf trace summary: 112: perf trace summary --- start --- test child forked, pid 1574993 testing: perf trace -s -- true testing: perf trace -S -- true testing: perf trace -s --summary-mode=thread -- true testing: perf trace -S --summary-mode=total -- true testing: perf trace -as --summary-mode=thread --no-bpf-summary -- trueQuoted 8 lines
testing: perf trace -as --summary-mode=total --no-bpf-summary -- true testing: perf trace -as --summary-mode=thread --bpf-summary -- true testing: perf trace -as --summary-mode=total --bpf-summary -- true testing: perf trace -aS --summary-mode=total --bpf-summary -- true testing: perf trace -as --summary-mode=cgroup --bpf-summary -- true testing: perf trace -aS --summary-mode=cgroup --bpf-summary -- true ---- end(0) ---- 112: perf trace summary : OkQuoted 1 line
Thanks, tested and applied to perf-tools-next,
But then when running all the tests, since this does system wide tracing, it fails:
112: perf trace summary : FAILED!
It works with the following patch applied, please check and ack/review:
From
8c868979d886e2e88aa89f4e3d884e1b6450a7b2Mon Sep 17 00:00:00 2001
From: Arnaldo Carvalho de Melo <[email protected]>
Date: Thu, 22 May 2025 19:01:47 -0300
Subject: [PATCH 1/1] perf teststrace_summary.sh: Run in exclusive modeAnd it is being successfull only when running alone, probably because there are some tests that add the
vfs_getnameprobe that gets used by 'perf trace' and alter how it does syscall arg pathname resolution.This should be removed or made a fallback to the preferred BPF mode of getting syscall parameters, but till then, run this in exclusive mode.
For reference, here are some of the tests that run close to this one:
127: perf record offcpu profiling tests : Ok 128: perf all PMU test : Ok 129: perf stat --bpf-counters test : Ok 130: Check Arm CoreSight trace data recording and synthesized samples: Skip 131: Check Arm CoreSight disassembly script completes without errors : Skip 132: Check Arm SPE trace data recording and synthesized samples : Skip 133: Test data symbol : Ok 134: Miscellaneous Intel PT testing : Skip 135: test Intel TPEBS counting mode : Skip 136: perf script task-analyzer tests : Ok 137: Check open filename arg using perf trace + vfs_getname : Ok 138: perf trace summary : OkQuoted 8 lines
Cc Adrian Hunter <[email protected]>Cc Howard Chu <[email protected]>Cc Ian Rogers <[email protected]>Cc James Clark <[email protected]>Cc Jiri Olsa <[email protected]>Cc Kan Liang <[email protected]>Cc Namhyung Kim <[email protected]>Signed-off-by Arnaldo Carvalho de Melo <[email protected]>
Quoted 3 lines
Looks good to me.
Acked-by Namhyung Kim <[email protected]>
Nacked (sorry). I think running them tests in parallel is great
because it points out a problem that perf trace has. Please check out
this approach: https://lore.kernel.org/linux-perf-users/[email protected]/T/#u
Thanks,
Howard
Arnaldo Carvalho de Melo
maintainerQuoted 29 lines · Howard Chu
Quoted 27 lines · Namhyung Kim
Quoted 26 lines · Arnaldo Carvalho de Melo
From
8c868979d886e2e88aa89f4e3d884e1b6450a7b2Mon Sep 17 00:00:00 2001
From: Arnaldo Carvalho de Melo <[email protected]>
Date: Thu, 22 May 2025 19:01:47 -0300
Subject: [PATCH 1/1] perf teststrace_summary.sh: Run in exclusive modeAnd it is being successfull only when running alone, probably because there are some tests that add the
vfs_getnameprobe that gets used by 'perf trace' and alter how it does syscall arg pathname resolution.This should be removed or made a fallback to the preferred BPF mode of getting syscall parameters, but till then, run this in exclusive mode.
For reference, here are some of the tests that run close to this one:
127: perf record offcpu profiling tests : Ok 128: perf all PMU test : Ok 129: perf stat --bpf-counters test : Ok 130: Check Arm CoreSight trace data recording and synthesized samples: Skip 131: Check Arm CoreSight disassembly script completes without errors : Skip 132: Check Arm SPE trace data recording and synthesized samples : Skip 133: Test data symbol : Ok 134: Miscellaneous Intel PT testing : Skip 135: test Intel TPEBS counting mode : Skip 136: perf script task-analyzer tests : Ok 137: Check open filename arg using perf trace + vfs_getname : Ok 138: perf trace summary : Ok
Quoted 7 lines
Quoted 3 lines
Looks good to me.
Acked-by Namhyung Kim <[email protected]>Nacked (sorry). I think running them tests in parallel is great
because it points out a problem that perf trace has. Please check out
this approach: https://lore.kernel.org/linux-perf-users/[email protected]/T/#u
I'm not saying that perf trace shouldn't be used in parallel, but the vfs_getname code, IIRC, checks for the existence of that probe to do pathname collection (this predates the BPF method by a long time) and then counts on it to do.
There are tests that put it in place and then at the end remove it, multiple tests.
So there are possible races with that and out of being conservative I made it exclusive for the time being.
The plan is to remove that vfs_getname code in builtin-trace.c and then the tests, as we have the BPF method that is way better and should allow for parallel use.
Probably in the meantime it would be better to mark the vfs_getname ones as exclusive tho now that I that I wrote the above explanation... :-\
- Arnaldo
Hello Arnaldo,
Quoted 44 lines · Arnaldo Carvalho de Melo
Quoted 29 lines · Howard Chu
Quoted 27 lines · Namhyung Kim
Quoted 26 lines · Arnaldo Carvalho de Melo
From
8c868979d886e2e88aa89f4e3d884e1b6450a7b2Mon Sep 17 00:00:00 2001
From: Arnaldo Carvalho de Melo <[email protected]>
Date: Thu, 22 May 2025 19:01:47 -0300
Subject: [PATCH 1/1] perf teststrace_summary.sh: Run in exclusive modeAnd it is being successfull only when running alone, probably because there are some tests that add the
vfs_getnameprobe that gets used by 'perf trace' and alter how it does syscall arg pathname resolution.This should be removed or made a fallback to the preferred BPF mode of getting syscall parameters, but till then, run this in exclusive mode.
For reference, here are some of the tests that run close to this one:
127: perf record offcpu profiling tests : Ok 128: perf all PMU test : Ok 129: perf stat --bpf-counters test : Ok 130: Check Arm CoreSight trace data recording and synthesized samples: Skip 131: Check Arm CoreSight disassembly script completes without errors : Skip 132: Check Arm SPE trace data recording and synthesized samples : Skip 133: Test data symbol : Ok 134: Miscellaneous Intel PT testing : Skip 135: test Intel TPEBS counting mode : Skip 136: perf script task-analyzer tests : Ok 137: Check open filename arg using perf trace + vfs_getname : Ok 138: perf trace summary : OkQuoted 7 lines
Quoted 3 lines
Looks good to me.
Acked-by Namhyung Kim <[email protected]>Nacked (sorry). I think running them tests in parallel is great
because it points out a problem that perf trace has. Please check out
this approach: https://lore.kernel.org/linux-perf-users/[email protected]/T/#uI'm not saying that perf trace shouldn't be used in parallel, but the
vfs_getnamecode, IIRC, checks for the existence of that probe to do pathname collection (this predates the BPF method by a long time) and then counts on it to do.
Quoted 5 lines
There are tests that put it in place and then at the end remove it, multiple tests.
So there are possible races with that and out of being conservative I made it exclusive for the time being.
Thanks for explaining this.
Quoted 4 lines
The plan is to remove that
vfs_getnamecode inbuiltin-trace.cand then the tests, as we have the BPF method that is way better and should allow for parallel use.
Agreed.
Quoted 5 lines
Probably in the meantime it would be better to mark the
vfs_getnameones as exclusive tho now that I that I wrote the above explanation... :-\- Arnaldo
:)
Thanks,
Howard