linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Scott Wood <scottwood@freescale.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: peterz@infradead.org, linux-kernel@vger.kernel.org,
	Steven Rostedt <rostedt@goodmis.org>,
	linuxppc-dev@ozlabs.org, mingo@elte.hu, tglx@linutronix.de
Subject: Re: [PATCH] spinlock: __raw_spin_is_locked() should return true for UP
Date: Wed, 19 Aug 2009 13:50:10 -0500	[thread overview]
Message-ID: <20090819185010.GA12304@b07421-ec1.am.freescale.net> (raw)
In-Reply-To: <alpine.LFD.2.01.0908181640120.3158@localhost.localdomain>

On Tue, Aug 18, 2009 at 04:52:20PM -0700, Linus Torvalds wrote:
> 
> 
> On Tue, 18 Aug 2009, Steven Rostedt wrote:
> >
> > > The thing is, some people may assert that a lock is held, but others could 
> > > easily be looping until it's not held using something like
> > > 
> > > 	while (spin_is_locked(lock))
> > > 		cpu_relax();
> > 
> > Wouldn't something like that be really racey? And anyone doing such a 
> > thing had better have that code within an #ifdef CONFIG_SMP.
> 
> Sure, it's hopefully inside a #ifdef CONFIG_SMP.
> 
> And no, it's not necessarily racy. Sure, it's race in itself if that's all 
> you are doing, but I could imagine writing that kind of code if I knew 
> some lock was likely held, and I wanted to avoid doing a "try_lock()" 
> until it got released.

So you'd basically have the effect of a spin_lock(), except with the
bonus of breaking RT hacks that do something other than spin, and
preventing arch code from doing certain types of relaxation that are only
appropriate when waiting on a lock (such as mdors on powerpc, which
de-emphasizes until a reservation is broken).

Not exactly something we should encourage, IMHO.

-Scott

      parent reply	other threads:[~2009-08-19 18:50 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
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 [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=20090819185010.GA12304@b07421-ec1.am.freescale.net \
    --to=scottwood@freescale.com \
    --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).