ISA2+pooncelock+pooncelock+pombonce.litmus 645 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. C ISA2+pooncelock+pooncelock+pombonce
  2. (*
  3. * Result: Sometimes
  4. *
  5. * This test shows that the ordering provided by a lock-protected S
  6. * litmus test (P0() and P1()) are not visible to external process P2().
  7. * This is likely to change soon.
  8. *)
  9. {}
  10. P0(int *x, int *y, spinlock_t *mylock)
  11. {
  12. spin_lock(mylock);
  13. WRITE_ONCE(*x, 1);
  14. WRITE_ONCE(*y, 1);
  15. spin_unlock(mylock);
  16. }
  17. P1(int *y, int *z, spinlock_t *mylock)
  18. {
  19. int r0;
  20. spin_lock(mylock);
  21. r0 = READ_ONCE(*y);
  22. WRITE_ONCE(*z, 1);
  23. spin_unlock(mylock);
  24. }
  25. P2(int *x, int *z)
  26. {
  27. int r1;
  28. int r2;
  29. r2 = READ_ONCE(*z);
  30. smp_mb();
  31. r1 = READ_ONCE(*x);
  32. }
  33. exists (1:r0=1 /\ 2:r2=1 /\ 2:r1=0)