]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blame - tools/memory-model/litmus-tests/Z6.0+pooncerelease+poacquirerelease+fencembonceonce.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+pooncerelease+poacquirerelease+fencembonceonce.litmus
CommitLineData
71b7ff5e 1C Z6.0+pooncerelease+poacquirerelease+fencembonceonce
1c27b644 2
8f32543b
PM
3(*
4 * Result: Sometimes
5 *
6 * This litmus test shows that a release-acquire chain, while sufficient
7 * when there is but one non-reads-from (AKA non-rf) link, does not suffice
8 * if there is more than one. Of the three processes, only P1() reads from
9 * P0's write, which means that there are two non-rf links: P1() to P2()
10 * is a write-to-write link (AKA a "coherence" or just "co" link) and P2()
11 * to P0() is a read-to-write link (AKA a "from-reads" or just "fr" link).
12 * When there are two or more non-rf links, you typically will need one
13 * full barrier for each non-rf link. (Exceptions include some cases
14 * involving locking.)
15 *)
16
5c587f9b 17{}
1c27b644
PM
18
19P0(int *x, int *y)
20{
21 WRITE_ONCE(*x, 1);
22 smp_store_release(y, 1);
23}
24
25P1(int *y, int *z)
26{
27 int r0;
28
29 r0 = smp_load_acquire(y);
30 smp_store_release(z, 1);
31}
32
33P2(int *x, int *z)
34{
35 int r1;
36
37 WRITE_ONCE(*z, 2);
38 smp_mb();
39 r1 = READ_ONCE(*x);
40}
41
42exists (1:r0=1 /\ z=2 /\ 2:r1=0)