lkml.org 
[lkml]   [2018]   [Jul]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3 2/3] locking: Clarify requirements for smp_mb__after_spinlock()
On Tue, Jul 03, 2018 at 08:39:10AM -0700, Paul E. McKenney wrote:

[...]

> > + * smp_mb__after_spinlock() provides the equivalent of a full memory barrier
> > + * between program-order earlier lock acquisitions and program-order later
>
> Not just the earlier lock acquisition, but also all program-order earlier
> memory accesses, correct?

I understand: "but also all program-order earlier memory accesses program-order
before that lock acquisition(s) ...". Yes, but:

- I considered this as implied by the above (L ->mb M2 and M1 ->po L implies
M1 ->mb M2, where M1, M2 are memory accesses and L is a lock acquisition);

- my prose abilities are limited ;-), and I was/am unable to come up with an
(to me) acceptable or readable enough way to make it explicit; some ideas?


> > + * WRITE_ONCE(X, 1); WRITE_ONCE(Y, 1);
> > + * spin_lock(S); smp_mb();
> > + * smp_mb__after_spinlock(); r1 = READ_ONCE(X);
> > + * r0 = READ_ONCE(Y);
> > + * spin_unlock(S);
>
> Should we say that this is an instance of the SB pattern? (Am OK either
> way, just asking the question.)

I don't think we *should* ;-), but I'm also OK either way.

Andrea

\
 
 \ /
  Last update: 2018-07-03 19:08    [W:0.054 / U:0.428 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site