Atomic-RMW+mb__after_atomic-is-stronger-than-acquire.litmus 508 B

1234567891011121314151617181920212223242526272829303132
  1. C Atomic-RMW+mb__after_atomic-is-stronger-than-acquire
  2. (*
  3. * Result: Never
  4. *
  5. * Test that an atomic RMW followed by a smp_mb__after_atomic() is
  6. * stronger than a normal acquire: both the read and write parts of
  7. * the RMW are ordered before the subsequential memory accesses.
  8. *)
  9. {
  10. }
  11. P0(int *x, atomic_t *y)
  12. {
  13. int r0;
  14. int r1;
  15. r0 = READ_ONCE(*x);
  16. smp_rmb();
  17. r1 = atomic_read(y);
  18. }
  19. P1(int *x, atomic_t *y)
  20. {
  21. atomic_inc(y);
  22. smp_mb__after_atomic();
  23. WRITE_ONCE(*x, 1);
  24. }
  25. exists
  26. (0:r0=1 /\ 0:r1=0)