spin_is_locked() conversions for v5.1
Subsystems (2)
cover spin_is_locked() conversions for v5.1
Hello!
This series further de-emphasizes use spin_is_locked()-based warnings in favor of lockdep_assert_held().
1. Remove spin_is_locked() comment from include/asm-generic.
2. Replace spin_is_locked() with lockdep in virt/kvm.
Thanx, Paul
------------------------------------------------------------------------
include/asm-generic/bug.h | 3 --- virt/kvm/kvm_main.c | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-)
PATCH 1/2 include/asm-generic: Remove spin_is_locked() comment
The WARN_ON_SMP() comment header suggests using spin_is_locked() to check for locks being held. But these days we prefer lockdep_assert_held(), so this commit removes that suggestion.
--- include/asm-generic/bug.h | 3 --- 1 file changed, 3 deletions(-)
include/asm-generic/bug.h +0 -3
@@ -211,9 +211,6 @@ void __warn(const char *file, int line, void *caller, unsigned taint,/* * WARN_ON_SMP() is for cases that the warning is either * meaningless for !SMP or may even cause failures. -* This is usually used for cases that we have -* WARN_ON(!spin_is_locked(&lock)) checks, as spin_is_locked() -* returns 0 for uniprocessor settings. * It can also be used with values that are only defined * on SMP: *
Signature · 1 line
2.17.1
PATCH 2/2 virt/kvm: Replace spin_is_locked() with lockdep
In reply to Paul E. McKenneylockdep_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().
--- virt/kvm/kvm_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
virt/kvm/kvm_main.c +1 -1
@@ -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 ); } }
Signature · 1 line
2.17.1
Re: [PATCH tip/core/rcu 2/2] virt/kvm: Replace spin_is_locked() with lockdep
Quoted 19 lines · Paul E. McKenney
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 removingspin_is_locked().Signed-off-by Paul E. McKenney <[email protected]>Cc Paolo Bonzini <[email protected]>Cc "Radim Krčmář" <[email protected]>Cc <[email protected]>--- virt/kvm/kvm_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)virt/kvm/kvm_main.c +0
-0
virt/kvm/kvm_main.c static int kvm_suspend(void) · line 4084
Quoted 8 lines
virt/kvm/kvm_main.c +1
-1@@ -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 ); } }
Paul E. McKenney
AppliedRe: [PATCH tip/core/rcu 2/2] virt/kvm: Replace spin_is_locked() with lockdep
Quoted 14 lines · Paolo Bonzini
Quoted 13 lines · Paul E. McKenney
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 removingspin_is_locked().Signed-off-by Paul E. McKenney <[email protected]>Cc Paolo Bonzini <[email protected]>Cc "Radim Krčmář" <[email protected]>Cc <[email protected]>--- virt/kvm/kvm_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 15 lines
virt/kvm/kvm_main.c static int kvm_suspend(void) · line 4084
Quoted 13 lines
virt/kvm/kvm_main.c +1
-1@@ -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 <[email protected]>
Applied, thank you!
Thanx, Paul