Link: https://lore.kernel.org/r/20260217200002.683975158@linuxfoundation.org Tested-by: Florian Fainelli <florian.fainelli@broadcom.com> Tested-by: Takeshi Ogasawara <takeshi.ogasawara@futuring-girl.com> Tested-by: Peter Schneider <pschneider1968@googlemail.com> Tested-by: Jon Hunter <jonathanh@nvidia.com> Tested-by: Salvatore Bonaccorso <carnil@debian.org> Tested-by: Brett A C Sheffield <bacs@librecast.net> Tested-by: Mark Brown <broonie@kernel.org> Tested-by: Luna Jernberg <droidbittin@gmail.com> Tested-by: Ronald Warsow <rwarsow@gmx.de> Tested-by: Justin M. Forbes <jforbes@fedoraproject.org> Tested-by: Ron Economos <re@w6rz.net> Tested-by: Miguel Ojeda <ojeda@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
32 lines
628 B
Plaintext
32 lines
628 B
Plaintext
C dep+plain
|
|
|
|
(*
|
|
* Result: Never
|
|
*
|
|
* This litmus test demonstrates that in LKMM, plain accesses
|
|
* carry dependencies much like accesses to registers:
|
|
* The data stored to *z1 and *z2 by P0() originates from P0()'s
|
|
* READ_ONCE(), and therefore using that data to compute the
|
|
* conditional of P0()'s if-statement creates a control dependency
|
|
* from that READ_ONCE() to P0()'s WRITE_ONCE().
|
|
*)
|
|
|
|
{}
|
|
|
|
P0(int *x, int *y, int *z1, int *z2)
|
|
{
|
|
int a = READ_ONCE(*x);
|
|
*z1 = a;
|
|
*z2 = *z1;
|
|
if (*z2 == 1)
|
|
WRITE_ONCE(*y, 1);
|
|
}
|
|
|
|
P1(int *x, int *y)
|
|
{
|
|
int r = smp_load_acquire(y);
|
|
smp_store_release(x, r);
|
|
}
|
|
|
|
exists (x=1 /\ y=1)
|