Re: [RFC] Potential problem in qspinlock due to mixed-size accesses
Alan Stern <[email protected]>
| Newsgroups | dev.linux.lists.lkmm,org.kernel.vger.linux-arch,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
On Mon, Jun 16, 2025 at 08:21:50AM +0200, Andrea Parri wrote: > > 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. Indeed. I was surprised to learn that CPUs can sometimes change a 32-bit load into two 16-bit loads. My question is: Do we have enough general knowledge at this point about how the various types of hardware handle mixed-size accesses to come up with a memory model everyone can agree one? Alan