xref: /OK3568_Linux_fs/kernel/tools/memory-model/litmus-tests/S+poonceonces.litmus (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593SmuzhiyunC S+poonceonces
2*4882a593Smuzhiyun
3*4882a593Smuzhiyun(*
4*4882a593Smuzhiyun * Result: Sometimes
5*4882a593Smuzhiyun *
6*4882a593Smuzhiyun * Starting with a two-process release-acquire chain ordering P0()'s
7*4882a593Smuzhiyun * first store against P1()'s final load, if the smp_store_release()
8*4882a593Smuzhiyun * is replaced by WRITE_ONCE() and the smp_load_acquire() replaced by
9*4882a593Smuzhiyun * READ_ONCE(), is ordering preserved?
10*4882a593Smuzhiyun *)
11*4882a593Smuzhiyun
12*4882a593Smuzhiyun{}
13*4882a593Smuzhiyun
14*4882a593SmuzhiyunP0(int *x, int *y)
15*4882a593Smuzhiyun{
16*4882a593Smuzhiyun	WRITE_ONCE(*x, 2);
17*4882a593Smuzhiyun	WRITE_ONCE(*y, 1);
18*4882a593Smuzhiyun}
19*4882a593Smuzhiyun
20*4882a593SmuzhiyunP1(int *x, int *y)
21*4882a593Smuzhiyun{
22*4882a593Smuzhiyun	int r0;
23*4882a593Smuzhiyun
24*4882a593Smuzhiyun	r0 = READ_ONCE(*y);
25*4882a593Smuzhiyun	WRITE_ONCE(*x, 1);
26*4882a593Smuzhiyun}
27*4882a593Smuzhiyun
28*4882a593Smuzhiyunexists (x=2 /\ 1:r0=1)
29