All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 1/2] perf stat: Clear reset_group for each stat run
@ 2022-08-22 21:33 Ian Rogers
  2022-08-22 21:33 ` [PATCH v1 2/2] perf test: Stat test for repeat with a weak group Ian Rogers
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Ian Rogers @ 2022-08-22 21:33 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
	Ian Rogers, Kan Liang, Andi Kleen, linux-perf-users, linux-kernel
  Cc: Stephane Eranian

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: 4804e0111662 ("perf stat: Use affinity for opening events")
Signed-off-by: Ian Rogers <irogers@google.com>
---
 tools/perf/builtin-stat.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 7fb81a44672d..54cd29d07ca8 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -826,6 +826,7 @@ static int __run_perf_stat(int argc, const char **argv, int run_idx)
 	}
 
 	evlist__for_each_entry(evsel_list, counter) {
+		counter->reset_group = false;
 		if (bpf_counter__load(counter, &target))
 			return -1;
 		if (!evsel__is_bpf(counter))
-- 
2.37.2.609.g9ff673ca1a-goog


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-08-23 19:42 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-22 21:33 [PATCH v1 1/2] perf stat: Clear reset_group for each stat run Ian Rogers
2022-08-22 21:33 ` [PATCH v1 2/2] perf test: Stat test for repeat with a weak group Ian Rogers
2022-08-23  7:57 ` [PATCH v1 1/2] perf stat: Clear reset_group for each stat run Xing Zhengjun
2022-08-23 13:34 ` Arnaldo Carvalho de Melo
2022-08-23 16:33   ` Ian Rogers
2022-08-23 15:10 ` Andi Kleen
2022-08-23 18:42   ` Arnaldo Carvalho de Melo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.