MP+polockonce+poacquiresilsil.litmus 639 B

12345678910111213141516171819202122232425262728293031323334
  1. C MP+polockonce+poacquiresilsil
  2. (*
  3. * Result: Sometimes
  4. *
  5. * Do spinlocks provide order to outside observers using spin_is_locked()
  6. * to sense the lock-held state, ordered by acquire? Note that when the
  7. * first spin_is_locked() returns false and the second true, we know that
  8. * the smp_load_acquire() executed before the lock was acquired (loosely
  9. * speaking).
  10. *)
  11. {
  12. }
  13. P0(spinlock_t *lo, int *x)
  14. {
  15. spin_lock(lo);
  16. WRITE_ONCE(*x, 1);
  17. spin_unlock(lo);
  18. }
  19. P1(spinlock_t *lo, int *x)
  20. {
  21. int r1;
  22. int r2;
  23. int r3;
  24. r1 = smp_load_acquire(x);
  25. r2 = spin_is_locked(lo);
  26. r3 = spin_is_locked(lo);
  27. }
  28. exists (1:r1=1 /\ 1:r2=0 /\ 1:r3=1)