aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
authorYosry Ahmed <yosry@kernel.org>2026-05-27 23:47:01 +0000
committerSean Christopherson <seanjc@google.com>2026-05-27 18:45:49 -0700
commite48810e06f45251a56bc007485854112e6cfc430 (patch)
tree980e8600c660a9c7dfd10fbb2cb2a4227e546081 /arch
parent103cd7deda589c47f10cdf0f65cae21dbca35b9c (diff)
downloadlinux-next-history-e48810e06f45251a56bc007485854112e6cfc430.tar.gz
KVM: x86/pmu: Do a single atomic OR when reprogramming counters
Do a single atomic OR using the atomic overlay of reprogram_pmi bitmask, instead of one atomic set_bit() call per counter. Signed-off-by: Yosry Ahmed <yosry@kernel.org> Link: https://patch.msgid.link/20260527234711.4175166-8-yosry@kernel.org Signed-off-by: Sean Christopherson <seanjc@google.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/kvm/pmu.h5
1 files changed, 1 insertions, 4 deletions
diff --git a/arch/x86/kvm/pmu.h b/arch/x86/kvm/pmu.h
index f8286067722b0..0e99022168a85 100644
--- a/arch/x86/kvm/pmu.h
+++ b/arch/x86/kvm/pmu.h
@@ -213,13 +213,10 @@ static inline void kvm_pmu_request_counter_reprogram(struct kvm_pmc *pmc)
static inline void kvm_pmu_request_counters_reprogram(struct kvm_pmu *pmu,
u64 counters)
{
- int bit;
-
if (!counters)
return;
- for_each_set_bit(bit, (unsigned long *)&counters, X86_PMC_IDX_MAX)
- set_bit(bit, pmu->reprogram_pmi);
+ atomic64_or(counters, &pmu->__reprogram_pmi);
kvm_make_request(KVM_REQ_PMU, pmu_to_vcpu(pmu));
}