IRIW+fencembonceonces+OnceOnce.litmus 731 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. C IRIW+fencembonceonces+OnceOnce
  2. (*
  3. * Result: Never
  4. *
  5. * Test of independent reads from independent writes with smp_mb()
  6. * between each pairs of reads. In other words, is smp_mb() sufficient to
  7. * cause two different reading processes to agree on the order of a pair
  8. * of writes, where each write is to a different variable by a different
  9. * process? This litmus test exercises LKMM's "propagation" rule.
  10. *)
  11. {}
  12. P0(int *x)
  13. {
  14. WRITE_ONCE(*x, 1);
  15. }
  16. P1(int *x, int *y)
  17. {
  18. int r0;
  19. int r1;
  20. r0 = READ_ONCE(*x);
  21. smp_mb();
  22. r1 = READ_ONCE(*y);
  23. }
  24. P2(int *y)
  25. {
  26. WRITE_ONCE(*y, 1);
  27. }
  28. P3(int *x, int *y)
  29. {
  30. int r0;
  31. int r1;
  32. r0 = READ_ONCE(*y);
  33. smp_mb();
  34. r1 = READ_ONCE(*x);
  35. }
  36. exists (1:r0=1 /\ 1:r1=0 /\ 3:r0=1 /\ 3:r1=0)