xref: /kernel/linux/linux-5.10/tools/memory-model/litmus-tests/MP+fencewmbonceonce+fencermbonceonce.litmus
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /kernel/linux/linux-5.10/tools/memory-model/litmus-tests/
18c2ecf20Sopenharmony_ciC MP+fencewmbonceonce+fencermbonceonce
28c2ecf20Sopenharmony_ci
38c2ecf20Sopenharmony_ci(*
48c2ecf20Sopenharmony_ci * Result: Never
58c2ecf20Sopenharmony_ci *
68c2ecf20Sopenharmony_ci * This litmus test demonstrates that smp_wmb() and smp_rmb() provide
78c2ecf20Sopenharmony_ci * sufficient ordering for the message-passing pattern.  However, it
88c2ecf20Sopenharmony_ci * is usually better to use smp_store_release() and smp_load_acquire().
98c2ecf20Sopenharmony_ci *)
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci{}
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ciP0(int *x, int *y)
148c2ecf20Sopenharmony_ci{
158c2ecf20Sopenharmony_ci	WRITE_ONCE(*x, 1);
168c2ecf20Sopenharmony_ci	smp_wmb();
178c2ecf20Sopenharmony_ci	WRITE_ONCE(*y, 1);
188c2ecf20Sopenharmony_ci}
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ciP1(int *x, int *y)
218c2ecf20Sopenharmony_ci{
228c2ecf20Sopenharmony_ci	int r0;
238c2ecf20Sopenharmony_ci	int r1;
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci	r0 = READ_ONCE(*y);
268c2ecf20Sopenharmony_ci	smp_rmb();
278c2ecf20Sopenharmony_ci	r1 = READ_ONCE(*x);
288c2ecf20Sopenharmony_ci}
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ciexists (1:r0=1 /\ 1:r1=0)
31

Indexes created Thu Nov 07 10:32:03 CST 2024