1*acb6c96cSPaul E. McKenneyC ISA2+pooncelock+pooncelock+pombonce 2556bb7d2SAlan Stern 3556bb7d2SAlan Stern(* 4556bb7d2SAlan Stern * Result: Sometimes 5556bb7d2SAlan Stern * 6556bb7d2SAlan Stern * This test shows that the ordering provided by a lock-protected S 7556bb7d2SAlan Stern * litmus test (P0() and P1()) are not visible to external process P2(). 8556bb7d2SAlan Stern * This is likely to change soon. 9556bb7d2SAlan Stern *) 10556bb7d2SAlan Stern 11556bb7d2SAlan Stern{} 12556bb7d2SAlan Stern 13556bb7d2SAlan SternP0(int *x, int *y, spinlock_t *mylock) 14556bb7d2SAlan Stern{ 15556bb7d2SAlan Stern spin_lock(mylock); 16556bb7d2SAlan Stern WRITE_ONCE(*x, 1); 17556bb7d2SAlan Stern WRITE_ONCE(*y, 1); 18556bb7d2SAlan Stern spin_unlock(mylock); 19556bb7d2SAlan Stern} 20556bb7d2SAlan Stern 21556bb7d2SAlan SternP1(int *y, int *z, spinlock_t *mylock) 22556bb7d2SAlan Stern{ 23556bb7d2SAlan Stern int r0; 24556bb7d2SAlan Stern 25556bb7d2SAlan Stern spin_lock(mylock); 26556bb7d2SAlan Stern r0 = READ_ONCE(*y); 27556bb7d2SAlan Stern WRITE_ONCE(*z, 1); 28556bb7d2SAlan Stern spin_unlock(mylock); 29556bb7d2SAlan Stern} 30556bb7d2SAlan Stern 31556bb7d2SAlan SternP2(int *x, int *z) 32556bb7d2SAlan Stern{ 33556bb7d2SAlan Stern int r1; 34556bb7d2SAlan Stern int r2; 35556bb7d2SAlan Stern 36556bb7d2SAlan Stern r2 = READ_ONCE(*z); 37556bb7d2SAlan Stern smp_mb(); 38556bb7d2SAlan Stern r1 = READ_ONCE(*x); 39556bb7d2SAlan Stern} 40556bb7d2SAlan Stern 41556bb7d2SAlan Sternexists (1:r0=1 /\ 2:r2=1 /\ 2:r1=0) 42