Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

perf stat: Exit perf stat if parse groups fails

Metrics were added by a callback but commit a4b8cfcabb1d90ec ("perf
stat: Delay metric parsing") postponed this to allow optimizations based
on the CPU configuration.

In doing so it stopped errors in metric parsing from causing 'perf stat'
termination.

This change adds the termination for bad metric names back in.

Fixes: a4b8cfcabb1d90ec ("perf stat: Delay metric parsing")
Reported-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Ian Rogers <irogers@google.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Closes: https://lore.kernel.org/lkml/ZXByT1K6enTh2EHT@kernel.org/
Link: https://lore.kernel.org/r/20231206183533.972028-1-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Ian Rogers and committed by
Arnaldo Carvalho de Melo
0713ab3b 01261d8a

+11 -7
+11 -7
tools/perf/builtin-stat.c
··· 2695 2695 */ 2696 2696 if (metrics) { 2697 2697 const char *pmu = parse_events_option_args.pmu_filter ?: "all"; 2698 + int ret = metricgroup__parse_groups(evsel_list, pmu, metrics, 2699 + stat_config.metric_no_group, 2700 + stat_config.metric_no_merge, 2701 + stat_config.metric_no_threshold, 2702 + stat_config.user_requested_cpu_list, 2703 + stat_config.system_wide, 2704 + &stat_config.metric_events); 2698 2705 2699 - metricgroup__parse_groups(evsel_list, pmu, metrics, 2700 - stat_config.metric_no_group, 2701 - stat_config.metric_no_merge, 2702 - stat_config.metric_no_threshold, 2703 - stat_config.user_requested_cpu_list, 2704 - stat_config.system_wide, 2705 - &stat_config.metric_events); 2706 2706 zfree(&metrics); 2707 + if (ret) { 2708 + status = ret; 2709 + goto out; 2710 + } 2707 2711 } 2708 2712 2709 2713 if (add_default_attributes())