Re: [PATCH v2] tools/memory-model: Add extra ordering for locks and remove it for ordinary release/acquire
From: Andrea Parri
Date: Thu Jul 12 2018 - 15:52:52 EST
On Thu, Jul 12, 2018 at 11:10:58AM -0700, Linus Torvalds wrote:
> On Thu, Jul 12, 2018 at 11:05 AM Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
> >
> > The locking pattern is fairly simple and shows where RCpc comes apart
> > from expectation real nice.
>
> So who does RCpc right now for the unlock-lock sequence? Somebody
> mentioned powerpc. Anybody else?
powerpc have RCtso (and RCpc) but not RCsc unlock-lock, according to the
following indeed original terminology:
- RCsc unlock-lock MUST ORDER:
a) the WRITE and the READ below:
WRITE x=1
UNLOCK s
LOCK s
READ y
as in a store-buffering test;
b) the two WRITEs below:
WRITE x=1
UNLOCK s
LOCK s
WRITE y=1
as in a message-passing test;
c) the two READs below:
READ x
UNLOCK s
LOCK s
READ y
as in a message-passing test;
d) the READ and the WRITE below:
READ x
UNLOCK s
LOCK s
WRITE y
as in a load-buffering test;
- RCtso unlock-lock MUST ORDER b), c), d) above.
- RCpc unlock-lock MUST ORDER none of the above.
AFAICT, all arch _in_ the current implementation have RCtso unlock-lock.
>
> How nasty would be be to make powerpc conform? I will always advocate
> tighter locking and ordering rules over looser ones..
A simple answer is right above (place a sync somewhere in the sequence);
for benchmark results, I must defer...
Andrea
>
> Linus