linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH tip/core/rcu 0/2] spin_is_locked() conversions for v5.1
@ 2019-01-09 22:21 Paul E. McKenney
  2019-01-09 22:21 ` [PATCH tip/core/rcu 1/2] include/asm-generic: Remove spin_is_locked() comment Paul E. McKenney
  2019-01-09 22:21 ` [PATCH tip/core/rcu 2/2] virt/kvm: Replace spin_is_locked() with lockdep Paul E. McKenney
  0 siblings, 2 replies; 5+ messages in thread
From: Paul E. McKenney @ 2019-01-09 22:21 UTC (permalink / raw)
  To: linux-kernel
  Cc: mingo, jiangshanlai, dipankar, akpm, mathieu.desnoyers, josh,
	tglx, peterz, rostedt, dhowells, edumazet, fweisbec, oleg, joel

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(-)


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH tip/core/rcu 1/2] include/asm-generic: Remove spin_is_locked() comment
  2019-01-09 22:21 [PATCH tip/core/rcu 0/2] spin_is_locked() conversions for v5.1 Paul E. McKenney
@ 2019-01-09 22:21 ` Paul E. McKenney
  2019-01-09 22:21 ` [PATCH tip/core/rcu 2/2] virt/kvm: Replace spin_is_locked() with lockdep Paul E. McKenney
  1 sibling, 0 replies; 5+ messages in thread
From: Paul E. McKenney @ 2019-01-09 22:21 UTC (permalink / raw)
  To: linux-kernel
  Cc: mingo, jiangshanlai, dipankar, akpm, mathieu.desnoyers, josh,
	tglx, peterz, rostedt, dhowells, edumazet, fweisbec, oleg, joel,
	Paul E. McKenney, Arnd Bergmann, linux-arch

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.

Signed-off-by: Paul E. McKenney <paulmck@linux.ibm.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: <linux-arch@vger.kernel.org>
---
 include/asm-generic/bug.h | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h
index 20561a60db9c..0e9bd9c83870 100644
--- a/include/asm-generic/bug.h
+++ b/include/asm-generic/bug.h
@@ -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:
  *
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH tip/core/rcu 2/2] virt/kvm: Replace spin_is_locked() with lockdep
  2019-01-09 22:21 [PATCH tip/core/rcu 0/2] spin_is_locked() conversions for v5.1 Paul E. McKenney
  2019-01-09 22:21 ` [PATCH tip/core/rcu 1/2] include/asm-generic: Remove spin_is_locked() comment Paul E. McKenney
@ 2019-01-09 22:21 ` Paul E. McKenney
  2019-01-09 22:36   ` Paolo Bonzini
  1 sibling, 1 reply; 5+ messages in thread
From: Paul E. McKenney @ 2019-01-09 22:21 UTC (permalink / raw)
  To: linux-kernel
  Cc: mingo, jiangshanlai, dipankar, akpm, mathieu.desnoyers, josh,
	tglx, peterz, rostedt, dhowells, edumazet, fweisbec, oleg, joel,
	Paul E. McKenney, Paolo Bonzini, Radim Krčmář,
	kvm

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);
 	}
 }
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH tip/core/rcu 2/2] virt/kvm: Replace spin_is_locked() with lockdep
  2019-01-09 22:21 ` [PATCH tip/core/rcu 2/2] virt/kvm: Replace spin_is_locked() with lockdep Paul E. McKenney
@ 2019-01-09 22:36   ` Paolo Bonzini
  2019-01-10 18:52     ` Paul E. McKenney
  0 siblings, 1 reply; 5+ messages in thread
From: Paolo Bonzini @ 2019-01-09 22:36 UTC (permalink / raw)
  To: Paul E. McKenney, linux-kernel
  Cc: mingo, jiangshanlai, dipankar, akpm, mathieu.desnoyers, josh,
	tglx, peterz, rostedt, dhowells, edumazet, fweisbec, oleg, joel,
	Radim Krčmář,
	kvm

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>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH tip/core/rcu 2/2] virt/kvm: Replace spin_is_locked() with lockdep
  2019-01-09 22:36   ` Paolo Bonzini
@ 2019-01-10 18:52     ` Paul E. McKenney
  0 siblings, 0 replies; 5+ messages in thread
From: Paul E. McKenney @ 2019-01-10 18:52 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: linux-kernel, mingo, jiangshanlai, dipankar, akpm,
	mathieu.desnoyers, josh, tglx, peterz, rostedt, dhowells,
	edumazet, fweisbec, oleg, joel, Radim Krčmář,
	kvm

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-01-10 18:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-09 22:21 [PATCH tip/core/rcu 0/2] spin_is_locked() conversions for v5.1 Paul E. McKenney
2019-01-09 22:21 ` [PATCH tip/core/rcu 1/2] include/asm-generic: Remove spin_is_locked() comment Paul E. McKenney
2019-01-09 22:21 ` [PATCH tip/core/rcu 2/2] virt/kvm: Replace spin_is_locked() with lockdep Paul E. McKenney
2019-01-09 22:36   ` Paolo Bonzini
2019-01-10 18:52     ` Paul E. McKenney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).