@@ -185,11 +185,12 @@ static bool check_pmu_event_filter(struct kvm_pmc *pmc)
struct kvm *kvm = pmc->vcpu->kvm;
bool allow_event = true;
__u64 key;
- int idx;
+ int idx, srcu_idx;
if (kvm_x86_ops.pmu_ops->hw_event_is_unavail(pmc))
return false;
+ srcu_idx = srcu_read_lock(&kvm->srcu);
filter = srcu_dereference(kvm->arch.pmu_event_filter, &kvm->srcu);
if (!filter)
goto out;
@@ -212,6 +213,7 @@ static bool check_pmu_event_filter(struct kvm_pmc *pmc)
}
out:
+ srcu_read_unlock(&kvm->srcu, srcu_idx);
return allow_event;
}