Re: [PATCH] KVM: use correct accessor function for __kvm_memslots

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 07/07/2017 15:50, Christian Borntraeger wrote:
> kvm memslots are protected by srcu and not by rcu. We must use
> srcu_dereference_check instead of rcu_dereference_check.
> 
> Signed-off-by: Christian Borntraeger <borntraeger@xxxxxxxxxx>
> Suggested-by: Paolo Bonzini <pbonzini@xxxxxxxxxx>
> ---
>  include/linux/kvm_host.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
> index b3ca77a..3561e41 100644
> --- a/include/linux/kvm_host.h
> +++ b/include/linux/kvm_host.h
> @@ -568,7 +568,7 @@ void kvm_put_kvm(struct kvm *kvm);
>  
>  static inline struct kvm_memslots *__kvm_memslots(struct kvm *kvm, int as_id)
>  {
> -	return rcu_dereference_check(kvm->memslots[as_id],
> +	return srcu_dereference_check(kvm->memslots[as_id], &kvm->srcu,
>  			srcu_read_lock_held(&kvm->srcu)
>  			|| lockdep_is_held(&kvm->slots_lock));

The condition can be simplified, since srcu_dereference_check is exactly
calling srcu_read_lock_held.

Paolo

>  }
> 



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux