From: Michal Luczaj Date: Sat, 7 Jan 2023 00:12:53 +0000 (+0100) Subject: KVM: x86: Simplify msr_filter update X-Git-Tag: v6.6.17~5432^2~11^2~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4d85cfcaa82f0ceb5dcb7ad369a2cc7efb32c65c;p=platform%2Fkernel%2Flinux-rpi.git KVM: x86: Simplify msr_filter update Replace srcu_dereference()+rcu_assign_pointer() sequence with a single rcu_replace_pointer(). Suggested-by: Sean Christopherson Signed-off-by: Michal Luczaj Link: https://lore.kernel.org/r/20230107001256.2365304-4-mhal@rbox.co Signed-off-by: Sean Christopherson --- diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 4f8e78d..9c66cb3 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);