0001 C SB+fencembonceonces
0002
0003 (*
0004 * Result: Never
0005 *
0006 * This litmus test demonstrates that full memory barriers suffice to
0007 * order the store-buffering pattern, where each process writes to the
0008 * variable that the preceding process reads. (Locking and RCU can also
0009 * suffice, but not much else.)
0010 *)
0011
0012 {}
0013
0014 P0(int *x, int *y)
0015 {
0016 int r0;
0017
0018 WRITE_ONCE(*x, 1);
0019 smp_mb();
0020 r0 = READ_ONCE(*y);
0021 }
0022
0023 P1(int *x, int *y)
0024 {
0025 int r0;
0026
0027 WRITE_ONCE(*y, 1);
0028 smp_mb();
0029 r0 = READ_ONCE(*x);
0030 }
0031
0032 exists (0:r0=0 /\ 1:r0=0)