162306a36Sopenharmony_ciC LB+unlocklockonceonce+poacquireonce
262306a36Sopenharmony_ci
362306a36Sopenharmony_ci(*
462306a36Sopenharmony_ci * Result: Never
562306a36Sopenharmony_ci *
662306a36Sopenharmony_ci * If two locked critical sections execute on the same CPU, all accesses
762306a36Sopenharmony_ci * in the first must execute before any accesses in the second, even if the
862306a36Sopenharmony_ci * critical sections are protected by different locks.  Note: Even when a
962306a36Sopenharmony_ci * write executes before a read, their memory effects can be reordered from
1062306a36Sopenharmony_ci * the viewpoint of another CPU (the kind of reordering allowed by TSO).
1162306a36Sopenharmony_ci *)
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ci{}
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ciP0(spinlock_t *s, spinlock_t *t, int *x, int *y)
1662306a36Sopenharmony_ci{
1762306a36Sopenharmony_ci	int r1;
1862306a36Sopenharmony_ci
1962306a36Sopenharmony_ci	spin_lock(s);
2062306a36Sopenharmony_ci	r1 = READ_ONCE(*x);
2162306a36Sopenharmony_ci	spin_unlock(s);
2262306a36Sopenharmony_ci	spin_lock(t);
2362306a36Sopenharmony_ci	WRITE_ONCE(*y, 1);
2462306a36Sopenharmony_ci	spin_unlock(t);
2562306a36Sopenharmony_ci}
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_ciP1(int *x, int *y)
2862306a36Sopenharmony_ci{
2962306a36Sopenharmony_ci	int r2;
3062306a36Sopenharmony_ci
3162306a36Sopenharmony_ci	r2 = smp_load_acquire(y);
3262306a36Sopenharmony_ci	WRITE_ONCE(*x, 1);
3362306a36Sopenharmony_ci}
3462306a36Sopenharmony_ci
3562306a36Sopenharmony_ciexists (0:r1=1 /\ 1:r2=1)
36