Re: [RFC] Potential problem in qspinlock due to mixed-size accesses
From: Andrea Parri
Date: Mon Jun 16 2025 - 02:22:07 EST
> Thanks for the praise. I expected more questioning/discussion and less
> immediate acceptance :)
Well, the discussion isn't closed yet. ;-)
> Maybe one should also take into consideration a hypothetical extension of
> LKMM to MSA.
> I think LKMM (and also C11) do not preserve REL->ACQ ordering because this
> would disallow their implementation as simple stores/loads on TSO.
> That being said, maybe preserving "rmw;[REL];po;[ACQ]" on the
> language-level would be fine and sufficient for qspinlock.
On PPC say, the expression can translate to a sequence "lwsync ; lwarx ;
stwcx. ; ... ; lwz ; lwsync", in which the order of the two loads is not
necessarily preserved.
MSAs have been on the LKMM TODO list for quite some time. I'm confident
this thread will help to make some progress or at least to reinforce the
interest in the topic.
Andrea