1C Z6.0+pooncelock+poonceLock+pombonce 2 3(* 4 * Result: Never 5 * 6 * This litmus test demonstrates how smp_mb__after_spinlock() may be 7 * used to ensure that accesses in different critical sections for a 8 * given lock running on different CPUs are nevertheless seen in order 9 * by CPUs not holding that lock. 10 *) 11 12{ 13 spinlock_t mylock; 14 int x; 15 int y; 16 int z; 17} 18 19P0(int *x, int *y, spinlock_t *mylock) 20{ 21 spin_lock(mylock); 22 WRITE_ONCE(*x, 1); 23 WRITE_ONCE(*y, 1); 24 spin_unlock(mylock); 25} 26 27P1(int *y, int *z, spinlock_t *mylock) 28{ 29 int r0; 30 31 spin_lock(mylock); 32 smp_mb__after_spinlock(); 33 r0 = READ_ONCE(*y); 34 WRITE_ONCE(*z, 1); 35 spin_unlock(mylock); 36} 37 38P2(int *x, int *z) 39{ 40 int r1; 41 42 WRITE_ONCE(*z, 2); 43 smp_mb(); 44 r1 = READ_ONCE(*x); 45} 46 47exists (1:r0=1 /\ z=2 /\ 2:r1=0) 48