Messages in this thread | | | From | Linus Torvalds <> | Date | Thu, 9 Sep 2021 10:02:13 -0700 | Subject | Re: [tip:locking/core] tools/memory-model: Add extra ordering for locks and remove it for ordinary release/acquire |
| |
On Thu, Sep 9, 2021 at 6:35 AM Will Deacon <will@kernel.org> wrote: > > I don't think we should require the accesses to the actual lockwords to > be ordered here, as it becomes pretty onerous for relaxed LL/SC > architectures where you'd end up with an extra barrier either after the > unlock() or before the lock() operation. However, I remain absolutely in > favour of strengthening the ordering of the _critical sections_ guarded by > the locks to be RCsc.
Ack. The actual locking operations themselves can obviously overlap, it's what they protect that should be ordered if at all possible.
Because anything else will be too confusing for words, and if we have to add memory barriers *and* locking we're just screwed.
Because I think it is entirely understandable for people to expect that sequence of two locked regions to be ordered wrt each other.
While memory ordering is subtle and confusing, we should strive to make our "..but I used locks" to be as straightforward and as understandable to people who really really don't want to even think about memory order as at all reasonable.
I think we should have a very strong reason for accepting unordered locked regions (with "strong reason" being defined as "on this architecture that is hugely important, anything else would slow down locks enormously").
It sounds like no such architecture exists, much less is important.
Linus
| |