Merge tag 'gfs2-for-5.11' of git://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux...
[linux-2.6-microblaze.git] / tools / memory-model / litmus-tests / ISA2+pooncerelease+poacquirerelease+poacquireonce.litmus
1 C ISA2+pooncerelease+poacquirerelease+poacquireonce
2
3 (*
4  * Result: Never
5  *
6  * This litmus test demonstrates that a release-acquire chain suffices
7  * to order P0()'s initial write against P2()'s final read.  The reason
8  * that the release-acquire chain suffices is because in all but one
9  * case (P2() to P0()), each process reads from the preceding process's
10  * write.  In memory-model-speak, there is only one non-reads-from
11  * (AKA non-rf) link, so release-acquire is all that is needed.
12  *)
13
14 {
15         int x;
16         int y;
17         int z;
18 }
19
20 P0(int *x, int *y)
21 {
22         WRITE_ONCE(*x, 1);
23         smp_store_release(y, 1);
24 }
25
26 P1(int *y, int *z)
27 {
28         int r0;
29
30         r0 = smp_load_acquire(y);
31         smp_store_release(z, 1);
32 }
33
34 P2(int *x, int *z)
35 {
36         int r0;
37         int r1;
38
39         r0 = smp_load_acquire(z);
40         r1 = READ_ONCE(*x);
41 }
42
43 exists (1:r0=1 /\ 2:r0=1 /\ 2:r1=0)