OpenCloudOS-Kernel/tools/memory-model/litmus-tests
Alan Stern 556bb7d252 tools/memory-model: Add a S lock-based external-view litmus test
This commit adds a litmus test in which P0() and P1() form a lock-based S
litmus test, with the addition of P2(), which observes P0()'s and P1()'s
accesses with a full memory barrier but without the lock.  This litmus
test asks whether writes carried out by two different processes under the
same lock will be seen in order by a third process not holding that lock.
The answer to this question is "yes" for all architectures supporting
the Linux kernel, but is "no" according to the current version of LKMM.

A patch to LKMM is under development.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Acked-by: Peter Zijlstra <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: akiyks@gmail.com
Cc: boqun.feng@gmail.com
Cc: dhowells@redhat.com
Cc: j.alglave@ucl.ac.uk
Cc: linux-arch@vger.kernel.org
Cc: luc.maranget@inria.fr
Cc: nborisov@suse.com
Cc: npiggin@gmail.com
Cc: parri.andrea@gmail.com
Cc: will.deacon@arm.com
Link: http://lkml.kernel.org/r/1519169112-20593-10-git-send-email-paulmck@linux.vnet.ibm.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2018-02-21 09:58:15 +01:00
..
CoRR+poonceonce+Once.litmus EXP litmus_tests: Add comments explaining tests' purposes 2018-02-21 09:58:13 +01:00
CoRW+poonceonce+Once.litmus EXP litmus_tests: Add comments explaining tests' purposes 2018-02-21 09:58:13 +01:00
CoWR+poonceonce+Once.litmus EXP litmus_tests: Add comments explaining tests' purposes 2018-02-21 09:58:13 +01:00
CoWW+poonceonce.litmus EXP litmus_tests: Add comments explaining tests' purposes 2018-02-21 09:58:13 +01:00
IRIW+mbonceonces+OnceOnce.litmus EXP litmus_tests: Add comments explaining tests' purposes 2018-02-21 09:58:13 +01:00
IRIW+poonceonces+OnceOnce.litmus EXP litmus_tests: Add comments explaining tests' purposes 2018-02-21 09:58:13 +01:00
ISA2+pooncelock+pooncelock+pombonce.litmus tools/memory-model: Add a S lock-based external-view litmus test 2018-02-21 09:58:15 +01:00
ISA2+poonceonces.litmus EXP litmus_tests: Add comments explaining tests' purposes 2018-02-21 09:58:13 +01:00
ISA2+pooncerelease+poacquirerelease+poacquireonce.litmus EXP litmus_tests: Add comments explaining tests' purposes 2018-02-21 09:58:13 +01:00
LB+ctrlonceonce+mbonceonce.litmus EXP litmus_tests: Add comments explaining tests' purposes 2018-02-21 09:58:13 +01:00
LB+poacquireonce+pooncerelease.litmus EXP litmus_tests: Add comments explaining tests' purposes 2018-02-21 09:58:13 +01:00
LB+poonceonces.litmus EXP litmus_tests: Add comments explaining tests' purposes 2018-02-21 09:58:13 +01:00
MP+onceassign+derefonce.litmus EXP litmus_tests: Add comments explaining tests' purposes 2018-02-21 09:58:13 +01:00
MP+polocks.litmus EXP litmus_tests: Add comments explaining tests' purposes 2018-02-21 09:58:13 +01:00
MP+poonceonces.litmus EXP litmus_tests: Add comments explaining tests' purposes 2018-02-21 09:58:13 +01:00
MP+pooncerelease+poacquireonce.litmus EXP litmus_tests: Add comments explaining tests' purposes 2018-02-21 09:58:13 +01:00
MP+porevlocks.litmus EXP litmus_tests: Add comments explaining tests' purposes 2018-02-21 09:58:13 +01:00
MP+wmbonceonce+rmbonceonce.litmus EXP litmus_tests: Add comments explaining tests' purposes 2018-02-21 09:58:13 +01:00
R+mbonceonces.litmus EXP litmus_tests: Add comments explaining tests' purposes 2018-02-21 09:58:13 +01:00
R+poonceonces.litmus EXP litmus_tests: Add comments explaining tests' purposes 2018-02-21 09:58:13 +01:00
README README: Fix a couple of punctuation errors 2018-02-21 09:58:14 +01:00
S+poonceonces.litmus EXP litmus_tests: Add comments explaining tests' purposes 2018-02-21 09:58:13 +01:00
S+wmbonceonce+poacquireonce.litmus EXP litmus_tests: Add comments explaining tests' purposes 2018-02-21 09:58:13 +01:00
SB+mbonceonces.litmus EXP litmus_tests: Add comments explaining tests' purposes 2018-02-21 09:58:13 +01:00
SB+poonceonces.litmus EXP litmus_tests: Add comments explaining tests' purposes 2018-02-21 09:58:13 +01:00
WRC+poonceonces+Once.litmus EXP litmus_tests: Add comments explaining tests' purposes 2018-02-21 09:58:13 +01:00
WRC+pooncerelease+rmbonceonce+Once.litmus EXP litmus_tests: Add comments explaining tests' purposes 2018-02-21 09:58:13 +01:00
Z6.0+pooncelock+poonceLock+pombonce.litmus EXP litmus_tests: Add comments explaining tests' purposes 2018-02-21 09:58:13 +01:00
Z6.0+pooncelock+pooncelock+pombonce.litmus EXP litmus_tests: Add comments explaining tests' purposes 2018-02-21 09:58:13 +01:00
Z6.0+pooncerelease+poacquirerelease+mbonceonce.litmus EXP litmus_tests: Add comments explaining tests' purposes 2018-02-21 09:58:13 +01:00

README

This directory contains the following litmus tests:

CoRR+poonceonce+Once.litmus
	Test of read-read coherence, that is, whether or not two
	successive reads from the same variable are ordered.

CoRW+poonceonce+Once.litmus
	Test of read-write coherence, that is, whether or not a read
	from a given variable followed by a write to that same variable
	are ordered.

CoWR+poonceonce+Once.litmus
	Test of write-read coherence, that is, whether or not a write
	to a given variable followed by a read from that same variable
	are ordered.

CoWW+poonceonce.litmus
	Test of write-write coherence, that is, whether or not two
	successive writes to the same variable are ordered.

IRIW+mbonceonces+OnceOnce.litmus
	Test of independent reads from independent writes with smp_mb()
	between each pairs of reads.  In other words, is smp_mb()
	sufficient to cause two different reading processes to agree on
	the order of a pair of writes, where each write is to a different
	variable by a different process?

IRIW+poonceonces+OnceOnce.litmus
	Test of independent reads from independent writes with nothing
	between each pairs of reads.  In other words, is anything at all
	needed to cause two different reading processes to agree on the
	order of a pair of writes, where each write is to a different
	variable by a different process?

ISA2+poonceonces.litmus
	As below, but with store-release replaced with WRITE_ONCE()
	and load-acquire replaced with READ_ONCE().

ISA2+pooncerelease+poacquirerelease+poacquireonce.litmus
	Can a release-acquire chain order a prior store against
	a later load?

LB+ctrlonceonce+mbonceonce.litmus
	Does a control dependency and an smp_mb() suffice for the
	load-buffering litmus test, where each process reads from one
	of two variables then writes to the other?

LB+poacquireonce+pooncerelease.litmus
	Does a release-acquire pair suffice for the load-buffering
	litmus test, where each process reads from one of two variables then
	writes to the other?

LB+poonceonces.litmus
	As above, but with store-release replaced with WRITE_ONCE()
	and load-acquire replaced with READ_ONCE().

MP+onceassign+derefonce.litmus
	As below, but with rcu_assign_pointer() and an rcu_dereference().

MP+polocks.litmus
	As below, but with the second access of the writer process
	and the first access of reader process protected by a lock.

MP+poonceonces.litmus
	As below, but without the smp_rmb() and smp_wmb().

MP+pooncerelease+poacquireonce.litmus
	As below, but with a release-acquire chain.

MP+porevlocks.litmus
	As below, but with the first access of the writer process
	and the second access of reader process protected by a lock.

MP+wmbonceonce+rmbonceonce.litmus
	Does a smp_wmb() (between the stores) and an smp_rmb() (between
	the loads) suffice for the message-passing litmus test, where one
	process writes data and then a flag, and the other process reads
	the flag and then the data.  (This is similar to the ISA2 tests,
	but with two processes instead of three.)

R+mbonceonces.litmus
	This is the fully ordered (via smp_mb()) version of one of
	the classic counterintuitive litmus tests that illustrates the
	effects of store propagation delays.

R+poonceonces.litmus
	As above, but without the smp_mb() invocations.

SB+mbonceonces.litmus
	This is the fully ordered (again, via smp_mb() version of store
	buffering, which forms the core of Dekker's mutual-exclusion
	algorithm.

SB+poonceonces.litmus
	As above, but without the smp_mb() invocations.

S+poonceonces.litmus
	As below, but without the smp_wmb() and acquire load.

S+wmbonceonce+poacquireonce.litmus
	Can a smp_wmb(), instead of a release, and an acquire order
	a prior store against a subsequent store?

WRC+poonceonces+Once.litmus
WRC+pooncerelease+rmbonceonce+Once.litmus
	These two are members of an extension of the MP litmus-test class
	in which the first write is moved to a separate process.

Z6.0+pooncelock+pooncelock+pombonce.litmus
	Is the ordering provided by a spin_unlock() and a subsequent
	spin_lock() sufficient to make ordering apparent to accesses
	by a process not holding the lock?

Z6.0+pooncelock+poonceLock+pombonce.litmus
	As above, but with smp_mb__after_spinlock() immediately
	following the spin_lock().

Z6.0+pooncerelease+poacquirerelease+mbonceonce.litmus
	Is the ordering provided by a release-acquire chain sufficient
	to make ordering apparent to accesses by a process that does
	not participate in that release-acquire chain?

A great many more litmus tests are available here:

	https://github.com/paulmckrcu/litmus