All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
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
Subject: Re: [PATCH] firmware: Do not use WARN_ON(!spin_is_locked())
Date: Wed, 13 Aug 2014 16:44:58 +0200	[thread overview]
Message-ID: <20140813144458.GS9918@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <20140813141836.GQ15082@console-pimps.org>

[-- Attachment #1: Type: text/plain, Size: 598 bytes --]

On Wed, Aug 13, 2014 at 03:18:36PM +0100, Matt Fleming wrote:
> On Sun, 10 Aug, at 08:54:13PM, Guenter Roeck wrote:
> > spin_is_locked() always returns false for uniprocessor configurations,
> > so do not use WARN_ON with it. WARN_ON_SMP() exists for that very
> > purpose and must be used instead.
>  
> 
> How about lockdep_assert_held()? That seems to be much more popular.

lockdep_assert_held() not only checks if the lock is taken, it also
verifies its taken by the current context, so its a stronger assertion.

And, as a bonus, it doesn't emit _any_ code on a !DEBUG build ;-)

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Peter Zijlstra <peterz-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
To: Matt Fleming <matt-HNK1S37rvNbeXh+fF434Mdi2O/JbrIOy@public.gmane.org>
Cc: Guenter Roeck <linux-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>,
	Matt Fleming
	<matt.fleming-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH] firmware: Do not use WARN_ON(!spin_is_locked())
Date: Wed, 13 Aug 2014 16:44:58 +0200	[thread overview]
Message-ID: <20140813144458.GS9918@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <20140813141836.GQ15082-HNK1S37rvNbeXh+fF434Mdi2O/JbrIOy@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 598 bytes --]

On Wed, Aug 13, 2014 at 03:18:36PM +0100, Matt Fleming wrote:
> On Sun, 10 Aug, at 08:54:13PM, Guenter Roeck wrote:
> > spin_is_locked() always returns false for uniprocessor configurations,
> > so do not use WARN_ON with it. WARN_ON_SMP() exists for that very
> > purpose and must be used instead.
>  
> 
> How about lockdep_assert_held()? That seems to be much more popular.

lockdep_assert_held() not only checks if the lock is taken, it also
verifies its taken by the current context, so its a stronger assertion.

And, as a bonus, it doesn't emit _any_ code on a !DEBUG build ;-)

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

  parent reply	other threads:[~2014-08-13 14:45 UTC|newest]

Thread overview: 12+ 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-11  3:54 ` Guenter Roeck
2014-08-13 14:18 ` Matt Fleming
2014-08-13 14:18   ` Matt Fleming
2014-08-13 14:37   ` Guenter Roeck
2014-08-13 14:37     ` Guenter Roeck
2014-08-13 15:02     ` Matt Fleming
2014-08-13 15:02       ` Matt Fleming
2014-08-13 23:31       ` Theodore Ts'o
2014-08-13 23:31         ` Theodore Ts'o
2014-08-13 14:44   ` Peter Zijlstra [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=20140813144458.GS9918@twins.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --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 \
    /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.