linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@kernel.org>
To: Ryan Mallon <rmallon@gmail.com>
Cc: David Howells <dhowells@redhat.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	milosz@adfin.com,
	"linux-arch@vger.kernel.org" <linux-arch@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: Is spin_is_locked() safe to use with BUG_ON()/WARN_ON()?
Date: Tue, 28 May 2013 10:07:05 +0200	[thread overview]
Message-ID: <20130528080705.GB29371@gmail.com> (raw)
In-Reply-To: <519EC282.1010800@gmail.com>


* Ryan Mallon <rmallon@gmail.com> wrote:

> On 24/05/13 01:12, David Howells wrote:
> > Linus Torvalds <torvalds@linux-foundation.org> wrote:
> > 
> >> We do *not* want to add some crazy "spin_is_nt_locked". We just want
> >> to get rid of these idiotic debug tests.
> > 
> > Generally, I think you are right, though there are also some checks in
> > deallocation routines that check that a spinlock is not currently held before
> > releasing the memory holding it - should those be allowed to stay?  I'd be
> > tempted to wrap the whole check in something, perhaps an "spin_lock_uninit()"
> > and move the check to a header file.  Would this be useful for lockdep or
> > anything like that?
> 
> lockdep has lockdep_assert_held(), which might be what you want. Though 
> it looks like it possibly also has the false positive issues on SMP?

There should be no false positive race in the case that matters: if you 
are expecting to always hold the lock at that point, and want to make sure 
(if lock debugging is enabled), that it's truly held.

Thanks,

	Ingo

      reply	other threads:[~2013-05-28  8:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-23 14:50 Is spin_is_locked() safe to use with BUG_ON()/WARN_ON()? David Howells
2013-05-23 14:59 ` Linus Torvalds
2014-08-11  6:41   ` sanjeev sharma
2013-05-23 15:12 ` David Howells
2013-05-24  1:29   ` Ryan Mallon
2013-05-28  8:07     ` Ingo Molnar [this message]

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=20130528080705.GB29371@gmail.com \
    --to=mingo@kernel.org \
    --cc=dhowells@redhat.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=milosz@adfin.com \
    --cc=rmallon@gmail.com \
    --cc=torvalds@linux-foundation.org \
    /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 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).