RCU+sync+read.litmus 704 B

12345678910111213141516171819202122232425262728293031323334353637
  1. C RCU+sync+read
  2. (*
  3. * Result: Never
  4. *
  5. * This litmus test demonstrates that after a grace period, an RCU updater always
  6. * sees all stores done in prior RCU read-side critical sections. Such
  7. * read-side critical sections would have ended before the grace period ended.
  8. *
  9. * This is one implication of the RCU grace-period guarantee, which says (among
  10. * other things) that an RCU read-side critical section cannot span a grace period.
  11. *)
  12. {
  13. int x = 0;
  14. int y = 0;
  15. }
  16. P0(int *x, int *y)
  17. {
  18. rcu_read_lock();
  19. WRITE_ONCE(*x, 1);
  20. WRITE_ONCE(*y, 1);
  21. rcu_read_unlock();
  22. }
  23. P1(int *x, int *y)
  24. {
  25. int r0;
  26. int r1;
  27. r0 = READ_ONCE(*x);
  28. synchronize_rcu();
  29. r1 = READ_ONCE(*y);
  30. }
  31. exists (1:r0=1 /\ 1:r1=0)