0001 C Z6.0+pooncelock+poonceLock+pombonce
0002
0003 (*
0004 * Result: Never
0005 *
0006 * This litmus test demonstrates how smp_mb__after_spinlock() may be
0007 * used to ensure that accesses in different critical sections for a
0008 * given lock running on different CPUs are nevertheless seen in order
0009 * by CPUs not holding that lock.
0010 *)
0011
0012 {}
0013
0014 P0(int *x, int *y, spinlock_t *mylock)
0015 {
0016 spin_lock(mylock);
0017 WRITE_ONCE(*x, 1);
0018 WRITE_ONCE(*y, 1);
0019 spin_unlock(mylock);
0020 }
0021
0022 P1(int *y, int *z, spinlock_t *mylock)
0023 {
0024 int r0;
0025
0026 spin_lock(mylock);
0027 smp_mb__after_spinlock();
0028 r0 = READ_ONCE(*y);
0029 WRITE_ONCE(*z, 1);
0030 spin_unlock(mylock);
0031 }
0032
0033 P2(int *x, int *z)
0034 {
0035 int r1;
0036
0037 WRITE_ONCE(*z, 2);
0038 smp_mb();
0039 r1 = READ_ONCE(*x);
0040 }
0041
0042 exists (1:r0=1 /\ z=2 /\ 2:r1=0)