SB+fencembonceonces.litmus 499 B

1234567891011121314151617181920212223242526272829303132
  1. C SB+fencembonceonces
  2. (*
  3. * Result: Never
  4. *
  5. * This litmus test demonstrates that full memory barriers suffice to
  6. * order the store-buffering pattern, where each process writes to the
  7. * variable that the preceding process reads. (Locking and RCU can also
  8. * suffice, but not much else.)
  9. *)
  10. {}
  11. P0(int *x, int *y)
  12. {
  13. int r0;
  14. WRITE_ONCE(*x, 1);
  15. smp_mb();
  16. r0 = READ_ONCE(*y);
  17. }
  18. P1(int *x, int *y)
  19. {
  20. int r0;
  21. WRITE_ONCE(*y, 1);
  22. smp_mb();
  23. r0 = READ_ONCE(*x);
  24. }
  25. exists (0:r0=0 /\ 1:r0=0)