18c2ecf20Sopenharmony_ciC Z6.0+pooncerelease+poacquirerelease+fencembonceonce 28c2ecf20Sopenharmony_ci 38c2ecf20Sopenharmony_ci(* 48c2ecf20Sopenharmony_ci * Result: Sometimes 58c2ecf20Sopenharmony_ci * 68c2ecf20Sopenharmony_ci * This litmus test shows that a release-acquire chain, while sufficient 78c2ecf20Sopenharmony_ci * when there is but one non-reads-from (AKA non-rf) link, does not suffice 88c2ecf20Sopenharmony_ci * if there is more than one. Of the three processes, only P1() reads from 98c2ecf20Sopenharmony_ci * P0's write, which means that there are two non-rf links: P1() to P2() 108c2ecf20Sopenharmony_ci * is a write-to-write link (AKA a "coherence" or just "co" link) and P2() 118c2ecf20Sopenharmony_ci * to P0() is a read-to-write link (AKA a "from-reads" or just "fr" link). 128c2ecf20Sopenharmony_ci * When there are two or more non-rf links, you typically will need one 138c2ecf20Sopenharmony_ci * full barrier for each non-rf link. (Exceptions include some cases 148c2ecf20Sopenharmony_ci * involving locking.) 158c2ecf20Sopenharmony_ci *) 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_ci{} 188c2ecf20Sopenharmony_ci 198c2ecf20Sopenharmony_ciP0(int *x, int *y) 208c2ecf20Sopenharmony_ci{ 218c2ecf20Sopenharmony_ci WRITE_ONCE(*x, 1); 228c2ecf20Sopenharmony_ci smp_store_release(y, 1); 238c2ecf20Sopenharmony_ci} 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_ciP1(int *y, int *z) 268c2ecf20Sopenharmony_ci{ 278c2ecf20Sopenharmony_ci int r0; 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_ci r0 = smp_load_acquire(y); 308c2ecf20Sopenharmony_ci smp_store_release(z, 1); 318c2ecf20Sopenharmony_ci} 328c2ecf20Sopenharmony_ci 338c2ecf20Sopenharmony_ciP2(int *x, int *z) 348c2ecf20Sopenharmony_ci{ 358c2ecf20Sopenharmony_ci int r1; 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_ci WRITE_ONCE(*z, 2); 388c2ecf20Sopenharmony_ci smp_mb(); 398c2ecf20Sopenharmony_ci r1 = READ_ONCE(*x); 408c2ecf20Sopenharmony_ci} 418c2ecf20Sopenharmony_ci 428c2ecf20Sopenharmony_ciexists (1:r0=1 /\ z=2 /\ 2:r1=0) 43