]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
perf/x86/intel: Decouple BTS initialization from PEBS initialization
authorDapeng Mi <dapeng1.mi@linux.intel.com>
Tue, 15 Apr 2025 11:44:10 +0000 (11:44 +0000)
committerIngo Molnar <mingo@kernel.org>
Thu, 17 Apr 2025 12:21:24 +0000 (14:21 +0200)
Move x86_pmu.bts flag initialization into bts_init() from
intel_ds_init() and rename intel_ds_init() to intel_pebs_init() since it
fully initializes PEBS now after removing the x86_pmu.bts
initialization.

It's safe to move x86_pmu.bts into bts_init() since all x86_pmu.bts flag
are called after bts_init() execution.

Signed-off-by: Dapeng Mi <dapeng1.mi@linux.intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lkml.kernel.org/r/20250415114428.341182-5-dapeng1.mi@linux.intel.com
arch/x86/events/intel/bts.c
arch/x86/events/intel/core.c
arch/x86/events/intel/ds.c
arch/x86/events/perf_event.h

index 16bc89c8023b34e016135b923cc004301cabea98..9560f693fac07c633080cb02490ffd4a0c5c556b 100644 (file)
@@ -599,7 +599,11 @@ static void bts_event_read(struct perf_event *event)
 
 static __init int bts_init(void)
 {
-       if (!boot_cpu_has(X86_FEATURE_DTES64) || !x86_pmu.bts)
+       if (!boot_cpu_has(X86_FEATURE_DTES64))
+               return -ENODEV;
+
+       x86_pmu.bts = boot_cpu_has(X86_FEATURE_BTS);
+       if (!x86_pmu.bts)
                return -ENODEV;
 
        if (boot_cpu_has(X86_FEATURE_PTI)) {
index c7937b872348fb8ca57fa6cb6f187155d54fe007..16049ba63135350162d0442c006b5ee882e4191e 100644 (file)
@@ -6928,7 +6928,7 @@ __init int intel_pmu_init(void)
        if (boot_cpu_has(X86_FEATURE_ARCH_LBR))
                intel_pmu_arch_lbr_init();
 
-       intel_ds_init();
+       intel_pebs_init();
 
        x86_add_quirk(intel_arch_events_quirk); /* Install first, so it runs last */
 
index fcf9c5b26cab3c82ba3c534dbd7abc18a864ebd1..d894cf3f631e3673867b77ea587124b8408a725e 100644 (file)
@@ -2651,10 +2651,10 @@ static void intel_pmu_drain_pebs_icl(struct pt_regs *iregs, struct perf_sample_d
 }
 
 /*
- * BTS, PEBS probe and setup
+ * PEBS probe and setup
  */
 
-void __init intel_ds_init(void)
+void __init intel_pebs_init(void)
 {
        /*
         * No support for 32bit formats
@@ -2662,7 +2662,6 @@ void __init intel_ds_init(void)
        if (!boot_cpu_has(X86_FEATURE_DTES64))
                return;
 
-       x86_pmu.bts  = boot_cpu_has(X86_FEATURE_BTS);
        x86_pmu.pebs = boot_cpu_has(X86_FEATURE_PEBS);
        x86_pmu.pebs_buffer_size = PEBS_BUFFER_SIZE;
        if (x86_pmu.version <= 4)
index 46bbb503aca1f3ba835e98fd0243e1721da6e654..ac6743e392adc2e1decd09d96517a71297e8ee44 100644 (file)
@@ -1673,7 +1673,7 @@ void intel_pmu_drain_pebs_buffer(void);
 
 void intel_pmu_store_pebs_lbrs(struct lbr_entry *lbr);
 
-void intel_ds_init(void);
+void intel_pebs_init(void);
 
 void intel_pmu_lbr_save_brstack(struct perf_sample_data *data,
                                struct cpu_hw_events *cpuc,