Back to home page

OSCL-LXR

 
 

    


0001 C ISA2+pooncelock+pooncelock+pombonce
0002 
0003 (*
0004  * Result: Never
0005  *
0006  * This test shows that write-write ordering provided by locks
0007  * (in P0() and P1()) is visible to external process P2().
0008  *)
0009 
0010 {}
0011 
0012 P0(int *x, int *y, spinlock_t *mylock)
0013 {
0014         spin_lock(mylock);
0015         WRITE_ONCE(*x, 1);
0016         WRITE_ONCE(*y, 1);
0017         spin_unlock(mylock);
0018 }
0019 
0020 P1(int *y, int *z, spinlock_t *mylock)
0021 {
0022         int r0;
0023 
0024         spin_lock(mylock);
0025         r0 = READ_ONCE(*y);
0026         WRITE_ONCE(*z, 1);
0027         spin_unlock(mylock);
0028 }
0029 
0030 P2(int *x, int *z)
0031 {
0032         int r1;
0033         int r2;
0034 
0035         r2 = READ_ONCE(*z);
0036         smp_mb();
0037         r1 = READ_ONCE(*x);
0038 }
0039 
0040 exists (1:r0=1 /\ 2:r2=1 /\ 2:r1=0)