lkml.org 
[lkml]   [2013]   [Aug]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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@infradead.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


\
 
 \ /
  Last update: 2013-08-28 15:21    [W:0.076 / U:0.760 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site