aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Luczaj <[email protected]>2023-01-07 01:12:53 +0100
committerSean Christopherson <[email protected]>2023-02-03 15:30:32 -0800
commit4d85cfcaa82f0ceb5dcb7ad369a2cc7efb32c65c (patch)
treed353abb30029116ac030cd4d0dd364661a4d8bee
parent708f799d22fe6b69d2e6e3e0625c30666d5e798a (diff)
KVM: x86: Simplify msr_filter update
Replace srcu_dereference()+rcu_assign_pointer() sequence with a single rcu_replace_pointer(). Suggested-by: Sean Christopherson <[email protected]> Signed-off-by: Michal Luczaj <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Sean Christopherson <[email protected]>
-rw-r--r--arch/x86/kvm/x86.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 4f8e78d49585..9c66cb3657b4 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -6492,11 +6492,8 @@ static int kvm_vm_ioctl_set_msr_filter(struct kvm *kvm,
}
mutex_lock(&kvm->lock);
-
/* The per-VM filter is protected by kvm->lock... */
- old_filter = srcu_dereference_check(kvm->arch.msr_filter, &kvm->srcu, 1);
-
- rcu_assign_pointer(kvm->arch.msr_filter, new_filter);
+ old_filter = rcu_replace_pointer(kvm->arch.msr_filter, new_filter, 1);
mutex_unlock(&kvm->lock);
synchronize_srcu(&kvm->srcu);