0001 C Atomic-RMW+mb__after_atomic-is-stronger-than-acquire
0002
0003 (*
0004 * Result: Never
0005 *
0006 * Test that an atomic RMW followed by a smp_mb__after_atomic() is
0007 * stronger than a normal acquire: both the read and write parts of
0008 * the RMW are ordered before the subsequential memory accesses.
0009 *)
0010
0011 {
0012 }
0013
0014 P0(int *x, atomic_t *y)
0015 {
0016 int r0;
0017 int r1;
0018
0019 r0 = READ_ONCE(*x);
0020 smp_rmb();
0021 r1 = atomic_read(y);
0022 }
0023
0024 P1(int *x, atomic_t *y)
0025 {
0026 atomic_inc(y);
0027 smp_mb__after_atomic();
0028 WRITE_ONCE(*x, 1);
0029 }
0030
0031 exists
0032 (0:r0=1 /\ 0:r1=0)