]> git.baikalelectronics.ru Git - kernel.git/commit
tools/memory-model: Provide extra ordering for unlock+lock pair on the same CPU
authorBoqun Feng <boqun.feng@gmail.com>
Mon, 25 Oct 2021 14:54:14 +0000 (22:54 +0800)
committerPaul E. McKenney <paulmck@kernel.org>
Wed, 1 Dec 2021 01:47:08 +0000 (17:47 -0800)
commit9145b10a5254b3f743a8ad073d5a8e4b8ad590ef
tree160f73d10ba864f1fd4c8994794941a6d80175c3
parent40a9af63ae9ec42386d6c40b14f92fb56557c9a8
tools/memory-model: Provide extra ordering for unlock+lock pair on the same CPU

A recent discussion[1] shows that we are in favor of strengthening the
ordering of unlock + lock on the same CPU: a unlock and a po-after lock
should provide the so-called RCtso ordering, that is a memory access S
po-before the unlock should be ordered against a memory access R
po-after the lock, unless S is a store and R is a load.

The strengthening meets programmers' expection that "sequence of two
locked regions to be ordered wrt each other" (from Linus), and can
reduce the mental burden when using locks. Therefore add it in LKMM.

[1]: https://lore.kernel.org/lkml/20210909185937.GA12379@rowland.harvard.edu/

Co-developed-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
Reviewed-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc)
Acked-by: Palmer Dabbelt <palmerdabbelt@google.com> (RISC-V)
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
tools/memory-model/Documentation/explanation.txt
tools/memory-model/linux-kernel.cat