Merge tag 'block-5.9-2020-08-14' of git://git.kernel.dk/linux-block
[linux/fpc-iii.git] / tools / memory-model / litmus-tests / MP+polockmbonce+poacquiresilsil.litmus
blob50f4d62bbf0ea550626b1c55c9211f5ff60df403
1 C MP+polockmbonce+poacquiresilsil
3 (*
4  * Result: Never
5  *
6  * Do spinlocks combined with smp_mb__after_spinlock() provide order
7  * to outside observers using spin_is_locked() to sense the lock-held
8  * state, ordered by acquire?  Note that when the first spin_is_locked()
9  * returns false and the second true, we know that the smp_load_acquire()
10  * executed before the lock was acquired (loosely speaking).
11  *)
16 P0(spinlock_t *lo, int *x)
18         spin_lock(lo);
19         smp_mb__after_spinlock();
20         WRITE_ONCE(*x, 1);
21         spin_unlock(lo);
24 P1(spinlock_t *lo, int *x)
26         int r1;
27         int r2;
28         int r3;
30         r1 = smp_load_acquire(x);
31         r2 = spin_is_locked(lo);
32         r3 = spin_is_locked(lo);
35 exists (1:r1=1 /\ 1:r2=0 /\ 1:r3=1)