xref: /linux/tools/memory-model/litmus-tests/MP+pooncerelease+poacquireonce.litmus (revision d0034a7a4ac7fae708146ac0059b9c47a1543f0d)
11c27b644SPaul E. McKenneyC MP+pooncerelease+poacquireonce
21c27b644SPaul E. McKenney
38f32543bSPaul E. McKenney(*
48f32543bSPaul E. McKenney * Result: Never
58f32543bSPaul E. McKenney *
68f32543bSPaul E. McKenney * This litmus test demonstrates that smp_store_release() and
78f32543bSPaul E. McKenney * smp_load_acquire() provide sufficient ordering for the message-passing
88f32543bSPaul E. McKenney * pattern.
98f32543bSPaul E. McKenney *)
108f32543bSPaul E. McKenney
11*5c587f9bSAkira Yokosawa{}
121c27b644SPaul E. McKenney
13b6ff3084SPaul E. McKenneyP0(int *buf, int *flag) // Producer
141c27b644SPaul E. McKenney{
15acc4bdc5SPaul E. McKenney	WRITE_ONCE(*buf, 1);
16acc4bdc5SPaul E. McKenney	smp_store_release(flag, 1);
171c27b644SPaul E. McKenney}
181c27b644SPaul E. McKenney
19b6ff3084SPaul E. McKenneyP1(int *buf, int *flag) // Consumer
201c27b644SPaul E. McKenney{
211c27b644SPaul E. McKenney	int r0;
221c27b644SPaul E. McKenney	int r1;
231c27b644SPaul E. McKenney
24acc4bdc5SPaul E. McKenney	r0 = smp_load_acquire(flag);
25acc4bdc5SPaul E. McKenney	r1 = READ_ONCE(*buf);
261c27b644SPaul E. McKenney}
271c27b644SPaul E. McKenney
28b6ff3084SPaul E. McKenneyexists (1:r0=1 /\ 1:r1=0) (* Bad outcome. *)
29