6 * This litmus test demonstrates how lock acquisitions and releases can
7 * stand in for smp_load_acquire() and smp_store_release(), respectively.
8 * In other words, when holding a given lock (or indeed after releasing a
9 * given lock), a CPU is not only guaranteed to see the accesses that other
10 * CPUs made while previously holding that lock, it is also guaranteed
11 * to see all prior accesses by those other CPUs.
20 P0(int *buf, int *flag, spinlock_t *mylock) // Producer
28 P1(int *buf, int *flag, spinlock_t *mylock) // Consumer
34 r0 = READ_ONCE(*flag);
39 exists (1:r0=1 /\ 1:r1=0) (* Bad outcome. *)