Re: [RFC PATCH v2] memory-barriers: remove smp_mb__after_unlock_lock()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jul 13, 2015 at 01:16:42PM -0700, Paul E. McKenney wrote:
> On Mon, Jul 13, 2015 at 03:41:53PM -0400, Peter Hurley wrote:
> > > Does that answer the question, or am I missing the point?
> > 
> > Yes, it shows that smp_mb__after_unlock_lock() has no purpose, since it
> > is defined only for PowerPC and your test above just showed that for
> > the sequence

The only purpose is to provide transitivity, but the documentation fails
to explicitly call that out.

> > 
> >   store a
> >   UNLOCK M
> >   LOCK N
> >   store b
> > 
> > a and b is always observed as an ordered pair {a,b}.
> 
> Not quite.
> 
> This is instead the sequence that is of concern:
> 
> 	store a
> 	unlock M
> 	lock N
> 	load b

So its late and that table didn't parse, but that should be ordered too.
The load of b should not be able to escape the lock N.

If only because LWSYNC is a valid RMB and any LOCK implementation must
load the lock state to observe it unlocked.

> > Additionally, the assertion in Documentation/memory_barriers.txt that
> > the sequence above can be reordered as
> > 
> >   LOCK N
> >   store b
> >   store a
> >   UNLOCK M
> > 
> > is not true on any existing arch in Linux.
> 
> It was at one time and might be again.

What would be required to make this true? I'm having a hard time seeing
how things can get reordered like that.
--
To unsubscribe from this list: send the line "unsubscribe linux-arch" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel]     [Kernel Newbies]     [x86 Platform Driver]     [Netdev]     [Linux Wireless]     [Netfilter]     [Bugtraq]     [Linux Filesystems]     [Yosemite Discussion]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]

  Powered by Linux