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 - 13:52:35 EST


> It seems reasonable to ask people to learn that locks have stronger
> ordering guarantees than RMW atomics do. Maybe not the greatest
> situation in the world, but one I think we could live with.

Yeah, this was one of my main objections.


> > Hence my proposal to strenghten rmw-acquire, because that is the basic
> > primitive used to implement lock.
>
> That was essentially what the v2 patch did. (And my reasoning was
> basically the same as what you have just outlined. There was one
> additional element: smp_store_release() is already strong enough for
> TSO; the acquire is what needs to be stronger in the memory model.)

Mmh? see my comments to v2 (and your reply, in part., the part "At
least, it's not a valid general-purpose implementation".).


> > Another, and I like this proposal least, is to introduce a new barrier
> > to make this all work.
>
> This apparently boils down to two questions:
>
> Should spin_lock/spin_unlock be RCsc?
>
> Should rmw-acquire be strong enough so that smp_store_release +
> rmw-acquire is RCtso?
>
> If both answers are No, we end up with the v3 patch. If the first
> answer is No and the second is Yes, we end up with the v2 patch. The
> problem is that different people seem to want differing answers.

Again, maybe you're confonding v2 with v1?

Andrea


>
> (The implicit third question, "Should spin_lock/spin_unlock be RCtso?",
> seems to be pretty well settled at this point -- by Peter's and Will's
> vociferousness if nothing else -- despite Andrea's reservations.
> However I admit it would be nice to have one or two examples showing
> that the kernel really needs this.)
>
> Alan
>