mirror of
https://github.com/torvalds/linux.git
synced 2024-11-23 20:51:44 +00:00
5c587f9b9c
This is a revert of commit 1947bfcf81
("tools/memory-model: Add types
to litmus tests") with conflict resolutions.
klitmus7 [1] is aware of default types of "int" and "int*".
It accepts litmus tests for herd7 without extra type info unless
non-"int" variables are referenced by an "exists", "locations",
or "filter" directive.
[1]: Tested with klitmus7 versions 7.49 or later.
Suggested-by: Paul E. McKenney <paulmck@kernel.org>
Signed-off-by: Akira Yokosawa <akiyks@gmail.com>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
35 lines
745 B
Plaintext
35 lines
745 B
Plaintext
C MP+polockmbonce+poacquiresilsil
|
|
|
|
(*
|
|
* Result: Never
|
|
*
|
|
* Do spinlocks combined with smp_mb__after_spinlock() provide order
|
|
* to outside observers using spin_is_locked() to sense the lock-held
|
|
* state, ordered by acquire? Note that when the first spin_is_locked()
|
|
* returns false and the second true, we know that the smp_load_acquire()
|
|
* executed before the lock was acquired (loosely speaking).
|
|
*)
|
|
|
|
{}
|
|
|
|
P0(spinlock_t *lo, int *x) // Producer
|
|
{
|
|
spin_lock(lo);
|
|
smp_mb__after_spinlock();
|
|
WRITE_ONCE(*x, 1);
|
|
spin_unlock(lo);
|
|
}
|
|
|
|
P1(spinlock_t *lo, int *x) // Consumer
|
|
{
|
|
int r1;
|
|
int r2;
|
|
int r3;
|
|
|
|
r1 = smp_load_acquire(x);
|
|
r2 = spin_is_locked(lo);
|
|
r3 = spin_is_locked(lo);
|
|
}
|
|
|
|
exists (1:r1=1 /\ 1:r2=0 /\ 1:r3=1) (* Bad outcome. *)
|