18c2ecf20Sopenharmony_ciC SB+fencembonceonces 28c2ecf20Sopenharmony_ci 38c2ecf20Sopenharmony_ci(* 48c2ecf20Sopenharmony_ci * Result: Never 58c2ecf20Sopenharmony_ci * 68c2ecf20Sopenharmony_ci * This litmus test demonstrates that full memory barriers suffice to 78c2ecf20Sopenharmony_ci * order the store-buffering pattern, where each process writes to the 88c2ecf20Sopenharmony_ci * variable that the preceding process reads. (Locking and RCU can also 98c2ecf20Sopenharmony_ci * suffice, but not much else.) 108c2ecf20Sopenharmony_ci *) 118c2ecf20Sopenharmony_ci 128c2ecf20Sopenharmony_ci{} 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_ciP0(int *x, int *y) 158c2ecf20Sopenharmony_ci{ 168c2ecf20Sopenharmony_ci int r0; 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ci WRITE_ONCE(*x, 1); 198c2ecf20Sopenharmony_ci smp_mb(); 208c2ecf20Sopenharmony_ci r0 = READ_ONCE(*y); 218c2ecf20Sopenharmony_ci} 228c2ecf20Sopenharmony_ci 238c2ecf20Sopenharmony_ciP1(int *x, int *y) 248c2ecf20Sopenharmony_ci{ 258c2ecf20Sopenharmony_ci int r0; 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_ci WRITE_ONCE(*y, 1); 288c2ecf20Sopenharmony_ci smp_mb(); 298c2ecf20Sopenharmony_ci r0 = READ_ONCE(*x); 308c2ecf20Sopenharmony_ci} 318c2ecf20Sopenharmony_ci 328c2ecf20Sopenharmony_ciexists (0:r0=0 /\ 1:r0=0) 33