diff options
author | Sean Christopherson <seanjc@google.com> | 2023-11-10 05:28:51 +0300 |
---|---|---|
committer | Sean Christopherson <seanjc@google.com> | 2024-02-01 20:35:48 +0300 |
commit | 004a0aa56edea3effc97bc90a620da1bcde5c63c (patch) | |
tree | 379a33ec1a69534c15209580c9debb48457ab0fd /lib/memory-notifier-error-inject.c | |
parent | b31880ca2f41dc2196e31d97e498b0fa884c2b2a (diff) | |
download | linux-004a0aa56edea3effc97bc90a620da1bcde5c63c.tar.xz |
KVM: x86/pmu: Snapshot and clear reprogramming bitmap before reprogramming
Refactor the handling of the reprogramming bitmap to snapshot and clear
to-be-processed bits before doing the reprogramming, and then explicitly
set bits for PMCs that need to be reprogrammed (again). This will allow
adding a macro to iterate over all valid PMCs without having to add
special handling for the reprogramming bit, which (a) can have bits set
for non-existent PMCs and (b) needs to clear such bits to avoid wasting
cycles in perpetuity.
Note, the existing behavior of clearing bits after reprogramming does NOT
have a race with kvm_vm_ioctl_set_pmu_event_filter(). Setting a new PMU
filter synchronizes SRCU _before_ setting the bitmap, i.e. guarantees that
the vCPU isn't in the middle of reprogramming with a stale filter prior to
setting the bitmap.
Link: https://lore.kernel.org/r/20231110022857.1273836-5-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
Diffstat (limited to 'lib/memory-notifier-error-inject.c')
0 files changed, 0 insertions, 0 deletions