blob: 5c06054f4694765dc5eb7fd6b332571a8f3170d3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
C cmpxchg-fail-ordered-2
(*
* Result: Never
*
* Demonstrate use of smp_mb__after_atomic() to make a failing cmpxchg
* operation have acquire ordering.
*)
{}
P0(int *x, int *y)
{
int r1;
WRITE_ONCE(*x, 1);
r1 = cmpxchg(y, 0, 1);
}
P1(int *x, int *y)
{
int r1;
int r2;
r1 = cmpxchg(y, 0, 1);
smp_mb__after_atomic();
r2 = READ_ONCE(*x);
}
exists (0:r1=0 /\ 1:r1=1 /\ 1:r2=0)
|