perf event group siblings not counting in mainline
Hi Peter,
If I try using perf with event groups on a mainline kernel, only the group leader counts:
linaro@mashed-potato:~$ perf stat --no-scale -g -e task-clock -e cpu-clock -e cs -- ls hwb linux
Performance counter stats for 'ls':
17.545541 task-clock # 0.634 CPUs utilized
0.000000 cpu-clock
0 cs # 0.000 M/sec
0.027684984 seconds time elapsedThis is fixed by b79387ef ("perf: Fix enable_on_exec for sibling events") in -next (20111222) but I can't see this queued anywhere for 3.2 (I thought I might see it in -rc7).
Is this going in for the final cut, or will groups just be borked until 3.3?
Cheers,
Will
Quoted 16 lines · Will Deacon
If I try using perf with event groups on a mainline kernel, only the group leader counts:
linaro@mashed-potato:~$ perf stat --no-scale -g -e task-clock -e cpu-clock -e cs -- ls hwb linuxPerformance counter stats for 'ls':
17.545541 task-clock # 0.634 CPUs utilized 0.000000 cpu-clock 0 cs # 0.000 M/sec 0.027684984 seconds time elapsed
Quoted 5 lines
This is fixed by
b79387ef("perf: Fixenable_on_execfor sibling events") in -next (20111222) but I can't see this queued anywhere for 3.2 (I thought I might see it in -rc7).Is this going in for the final cut, or will groups just be borked until 3.3?
Now that 3.2 is out with this regression, would it be possible to get this (b79387ef ("perf: Fix enable_on_exec for sibling events")) into -stable please?
Will
Quoted 17 lines · Will Deacon
Quoted 16 lines · Will Deacon
If I try using perf with event groups on a mainline kernel, only the group leader counts:
linaro@mashed-potato:~$ perf stat --no-scale -g -e task-clock -e cpu-clock -e cs -- ls hwb linuxPerformance counter stats for 'ls':
17.545541 task-clock # 0.634 CPUs utilized 0.000000 cpu-clock 0 cs # 0.000 M/sec 0.027684984 seconds time elapsed
Quoted 8 lines
Quoted 5 lines
This is fixed by
b79387ef("perf: Fixenable_on_execfor sibling events") in -next (20111222) but I can't see this queued anywhere for 3.2 (I thought I might see it in -rc7).Is this going in for the final cut, or will groups just be borked until 3.3?
Now that 3.2 is out with this regression, would it be possible to get this (
b79387ef("perf: Fixenable_on_execfor sibling events")) into -stable please?
How can this be a regression? Its always been like that. At worst its a broken new feature.
Also, you really shouldn't set enable_on_exec on non group leaders, that's just daft. But yes that patch sorts it. Something like the below should too.
--- tools/perf/builtin-stat.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
tools/perf/builtin-stat.c +1 -1
@@ -298,7 +298,7 @@ static int create_perf_stat_counter(struct perf_evsel *evsel, group, group_fd);if (target_pid ==-1 && target_tid ==-1 ) { attr->disabled =1 ; - attr->enable_on_exec =1 ; + attr->enable_on_exec = !group_fd; } return perf_evsel__open_per_thread(evsel, evsel_list->threads,
Will Deacon
Tested-byQuoted 4 lines · Peter Zijlstra
Quoted 3 lines · Will Deacon
Quoted 2 lines · Will Deacon
If I try using perf with event groups on a mainline kernel, only the group leader counts:
[...]
Quoted 5 lines
Quoted 2 lines
Now that 3.2 is out with this regression, would it be possible to get this (
b79387ef("perf: Fixenable_on_execfor sibling events")) into -stable please?How can this be a regression? Its always been like that. At worst its a broken new feature.
My mistake, for some reason I thought this had always had the new behaviour.
Quoted 16 lines
Also, you really shouldn't set
enable_on_execon non group leaders, that's just daft. But yes that patch sorts it. Something like the below should too.From a perf stat perspective, it should probably do the right thing then.
--- tools/perf/builtin-stat.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)tools/perf/builtin-stat.c +0
-0
tools/perf/builtin-stat.c static int create_perf_stat_counter(struct perf_evsel *evsel, · line 304
Quoted 8 lines
tools/perf/builtin-stat.c +1
-1@@ -298,7 +298,7 @@ static int create_perf_stat_counter(struct perf_evsel *evsel, group, group_fd);if (target_pid ==-1 && target_tid ==-1 ) { attr->disabled =1 ; - attr->enable_on_exec =1 ; + attr->enable_on_exec = !group_fd; } return perf_evsel__open_per_thread(evsel, evsel_list->threads,
Had to make a small change so that that the siblings don't get stuck as disabled:
tools/perf/builtin-stat.c +3 -4
@@ -296,10 +296,9 @@ static int create_perf_stat_counter(struct perf_evsel *evsel,if (system_wide)return perf_evsel__open_per_cpu (evsel, evsel_list->cpus, group, group_fd); -if (target_pid ==-1 && target_tid ==-1 ) { - attr->disabled =1 ; - attr->enable_on_exec =1 ; - } + +if (target_pid ==-1 && target_tid ==-1 ) + attr->disabled = attr->enable_on_exec = !group_fd;return perf_evsel__open_per_thread (evsel, evsel_list->threads, group, group_fd);
but that seems to do it - thanks!
It would be nice to see this in -stable, but as it's not a regression I'll leave it up to you.
Cheers,
Will