[PATCH v1 2/7] perf intel-pt: Move PMU initialization from default config code

From: Ian Rogers
Date: Fri Oct 06 2023 - 22:13:57 EST


Avoid setting PMU values in intel_pt_pmu_default_config, move to
perf_pmu__arch_init.

Signed-off-by: Ian Rogers <irogers@xxxxxxxxxx>
---
tools/perf/arch/x86/util/intel-pt.c | 2 --
tools/perf/arch/x86/util/pmu.c | 1 +
2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/tools/perf/arch/x86/util/intel-pt.c b/tools/perf/arch/x86/util/intel-pt.c
index b923bca939d9..6d6cd8f9133c 100644
--- a/tools/perf/arch/x86/util/intel-pt.c
+++ b/tools/perf/arch/x86/util/intel-pt.c
@@ -267,8 +267,6 @@ intel_pt_pmu_default_config(struct perf_pmu *intel_pt_pmu)

attr->config = intel_pt_default_config(intel_pt_pmu);

- intel_pt_pmu->selectable = true;
-
return attr;
}

diff --git a/tools/perf/arch/x86/util/pmu.c b/tools/perf/arch/x86/util/pmu.c
index 811e2377d2d5..949b3e2c67bd 100644
--- a/tools/perf/arch/x86/util/pmu.c
+++ b/tools/perf/arch/x86/util/pmu.c
@@ -22,6 +22,7 @@ void perf_pmu__arch_init(struct perf_pmu *pmu __maybe_unused)
#ifdef HAVE_AUXTRACE_SUPPORT
if (!strcmp(pmu->name, INTEL_PT_PMU_NAME)) {
pmu->auxtrace = true;
+ pmu->selectable = true;
pmu->default_config = intel_pt_pmu_default_config(pmu);
}
if (!strcmp(pmu->name, INTEL_BTS_PMU_NAME)) {
--
2.42.0.609.gbb76f46606-goog