Re: Unlock-lock questions and the Linux Kernel Memory Model

From: Alan Stern
Date: Thu Nov 30 2017 - 12:57:19 EST


On Thu, 30 Nov 2017, Paul E. McKenney wrote:

> > > Will, are there plans to bring this sort of thing before the standards
> > > committee?
> >
> > We discussed it, but rejected it mainly because of concerns that there could
> > be RmW operations that don't necessarily have an order-inducing dependency
> > in all scenarios. I think the case that was batted around was a saturating
> > add implemented using cmpxchg.
>
> Ah, I do remember now, during the Toronto meeting, correct?
>
> So should we consider making LKMM make xchg act in a manner similar to
> the other atomics, or would you prefer that we keep the current special
> behavior?

In fact, right now herd doesn't implement the dependencies. So
"current special behavior" is ambiguous -- there's what herd currently
does, and there's what one would expect it to do.

(Incidentally, this should all be considered part of herd, rather than
part of the LKMM. Although herd can simulate the memory model, they
aren't the same thing.)

Also, as Will says, some atomic operations have more than one possible
implementation, with differing internal dependencies.

Alan