perf pmu: Earlier PMU auxtrace initialization
authorIan Rogers <irogers@google.com>
Sun, 12 Mar 2023 02:15:35 +0000 (18:15 -0800)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 13 Mar 2023 18:12:19 +0000 (15:12 -0300)
This allows event parsing to use the evsel__is_aux_event function,
which is important when determining event grouping.

Suggested-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ian Rogers <irogers@google.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Florian Fischer <florian.fischer@muhq.space>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: James Clark <james.clark@arm.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: John Garry <john.g.garry@oracle.com>
Cc: Kajol Jain <kjain@linux.ibm.com>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Kim Phillips <kim.phillips@amd.com>
Cc: Leo Yan <leo.yan@linaro.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ravi Bangoria <ravi.bangoria@amd.com>
Cc: Sean Christopherson <seanjc@google.com>
Cc: Steinar H. Gunderson <sesse@google.com>
Cc: Stephane Eranian <eranian@google.com>
Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
Link: https://lore.kernel.org/r/20230312021543.3060328-2-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/arch/x86/util/auxtrace.c
tools/perf/arch/x86/util/pmu.c

index 3da506e13f49ddd002a0c6dc8dc4e6da9d61757a..330d03216b0e66c653ea9ee0ba5e5167ecb6824e 100644 (file)
@@ -26,11 +26,7 @@ struct auxtrace_record *auxtrace_record__init_intel(struct evlist *evlist,
        bool found_bts = false;
 
        intel_pt_pmu = perf_pmu__find(INTEL_PT_PMU_NAME);
-       if (intel_pt_pmu)
-               intel_pt_pmu->auxtrace = true;
        intel_bts_pmu = perf_pmu__find(INTEL_BTS_PMU_NAME);
-       if (intel_bts_pmu)
-               intel_bts_pmu->auxtrace = true;
 
        evlist__for_each_entry(evlist, evsel) {
                if (intel_pt_pmu && evsel->core.attr.type == intel_pt_pmu->type)
index 358340b34243177d3295b2219bc8797aab80896d..f73b80dcd8bdc15a841cd87bfbfe83278c9d96c6 100644 (file)
@@ -27,10 +27,14 @@ static bool cached_list;
 struct perf_event_attr *perf_pmu__get_default_config(struct perf_pmu *pmu __maybe_unused)
 {
 #ifdef HAVE_AUXTRACE_SUPPORT
-       if (!strcmp(pmu->name, INTEL_PT_PMU_NAME))
+       if (!strcmp(pmu->name, INTEL_PT_PMU_NAME)) {
+               pmu->auxtrace = true;
                return intel_pt_pmu_default_config(pmu);
-       if (!strcmp(pmu->name, INTEL_BTS_PMU_NAME))
+       }
+       if (!strcmp(pmu->name, INTEL_BTS_PMU_NAME)) {
+               pmu->auxtrace = true;
                pmu->selectable = true;
+       }
 #endif
        return NULL;
 }