MP+polockmbonce+poacquiresilsil.litmus 703 B

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