perf pmu: Only warn about unsupported formats once

Avoid scanning format list for each event parsed.

Signed-off-by: Ian Rogers <irogers@google.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: James Clark <james.clark@arm.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rob Herring <robh@kernel.org>
Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
Link: https://lore.kernel.org/r/20230601023644.587584-1-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Ian Rogers 2023-05-31 19:36:43 -07:00 committed by Arnaldo Carvalho de Melo
parent 27c9fcfc1e
commit 68c2504341
2 changed files with 10 additions and 0 deletions

View File

@ -934,6 +934,11 @@ void perf_pmu__warn_invalid_formats(struct perf_pmu *pmu)
{
struct perf_pmu_format *format;
if (pmu->formats_checked)
return;
pmu->formats_checked = true;
/* fake pmu doesn't have format list */
if (pmu == &perf_pmu__fake)
return;

View File

@ -76,6 +76,11 @@ struct perf_pmu {
* specific code.
*/
bool auxtrace;
/**
* @formats_checked: Only check PMU's formats are valid for
* perf_event_attr once.
*/
bool formats_checked;
/**
* @max_precise: Number of levels of :ppp precision supported by the
* PMU, read from