Skip to content

Commit bf515f0

Browse files
captain5050acmel
authored andcommitted
perf stat: Clear evsel->reset_group for each stat run
If a weak group is broken then the reset_group flag remains set for the next run. Having reset_group set means the counter isn't created and ultimately a segfault. A simple reproduction of this is: # perf stat -r2 -e '{cycles,cycles,cycles,cycles,cycles,cycles,cycles,cycles,cycles,cycles}:W which will be added as a test in the next patch. Fixes: 4804e01 ("perf stat: Use affinity for opening events") Reviewed-by: Andi Kleen <[email protected]> Signed-off-by: Ian Rogers <[email protected]> Tested-by: Arnaldo Carvalho de Melo <[email protected]> Tested-by: Xing Zhengjun <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Andi Kleen <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Kan Liang <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Stephane Eranian <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent dbcfe5e commit bf515f0

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

tools/perf/builtin-stat.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -826,6 +826,7 @@ static int __run_perf_stat(int argc, const char **argv, int run_idx)
826826
}
827827

828828
evlist__for_each_entry(evsel_list, counter) {
829+
counter->reset_group = false;
829830
if (bpf_counter__load(counter, &target))
830831
return -1;
831832
if (!evsel__is_bpf(counter))

0 commit comments

Comments
 (0)