1C SB+fencembonceonces 2 3(* 4 * Result: Never 5 * 6 * This litmus test demonstrates that full memory barriers suffice to 7 * order the store-buffering pattern, where each process writes to the 8 * variable that the preceding process reads. (Locking and RCU can also 9 * suffice, but not much else.) 10 *) 11 12{ 13 int x; 14 int y; 15} 16 17P0(int *x, int *y) 18{ 19 int r0; 20 21 WRITE_ONCE(*x, 1); 22 smp_mb(); 23 r0 = READ_ONCE(*y); 24} 25 26P1(int *x, int *y) 27{ 28 int r0; 29 30 WRITE_ONCE(*y, 1); 31 smp_mb(); 32 r0 = READ_ONCE(*x); 33} 34 35exists (0:r0=0 /\ 1:r0=0) 36