[tip: perf/core] KVM: VMX: Drop a redundant pmu->global_ctrl check when processing pebs_enable
From: tip-bot2 for Sean Christopherson
Date: Fri Sep 25 2026 - 06:51:49 EST
The following commit has been merged into the perf/core branch of tip:
Commit-ID: 57c76478333012159b5cbec89527f925011cdefd
Gitweb: https://git.kernel.org/tip/57c76478333012159b5cbec89527f925011cdefd
Author: Sean Christopherson <seanjc@xxxxxxxxxx>
AuthorDate: Mon, 21 Sep 2026 12:14:16 -07:00
Committer: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
CommitterDate: Fri, 25 Sep 2026 12:45:53 +02:00
KVM: VMX: Drop a redundant pmu->global_ctrl check when processing pebs_enable
Drop a redundant check that a PMC is globally enabled when looking for
PEBS counters that are cross-mapped between the guest and the host. The
for-loop explicitly iterates over pmu->global_ctrl, and since PEBS requires
PMU v2+, kvm_pmu_has_perf_global_ctrl() must be true, and thus
pmc_is_globally_enabled() is simply checking that the bit is set in
pmu->global_ctrl.
No functional change intended.
Signed-off-by: Sean Christopherson <seanjc@xxxxxxxxxx>
Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
Reviewed-by: Dapeng Mi <dapeng1.mi@xxxxxxxxxxxxxxx>
Link: https://patch.msgid.link/20260921191418.950933-9-seanjc@xxxxxxxxxx
---
arch/x86/kvm/vmx/pmu_intel.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/arch/x86/kvm/vmx/pmu_intel.c b/arch/x86/kvm/vmx/pmu_intel.c
index a21e146..040b8e8 100644
--- a/arch/x86/kvm/vmx/pmu_intel.c
+++ b/arch/x86/kvm/vmx/pmu_intel.c
@@ -763,8 +763,7 @@ u64 intel_pmu_get_cross_mapped_mask(struct kvm_pmu *pmu)
host_cross_mapped_mask = 0;
kvm_for_each_pmc(pmu, pmc, bit, (unsigned long *)&pmu->global_ctrl) {
- if (!pmc_is_locally_enabled(pmc) ||
- !pmc_is_globally_enabled(pmc) || !pmc->perf_event)
+ if (!pmc_is_locally_enabled(pmc) || !pmc->perf_event)
continue;
/*