[tip/core/rcu,2/2] virt/kvm: Replace spin_is_locked() with lockdep
diff mbox series

Message ID 20190109222144.14270-2-paulmck@linux.ibm.com
State New
Headers show
Series
  • Untitled series #64283
Related show

Commit Message

Paul E. McKenney Jan. 9, 2019, 10:21 p.m. UTC
lockdep_assert_held() is better suited to checking locking requirements,
since it only checks if the current thread holds the lock regardless of
whether someone else does. This is also a step towards possibly removing
spin_is_locked().

Signed-off-by: Paul E. McKenney <paulmck@linux.ibm.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: "Radim Krčmář" <rkrcmar@redhat.com>
Cc: <kvm@vger.kernel.org>
---
 virt/kvm/kvm_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Paolo Bonzini Jan. 9, 2019, 10:36 p.m. UTC | #1
On 09/01/19 23:21, Paul E. McKenney wrote:
> lockdep_assert_held() is better suited to checking locking requirements,
> since it only checks if the current thread holds the lock regardless of
> whether someone else does. This is also a step towards possibly removing
> spin_is_locked().
> 
> Signed-off-by: Paul E. McKenney <paulmck@linux.ibm.com>
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Cc: "Radim Krčmář" <rkrcmar@redhat.com>
> Cc: <kvm@vger.kernel.org>
> ---
>  virt/kvm/kvm_main.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
> index 1f888a103f78..ec758bb7eeba 100644
> --- a/virt/kvm/kvm_main.c
> +++ b/virt/kvm/kvm_main.c
> @@ -4078,7 +4078,7 @@ static int kvm_suspend(void)
>  static void kvm_resume(void)
>  {
>  	if (kvm_usage_count) {
> -		WARN_ON(raw_spin_is_locked(&kvm_count_lock));
> +		lockdep_assert_held(&kvm_count_lock);
>  		hardware_enable_nolock(NULL);
>  	}
>  }
> 

Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Paul E. McKenney Jan. 10, 2019, 6:52 p.m. UTC | #2
On Wed, Jan 09, 2019 at 11:36:23PM +0100, Paolo Bonzini wrote:
> On 09/01/19 23:21, Paul E. McKenney wrote:
> > lockdep_assert_held() is better suited to checking locking requirements,
> > since it only checks if the current thread holds the lock regardless of
> > whether someone else does. This is also a step towards possibly removing
> > spin_is_locked().
> > 
> > Signed-off-by: Paul E. McKenney <paulmck@linux.ibm.com>
> > Cc: Paolo Bonzini <pbonzini@redhat.com>
> > Cc: "Radim Krčmář" <rkrcmar@redhat.com>
> > Cc: <kvm@vger.kernel.org>
> > ---
> >  virt/kvm/kvm_main.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
> > index 1f888a103f78..ec758bb7eeba 100644
> > --- a/virt/kvm/kvm_main.c
> > +++ b/virt/kvm/kvm_main.c
> > @@ -4078,7 +4078,7 @@ static int kvm_suspend(void)
> >  static void kvm_resume(void)
> >  {
> >  	if (kvm_usage_count) {
> > -		WARN_ON(raw_spin_is_locked(&kvm_count_lock));
> > +		lockdep_assert_held(&kvm_count_lock);
> >  		hardware_enable_nolock(NULL);
> >  	}
> >  }
> 
> Acked-by: Paolo Bonzini <pbonzini@redhat.com>

Applied, thank you!

							Thanx, Paul

Patch
diff mbox series

diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 1f888a103f78..ec758bb7eeba 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -4078,7 +4078,7 @@  static int kvm_suspend(void)
 static void kvm_resume(void)
 {
 	if (kvm_usage_count) {
-		WARN_ON(raw_spin_is_locked(&kvm_count_lock));
+		lockdep_assert_held(&kvm_count_lock);
 		hardware_enable_nolock(NULL);
 	}
 }