linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Kumar Gala <galak@kernel.crashing.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: peterz@infradead.org, linux-kernel@vger.kernel.org,
	linuxppc-dev@ozlabs.org, mingo@elte.hu,
	Linus Torvalds <torvalds@linux-foundation.org>,
	tglx@linutronix.de
Subject: Re: [PATCH] spinlock: __raw_spin_is_locked() should return true for UP
Date: Tue, 18 Aug 2009 20:17:28 -0500	[thread overview]
Message-ID: <BB2762BC-C760-4D4C-BDCF-76EFD3E1B18D@kernel.crashing.org> (raw)
In-Reply-To: <alpine.DEB.2.00.0908182003430.18648@gandalf.stny.rr.com>


On Aug 18, 2009, at 7:07 PM, Steven Rostedt wrote:

> On Tue, 18 Aug 2009, Linus Torvalds wrote:
>>
>>> Thinking about it, UP probably should have spin_is_locked always  
>>> return
>>> false, but if you want to make sure you are not in a critical  
>>> section
>>> with the lock not held, then use assert_spin_locked, which on UP  
>>> should be
>>> a nop.
>>
>> That's what we do. That said, I also think we should generally try to
>> avoid the kind of code that depends on spin_is_locked always  
>> returning
>> false, for the same reason we should try to avoid any code that  
>> depends on
>> it always returning true.
>
> Perhaps we can deprecate spin_is_locked and replace it with
> "expect_spin_locked" and "expect_spin_unlocked" which on SMP would  
> return
> true and false respectively if the lock was locked. But both would  
> always
> return true on UP.
>
> Or do some thing similar, that would remove the ambiguity on UP.

I agree its a little too easy to abuse spin_is_locked.  However we  
should be consistent between spin_is_locked on UP between with and  
without CONFIG_DEBUG_SPINLOCK enabled.  How much of this do we want to  
try and address in .31?

The PPC test really should be using assert_spin_locked and I'll send a  
patch to Ben for that.

- k

  reply	other threads:[~2009-08-19  1:18 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-18 22:42 [PATCH] spinlock: __raw_spin_is_locked() should return true for UP Kumar Gala
2009-08-18 23:20 ` Linus Torvalds
2009-08-18 23:36   ` Steven Rostedt
2009-08-18 23:52     ` Linus Torvalds
2009-08-19  0:07       ` Steven Rostedt
2009-08-19  1:17         ` Kumar Gala [this message]
2009-08-19  2:40           ` Linus Torvalds
2009-08-19  9:31             ` Olivier Galibert
2009-08-19  9:38               ` Peter Zijlstra
2009-08-19 18:50       ` Scott Wood

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=BB2762BC-C760-4D4C-BDCF-76EFD3E1B18D@kernel.crashing.org \
    --to=galak@kernel.crashing.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --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).