perf metricgroup: Don't early exit if no CPUID table exists

The failure to find a table of metrics with a CPUID shouldn't early
exit as the metric code will now also consider the default table.

When searching for a metric or metric group,
pmu_metrics_table__for_each_metric() considers all tables and so the
caller doesn't need to switch the table to do this.

Fixes: c7adeb0974 ("perf jevents: Add set of common metrics based on default ones")
Reviewed-by: Leo Yan <leo.yan@arm.com>
Signed-off-by: Ian Rogers <irogers@google.com>
Tested-by: Leo Yan <leo.yan@arm.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: James Clark <james.clark@linaro.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Ian Rogers 2026-02-05 10:36:03 -08:00 committed by Arnaldo Carvalho de Melo
parent f637bb2eed
commit cee275edcd
1 changed files with 5 additions and 13 deletions

View File

@ -1562,8 +1562,6 @@ int metricgroup__parse_groups(struct evlist *perf_evlist,
{
const struct pmu_metrics_table *table = pmu_metrics_table__find();
if (!table)
return -EINVAL;
if (hardware_aware_grouping)
pr_debug("Use hardware aware grouping instead of traditional metric grouping method\n");
@ -1601,22 +1599,16 @@ static int metricgroup__has_metric_or_groups_callback(const struct pmu_metric *p
bool metricgroup__has_metric_or_groups(const char *pmu, const char *metric_or_groups)
{
const struct pmu_metrics_table *tables[2] = {
pmu_metrics_table__find(),
pmu_metrics_table__default(),
};
const struct pmu_metrics_table *table = pmu_metrics_table__find();
struct metricgroup__has_metric_data data = {
.pmu = pmu,
.metric_or_groups = metric_or_groups,
};
for (size_t i = 0; i < ARRAY_SIZE(tables); i++) {
if (pmu_metrics_table__for_each_metric(tables[i],
metricgroup__has_metric_or_groups_callback,
&data))
return true;
}
return false;
return pmu_metrics_table__for_each_metric(table,
metricgroup__has_metric_or_groups_callback,
&data)
? true : false;
}
static int metricgroup__topdown_max_level_callback(const struct pmu_metric *pm,