2021-05-27 00:09:36 +05:00
|
|
|
C MP+fencewmbonceonce+fencermbonceonce
|
|
|
|
|
|
|
|
(*
|
|
|
|
* Result: Never
|
|
|
|
*
|
|
|
|
* This litmus test demonstrates that smp_wmb() and smp_rmb() provide
|
|
|
|
* sufficient ordering for the message-passing pattern. However, it
|
|
|
|
* is usually better to use smp_store_release() and smp_load_acquire().
|
|
|
|
*)
|
|
|
|
|
|
|
|
{}
|
|
|
|
|
2021-09-23 21:59:15 +05:00
|
|
|
P0(int *x, int *y)
|
2021-05-27 00:09:36 +05:00
|
|
|
{
|
2021-09-23 21:59:15 +05:00
|
|
|
WRITE_ONCE(*x, 1);
|
2021-05-27 00:09:36 +05:00
|
|
|
smp_wmb();
|
2021-09-23 21:59:15 +05:00
|
|
|
WRITE_ONCE(*y, 1);
|
2021-05-27 00:09:36 +05:00
|
|
|
}
|
|
|
|
|
2021-09-23 21:59:15 +05:00
|
|
|
P1(int *x, int *y)
|
2021-05-27 00:09:36 +05:00
|
|
|
{
|
|
|
|
int r0;
|
|
|
|
int r1;
|
|
|
|
|
2021-09-23 21:59:15 +05:00
|
|
|
r0 = READ_ONCE(*y);
|
2021-05-27 00:09:36 +05:00
|
|
|
smp_rmb();
|
2021-09-23 21:59:15 +05:00
|
|
|
r1 = READ_ONCE(*x);
|
2021-05-27 00:09:36 +05:00
|
|
|
}
|
|
|
|
|
2021-09-23 21:59:15 +05:00
|
|
|
exists (1:r0=1 /\ 1:r1=0)
|