11c27b644SPaul E. McKenneyC Z6.0+pooncelock+poonceLock+pombonce 21c27b644SPaul E. McKenney 38f32543bSPaul E. McKenney(* 48f32543bSPaul E. McKenney * Result: Never 58f32543bSPaul E. McKenney * 68f32543bSPaul E. McKenney * This litmus test demonstrates how smp_mb__after_spinlock() may be 78f32543bSPaul E. McKenney * used to ensure that accesses in different critical sections for a 88f32543bSPaul E. McKenney * given lock running on different CPUs are nevertheless seen in order 98f32543bSPaul E. McKenney * by CPUs not holding that lock. 108f32543bSPaul E. McKenney *) 118f32543bSPaul E. McKenney 12*5c587f9bSAkira Yokosawa{} 131c27b644SPaul E. McKenney 141c27b644SPaul E. McKenneyP0(int *x, int *y, spinlock_t *mylock) 151c27b644SPaul E. McKenney{ 161c27b644SPaul E. McKenney spin_lock(mylock); 171c27b644SPaul E. McKenney WRITE_ONCE(*x, 1); 181c27b644SPaul E. McKenney WRITE_ONCE(*y, 1); 191c27b644SPaul E. McKenney spin_unlock(mylock); 201c27b644SPaul E. McKenney} 211c27b644SPaul E. McKenney 221c27b644SPaul E. McKenneyP1(int *y, int *z, spinlock_t *mylock) 231c27b644SPaul E. McKenney{ 241c27b644SPaul E. McKenney int r0; 251c27b644SPaul E. McKenney 261c27b644SPaul E. McKenney spin_lock(mylock); 271c27b644SPaul E. McKenney smp_mb__after_spinlock(); 281c27b644SPaul E. McKenney r0 = READ_ONCE(*y); 291c27b644SPaul E. McKenney WRITE_ONCE(*z, 1); 301c27b644SPaul E. McKenney spin_unlock(mylock); 311c27b644SPaul E. McKenney} 321c27b644SPaul E. McKenney 331c27b644SPaul E. McKenneyP2(int *x, int *z) 341c27b644SPaul E. McKenney{ 351c27b644SPaul E. McKenney int r1; 361c27b644SPaul E. McKenney 371c27b644SPaul E. McKenney WRITE_ONCE(*z, 2); 381c27b644SPaul E. McKenney smp_mb(); 391c27b644SPaul E. McKenney r1 = READ_ONCE(*x); 401c27b644SPaul E. McKenney} 411c27b644SPaul E. McKenney 421c27b644SPaul E. McKenneyexists (1:r0=1 /\ z=2 /\ 2:r1=0) 43