mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-17 10:46:33 +00:00
acc4bdc55d
The use of "x" and "y" for message-passing tests is fine for people familiar with memory models and litmus-test nomenclature, but is a bit obtuse for others. This commit therefore substitutes "buf" for "x" and "flag" for "y" for the MP tests. There are a few special-case MP tests that use locks and these are unchanged. There is another MP test that uses pointers, and this is changed to name the pointer "p". Reported-by: Johannes Weiner <hannes@cmpxchg.org> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
36 lines
574 B
Plaintext
36 lines
574 B
Plaintext
C MP+onceassign+derefonce
|
|
|
|
(*
|
|
* Result: Never
|
|
*
|
|
* This litmus test demonstrates that rcu_assign_pointer() and
|
|
* rcu_dereference() suffice to ensure that an RCU reader will not see
|
|
* pre-initialization garbage when it traverses an RCU-protected data
|
|
* structure containing a newly inserted element.
|
|
*)
|
|
|
|
{
|
|
int *p=y;
|
|
int x;
|
|
int y=0;
|
|
}
|
|
|
|
P0(int *x, int **p)
|
|
{
|
|
WRITE_ONCE(*x, 1);
|
|
rcu_assign_pointer(*p, x);
|
|
}
|
|
|
|
P1(int *x, int **p)
|
|
{
|
|
int *r0;
|
|
int r1;
|
|
|
|
rcu_read_lock();
|
|
r0 = rcu_dereference(*p);
|
|
r1 = READ_ONCE(*r0);
|
|
rcu_read_unlock();
|
|
}
|
|
|
|
exists (1:r0=x /\ 1:r1=0)
|