0001 C MP+unlocklockonceonce+fencermbonceonce
0002
0003 (*
0004 * Result: Never
0005 *
0006 * If two locked critical sections execute on the same CPU, stores in the
0007 * first must propagate to each CPU before stores in the second do, even if
0008 * the critical sections are protected by different locks.
0009 *)
0010
0011 {}
0012
0013 P0(spinlock_t *s, spinlock_t *t, int *x, int *y)
0014 {
0015 spin_lock(s);
0016 WRITE_ONCE(*x, 1);
0017 spin_unlock(s);
0018 spin_lock(t);
0019 WRITE_ONCE(*y, 1);
0020 spin_unlock(t);
0021 }
0022
0023 P1(int *x, int *y)
0024 {
0025 int r1;
0026 int r2;
0027
0028 r1 = READ_ONCE(*y);
0029 smp_rmb();
0030 r2 = READ_ONCE(*x);
0031 }
0032
0033 exists (1:r1=1 /\ 1:r2=0)