All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@linux.ibm.com>
To: Will Deacon <will.deacon@arm.com>
Cc: Lance Roy <ldr709@gmail.com>,
	linux-kernel@vger.kernel.org,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>
Subject: Re: [PATCH 12/16] locking/mutex: Replace spin_is_locked() with lockdep
Date: Tue, 9 Oct 2018 06:36:50 -0700	[thread overview]
Message-ID: <20181009133650.GO2674@linux.ibm.com> (raw)
In-Reply-To: <20181009121809.GG6248@arm.com>

On Tue, Oct 09, 2018 at 01:18:10PM +0100, Will Deacon wrote:
> On Tue, Oct 02, 2018 at 10:38:58PM -0700, Lance Roy wrote:
> > lockdep_assert_held() is better suited to checking locking requirements,
> > since it won't get confused when someone else holds the lock. This is
> > also a step towards possibly removing spin_is_locked().
> > 
> > Signed-off-by: Lance Roy <ldr709@gmail.com>
> > Cc: Peter Zijlstra <peterz@infradead.org>
> > Cc: Ingo Molnar <mingo@redhat.com>
> > Cc: Will Deacon <will.deacon@arm.com>
> > ---
> >  kernel/locking/mutex-debug.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/kernel/locking/mutex-debug.c b/kernel/locking/mutex-debug.c
> > index 9aa713629387..771d4ca96dda 100644
> > --- a/kernel/locking/mutex-debug.c
> > +++ b/kernel/locking/mutex-debug.c
> > @@ -36,7 +36,7 @@ void debug_mutex_lock_common(struct mutex *lock, struct mutex_waiter *waiter)
> >  
> >  void debug_mutex_wake_waiter(struct mutex *lock, struct mutex_waiter *waiter)
> >  {
> > -	SMP_DEBUG_LOCKS_WARN_ON(!spin_is_locked(&lock->wait_lock));
> > +	lockdep_assert_held(&lock->wait_lock);
> >  	DEBUG_LOCKS_WARN_ON(list_empty(&lock->wait_list));
> >  	DEBUG_LOCKS_WARN_ON(waiter->magic != waiter);
> >  	DEBUG_LOCKS_WARN_ON(list_empty(&waiter->list));
> > @@ -51,7 +51,7 @@ void debug_mutex_free_waiter(struct mutex_waiter *waiter)
> >  void debug_mutex_add_waiter(struct mutex *lock, struct mutex_waiter *waiter,
> >  			    struct task_struct *task)
> >  {
> > -	SMP_DEBUG_LOCKS_WARN_ON(!spin_is_locked(&lock->wait_lock));
> > +	lockdep_assert_held(&lock->wait_lock);
> 
> I think it's a good idea to replace debug usage of spin_is_locked() with
> calls to lockdep, but I wonder whether that means that DEBUG_MUTEXES should
> select LOCKDEP so that we don't lose coverage?
> 
> What do you think?

Makes sense to me!

But given that this was accepted into -tip, I have dropped it from my tree.

							Thanx, Paul


  reply	other threads:[~2018-10-09 13:40 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-03  5:38 Using lockdep instead of spin_is_locked() Lance Roy
2018-10-03  5:38 ` [PATCH 01/16] x86/PCI: Replace spin_is_locked() with lockdep Lance Roy
2018-10-03 16:00   ` Bjorn Helgaas
2018-10-04  6:50     ` Lance Roy
2018-10-03  5:38 ` [PATCH 02/16] hv_balloon: " Lance Roy
2018-10-03 13:20   ` Vitaly Kuznetsov
2018-10-03  5:38 ` [PATCH 03/16] sgi-xp: " Lance Roy
2018-10-03  5:38 ` [Intel-wired-lan] [PATCH 04/16] i40e: " Lance Roy
2018-10-03  5:38   ` Lance Roy
2018-10-04 18:24   ` [Intel-wired-lan] " Bowers, AndrewX
2018-10-04 18:56   ` Bowers, AndrewX
2018-10-03  5:38 ` [Intel-wired-lan] [PATCH 05/16] igbvf: " Lance Roy
2018-10-03  5:38   ` Lance Roy
2018-10-13  0:11   ` [Intel-wired-lan] " Brown, Aaron F
2018-10-13  0:11     ` Brown, Aaron F
2018-10-03  5:38 ` [PATCH 06/16] sfc: " Lance Roy
2018-10-03  5:38 ` [PATCH 07/16] smsc: " Lance Roy
2018-10-03  5:38 ` [PATCH 08/16] wireless: " Lance Roy
2018-10-03  9:06   ` Kalle Valo
2018-10-04  6:57     ` Lance Roy
2018-10-04 10:05       ` Kalle Valo
2018-10-05  8:35   ` [PATCH 08/16] zd1211rw: " Kalle Valo
2018-10-03  5:38 ` [PATCH 09/16] scsi: " Lance Roy
2018-10-03 13:53   ` Bart Van Assche
2018-10-11  2:37   ` Martin K. Petersen
2018-10-03  5:38 ` [PATCH 10/16] userfaultfd: " Lance Roy
2018-10-03  5:38 ` [PATCH 11/16] futex: " Lance Roy
2018-10-09 11:21   ` [tip:locking/core] " tip-bot for Lance Roy
2018-10-03  5:38 ` [PATCH 12/16] locking/mutex: " Lance Roy
2018-10-09 12:18   ` Will Deacon
2018-10-09 13:36     ` Paul E. McKenney [this message]
2018-10-03  5:38 ` [PATCH 13/16] mm: " Lance Roy
2018-10-03  7:37   ` Vlastimil Babka
2018-10-03  5:39 ` [PATCH 14/16] netfilter: " Lance Roy
2018-10-03  8:29   ` Jozsef Kadlecsik
2018-10-03  5:39 ` [PATCH 15/16] apparmor: " Lance Roy
2018-10-03  5:56   ` John Johansen
2018-10-03  5:39 ` [PATCH 16/16] KVM: arm/arm64: vgic: " Lance Roy
2018-10-03  5:39   ` Lance Roy
2018-11-02 18:45   ` Christoffer Dall
2018-11-02 18:45     ` Christoffer Dall
2018-11-02 19:42     ` Paul E. McKenney
2018-11-02 19:42       ` Paul E. McKenney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181009133650.GO2674@linux.ibm.com \
    --to=paulmck@linux.ibm.com \
    --cc=ldr709@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=will.deacon@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.