[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180703170757.GA3251@andrea>
Date: Tue, 3 Jul 2018 19:07:57 +0200
From: Andrea Parri <andrea.parri@...rulasolutions.com>
To: "Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>
Cc: linux-kernel@...r.kernel.org, linux-doc@...r.kernel.org,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Will Deacon <will.deacon@....com>,
Alan Stern <stern@...land.harvard.edu>,
Boqun Feng <boqun.feng@...il.com>,
Nicholas Piggin <npiggin@...il.com>,
David Howells <dhowells@...hat.com>,
Jade Alglave <j.alglave@....ac.uk>,
Luc Maranget <luc.maranget@...ia.fr>,
Akira Yokosawa <akiyks@...il.com>,
Daniel Lustig <dlustig@...dia.com>,
Jonathan Corbet <corbet@....net>,
Randy Dunlap <rdunlap@...radead.org>,
Matthew Wilcox <willy@...radead.org>
Subject: Re: [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
Powered by blists - more mailing lists