tools/memory-model: Add types to litmus tests
[linux-2.6-microblaze.git] / tools / memory-model / litmus-tests / MP+fencewmbonceonce+fencermbonceonce.litmus
1 C MP+fencewmbonceonce+fencermbonceonce
2
3 (*
4  * Result: Never
5  *
6  * This litmus test demonstrates that smp_wmb() and smp_rmb() provide
7  * sufficient ordering for the message-passing pattern.  However, it
8  * is usually better to use smp_store_release() and smp_load_acquire().
9  *)
10
11 {
12         int x;
13         int y;
14 }
15
16 P0(int *x, int *y)
17 {
18         WRITE_ONCE(*x, 1);
19         smp_wmb();
20         WRITE_ONCE(*y, 1);
21 }
22
23 P1(int *x, int *y)
24 {
25         int r0;
26         int r1;
27
28         r0 = READ_ONCE(*y);
29         smp_rmb();
30         r1 = READ_ONCE(*x);
31 }
32
33 exists (1:r0=1 /\ 1:r1=0)