]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blob - tools/memory-model/litmus-tests/Z6.0+pooncelock+poonceLock+pombonce.litmus
Merge tag 'Wimplicit-fallthrough-clang-5.14-rc1' of git://git.kernel.org/pub/scm...
[mirror_ubuntu-jammy-kernel.git] / tools / memory-model / litmus-tests / Z6.0+pooncelock+poonceLock+pombonce.litmus
1 C Z6.0+pooncelock+poonceLock+pombonce
2
3 (*
4 * Result: Never
5 *
6 * This litmus test demonstrates how smp_mb__after_spinlock() may be
7 * used to ensure that accesses in different critical sections for a
8 * given lock running on different CPUs are nevertheless seen in order
9 * by CPUs not holding that lock.
10 *)
11
12 {}
13
14 P0(int *x, int *y, spinlock_t *mylock)
15 {
16 spin_lock(mylock);
17 WRITE_ONCE(*x, 1);
18 WRITE_ONCE(*y, 1);
19 spin_unlock(mylock);
20 }
21
22 P1(int *y, int *z, spinlock_t *mylock)
23 {
24 int r0;
25
26 spin_lock(mylock);
27 smp_mb__after_spinlock();
28 r0 = READ_ONCE(*y);
29 WRITE_ONCE(*z, 1);
30 spin_unlock(mylock);
31 }
32
33 P2(int *x, int *z)
34 {
35 int r1;
36
37 WRITE_ONCE(*z, 2);
38 smp_mb();
39 r1 = READ_ONCE(*x);
40 }
41
42 exists (1:r0=1 /\ z=2 /\ 2:r1=0)