Back to home page

OSCL-LXR

 
 

    


0001 C RCU+sync+read
0002 
0003 (*
0004  * Result: Never
0005  *
0006  * This litmus test demonstrates that after a grace period, an RCU updater always
0007  * sees all stores done in prior RCU read-side critical sections. Such
0008  * read-side critical sections would have ended before the grace period ended.
0009  *
0010  * This is one implication of the RCU grace-period guarantee, which says (among
0011  * other things) that an RCU read-side critical section cannot span a grace period.
0012  *)
0013 
0014 {
0015 int x = 0;
0016 int y = 0;
0017 }
0018 
0019 P0(int *x, int *y)
0020 {
0021         rcu_read_lock();
0022         WRITE_ONCE(*x, 1);
0023         WRITE_ONCE(*y, 1);
0024         rcu_read_unlock();
0025 }
0026 
0027 P1(int *x, int *y)
0028 {
0029         int r0;
0030         int r1;
0031 
0032         r0 = READ_ONCE(*x);
0033         synchronize_rcu();
0034         r1 = READ_ONCE(*y);
0035 }
0036 
0037 exists (1:r0=1 /\ 1:r1=0)