[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130828085957.728a5375@gandalf.local.home>
Date: Wed, 28 Aug 2013 08:59:57 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: Peter Zijlstra <peterz@...radead.org>
Cc: "Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
Alexander Fyodorov <halcy@...dex.ru>,
Waiman Long <waiman.long@...com>,
linux-kernel <linux-kernel@...r.kernel.org>,
"Chandramouleeswaran, Aswin" <aswin@...com>,
"Norton, Scott J" <scott.norton@...com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>
Subject: Re: [PATCH RFC v2 1/2] qspinlock: Introducing a 4-byte queue
spinlock implementation
On Wed, 28 Aug 2013 10:19:37 +0200
Peter Zijlstra <peterz@...radead.org> wrote:
> > An unlock followed by a lock needs to act like a full barrier, but there
> > is no requirement that a lock or unlock taken separately act like a
> > full barrier.
>
> But that is already a property of the acquisition/release barrier.
As I mentioned in my fixes for the -rt swait barrier patches I sent.
Spin locks only prevent leaks out of the critical section. It does not
guarantee leaks into the critical section, thus:
A = 1
spin_lock()
spin_unlock()
B = C
Can turn into:
(A = 1)
spin_lock()
load C
store 1 into A
spin_unlock()
B = C
This shows that a spin_lock()/unlock() combo is not equivalent to a
mb(). But as Paul has mentioned, if we had:
A = 1
spin_unlock()
spin_lock()
B = C
That would be equivalent to
A = 1
mb()
B = C
as the unlock prevents leaks going past it, and lock prevents leaks
going before it.
-- Steve
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists