virt/kvm: Replace spin_is_locked() with lockdep
authorPaul E. McKenney <paulmck@linux.ibm.com>
Tue, 8 Jan 2019 18:39:49 +0000 (10:39 -0800)
committerPaul E. McKenney <paulmck@linux.ibm.com>
Fri, 25 Jan 2019 23:36:05 +0000 (15:36 -0800)
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>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
virt/kvm/kvm_main.c

index 5ecea81..28de87f 100644 (file)
@@ -4083,7 +4083,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);
        }
 }