1*556bb7d2SAlan SternC ISA2+pooncelock+pooncelock+pombonce.litmus 2*556bb7d2SAlan Stern 3*556bb7d2SAlan Stern(* 4*556bb7d2SAlan Stern * Result: Sometimes 5*556bb7d2SAlan Stern * 6*556bb7d2SAlan Stern * This test shows that the ordering provided by a lock-protected S 7*556bb7d2SAlan Stern * litmus test (P0() and P1()) are not visible to external process P2(). 8*556bb7d2SAlan Stern * This is likely to change soon. 9*556bb7d2SAlan Stern *) 10*556bb7d2SAlan Stern 11*556bb7d2SAlan Stern{} 12*556bb7d2SAlan Stern 13*556bb7d2SAlan SternP0(int *x, int *y, spinlock_t *mylock) 14*556bb7d2SAlan Stern{ 15*556bb7d2SAlan Stern spin_lock(mylock); 16*556bb7d2SAlan Stern WRITE_ONCE(*x, 1); 17*556bb7d2SAlan Stern WRITE_ONCE(*y, 1); 18*556bb7d2SAlan Stern spin_unlock(mylock); 19*556bb7d2SAlan Stern} 20*556bb7d2SAlan Stern 21*556bb7d2SAlan SternP1(int *y, int *z, spinlock_t *mylock) 22*556bb7d2SAlan Stern{ 23*556bb7d2SAlan Stern int r0; 24*556bb7d2SAlan Stern 25*556bb7d2SAlan Stern spin_lock(mylock); 26*556bb7d2SAlan Stern r0 = READ_ONCE(*y); 27*556bb7d2SAlan Stern WRITE_ONCE(*z, 1); 28*556bb7d2SAlan Stern spin_unlock(mylock); 29*556bb7d2SAlan Stern} 30*556bb7d2SAlan Stern 31*556bb7d2SAlan SternP2(int *x, int *z) 32*556bb7d2SAlan Stern{ 33*556bb7d2SAlan Stern int r1; 34*556bb7d2SAlan Stern int r2; 35*556bb7d2SAlan Stern 36*556bb7d2SAlan Stern r2 = READ_ONCE(*z); 37*556bb7d2SAlan Stern smp_mb(); 38*556bb7d2SAlan Stern r1 = READ_ONCE(*x); 39*556bb7d2SAlan Stern} 40*556bb7d2SAlan Stern 41*556bb7d2SAlan Sternexists (1:r0=1 /\ 2:r2=1 /\ 2:r1=0) 42