From: Sean Christopherson Date: Tue, 5 Aug 2025 19:05:22 +0000 (-0700) Subject: KVM: x86/pmu: Drop redundant check on PMC being globally enabled for emulation X-Git-Tag: v6.18-rc1~55^2~6^2~36 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=58baa649ea09e7b719d0ef51aba894d63c2bb64f;p=thirdparty%2Fkernel%2Fstable.git KVM: x86/pmu: Drop redundant check on PMC being globally enabled for emulation When triggering PMC events in response to emulation, drop the redundant checks on a PMC being globally and locally enabled, as the passed in bitmap contains only PMCs that are locally enabled (and counting the right event), and the local copy of the bitmap has already been masked with global_ctrl. No true functional change intended. Reviewed-by: Dapeng Mi Link: https://lore.kernel.org/r/20250805190526.1453366-15-seanjc@google.com Signed-off-by: Sean Christopherson --- diff --git a/arch/x86/kvm/pmu.c b/arch/x86/kvm/pmu.c index fa34645596987..744717d379cb1 100644 --- a/arch/x86/kvm/pmu.c +++ b/arch/x86/kvm/pmu.c @@ -974,7 +974,7 @@ static void kvm_pmu_trigger_event(struct kvm_vcpu *vcpu, return; kvm_for_each_pmc(pmu, pmc, i, bitmap) { - if (!pmc_is_globally_enabled(pmc) || !pmc_is_locally_enabled(pmc) || + if (!pmc_is_locally_enabled(pmc) || !check_pmu_event_filter(pmc) || !cpl_is_matched(pmc)) continue;