All of lore.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Linus Torvalds <torvalds@osdl.org>,
	Oleg Nesterov <oleg@tv-sign.ru>,
	Thomas Gleixner <tglx@linutronix.de>,
	Andrew Morton <akpm@osdl.org>,
	linux-kernel@vger.kernel.org
Subject: Re: PATCH? hrtimer_wakeup: fix a theoretical race wrt rt_mutex_slowlock()
Date: Tue, 07 Nov 2006 08:41:05 +1100	[thread overview]
Message-ID: <1162849266.28571.352.camel@localhost.localdomain> (raw)
In-Reply-To: <Pine.LNX.4.58.0611061609340.22166@gandalf.stny.rr.com>

On Mon, 2006-11-06 at 16:17 -0500, Steven Rostedt wrote:
> On Tue, 7 Nov 2006, Benjamin Herrenschmidt wrote:
> 
> > On Mon, 2006-11-06 at 07:35 -0500, Steven Rostedt wrote:
> >
> > > It is relevant.  In powerpc, can one write happen before another write?
> > >
> > >
> > >   x = 1;
> > >   barrier();  (only compiler barrier)
> > >   b = 2;
> > >
> > >
> > > And have CPU 2 see b=2 before seeing x=1?
> >
> > Yes. Definitely.
> 
> OK, I see in powerpc, that spin lock calls isync. This just clears the
> pipeline. It doesn't touch the loads and stores, right?

Yes. That isync is to prevent loads to be speculated accross spin_lock,
thus leaking out of the lock by the top. In fact, it doesn't act on the
load per-se but it prevent speculative execution accross the conditional
branch in the spin_lock. 

> So basically saying this:
> 
>    x=1;
>    asm ("isync");
>    b=2;
> 
> Would that have the same problem too?  Where another CPU can see x=1
> before seeing b=2?

Yes.

What isync provides is

a = *foo
spin_lock_loop_with_conditional_branch
isync
b = *bar

It prevents the read of b from being speculated by the CPU ahead of a

Ben.




  reply	other threads:[~2006-11-06 21:41 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-05 19:34 PATCH? hrtimer_wakeup: fix a theoretical race wrt rt_mutex_slowlock() Oleg Nesterov
2006-11-05 22:29 ` Linus Torvalds
2006-11-05 22:53   ` Steven Rostedt
2006-11-05 23:08     ` Oleg Nesterov
2006-11-06  3:08     ` Linus Torvalds
2006-11-06 12:09       ` Oleg Nesterov
2006-11-06 12:26         ` Steven Rostedt
2006-11-05 22:53   ` Oleg Nesterov
2006-11-06  8:57   ` Benjamin Herrenschmidt
2006-11-06 12:35     ` Steven Rostedt
2006-11-06 20:53       ` Benjamin Herrenschmidt
2006-11-06 21:17         ` Steven Rostedt
2006-11-06 21:41           ` Benjamin Herrenschmidt [this message]
2006-11-06 12:31 ` Steven Rostedt
2006-11-06 14:15   ` Oleg Nesterov
2006-11-06 14:11     ` Steven Rostedt
2006-11-06 15:05       ` Steven Rostedt

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=1162849266.28571.352.camel@localhost.localdomain \
    --to=benh@kernel.crashing.org \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleg@tv-sign.ru \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@osdl.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.