public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Theodore Ts'o" <tytso@mit.edu>
To: Matt Fleming <matt@console-pimps.org>
Cc: Guenter Roeck <linux@roeck-us.net>,
	Matt Fleming <matt.fleming@intel.com>,
	linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org,
	Peter Zijlstra <peterz@infradead.org>
Subject: Re: [PATCH] firmware: Do not use WARN_ON(!spin_is_locked())
Date: Wed, 13 Aug 2014 19:31:58 -0400	[thread overview]
Message-ID: <20140813233158.GB10808@thunk.org> (raw)
In-Reply-To: <20140813150201.GT15082@console-pimps.org>

On Wed, Aug 13, 2014 at 04:02:01PM +0100, Matt Fleming wrote:
> On Wed, 13 Aug, at 07:37:37AM, Guenter Roeck wrote:
> > 
> > WARN_ON and WARN_ON_SMP are unconditional. lockdep_assert_held()
> > is only active if lockdep debugging is enabled. Not knowing the code,
> > nor the reason why the unconditional method was chosen, I prefer
> > to refrain from functional changes and limit myself to bug fixes.
>  
> As the author of that code, I feel confident telling you that the
> unconditional method was used because the author is a boob. The code
> isn't so important that we need to unconditionally check the locks, and
> indeed it's possible to run into all sorts of problems when you don't
> use the standard lock-checking functions - the non-SMP crash being a
> good example.

If you want to actually force a BUG_ON if the spinlock is not taken,
even for non-debug kernels, you can use assert_spin_locked().  This
translates to a BUG_ON(!raw_spin_is_locked(x)) on SMP kernels, and a
no-op on UP kernels.

If you're confident in your testing that any problems would be
discovered before you push your patches to linus (and you actually use
lockdep in your testing :-), then lockdep_assert_held() doesn't add
any overhead if !lockdep, and so it might be a better choice for you.

							- Ted

  reply	other threads:[~2014-08-13 23:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-11  3:54 [PATCH] firmware: Do not use WARN_ON(!spin_is_locked()) Guenter Roeck
2014-08-13 14:18 ` Matt Fleming
2014-08-13 14:37   ` Guenter Roeck
2014-08-13 15:02     ` Matt Fleming
2014-08-13 23:31       ` Theodore Ts'o [this message]
2014-08-13 14:44   ` Peter Zijlstra

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=20140813233158.GB10808@thunk.org \
    --to=tytso@mit.edu \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=matt.fleming@intel.com \
    --cc=matt@console-pimps.org \
    --cc=peterz@infradead.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