Currently, __intel_pmu_enable_all() also re-enables LBR in addition to the PMU. Split out the PMU-only path into a new helper, ___intel_pmu_enable_all(), so the PMU can be enabled independently. This helper will be used by a subsequent patch. Also remove the unused added argument from __intel_pmu_enable_all(). No functional change intended. Fixes: c22ac2a3d4bd ("perf: Enable branch record for software events") Signed-off-by: Dapeng Mi --- arch/x86/events/intel/core.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c index 0ed0269189ba..5b44a4224d2c 100644 --- a/arch/x86/events/intel/core.c +++ b/arch/x86/events/intel/core.c @@ -2783,13 +2783,11 @@ static __always_inline void intel_pmu_disable_all(void) intel_pmu_lbr_disable_all(); } -static void __intel_pmu_enable_all(int added, bool pmi) +static void ___intel_pmu_enable_all(void) { struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events); u64 intel_ctrl = hybrid(cpuc->pmu, intel_ctrl); - intel_pmu_lbr_enable_all(pmi); - if (cpuc->fixed_ctrl_val != cpuc->active_fixed_ctrl_val) { wrmsrq(MSR_ARCH_PERFMON_FIXED_CTR_CTRL, cpuc->fixed_ctrl_val); cpuc->active_fixed_ctrl_val = cpuc->fixed_ctrl_val; @@ -2809,10 +2807,16 @@ static void __intel_pmu_enable_all(int added, bool pmi) } } +static void __intel_pmu_enable_all(bool pmi) +{ + intel_pmu_lbr_enable_all(pmi); + ___intel_pmu_enable_all(); +} + static void intel_pmu_enable_all(int added) { static_call_cond(x86_pmu_pebs_enable_all)(); - __intel_pmu_enable_all(added, false); + __intel_pmu_enable_all(false); } static noinline int @@ -4056,7 +4060,7 @@ static int intel_pmu_handle_irq(struct pt_regs *regs) /* Only restore PMU state when it's active. See x86_pmu_disable(). */ cpuc->enabled = pmu_enabled; if (pmu_enabled) - __intel_pmu_enable_all(0, true); + __intel_pmu_enable_all(true); intel_bts_enable_local(); /* -- 2.34.1