提交 967c298d 编写于 作者: P Paul E. McKenney

rcutorture: Limit read-side polling-API testing

RCU's polled grace-period API is reasonably lightweight, but still
contains heavyweight memory barriers.  This commit therefore limits
testing of this API from rcutorture's readers in order to avoid the
false negatives that these heavyweight operations could provoke.
Signed-off-by: NPaul E. McKenney <paulmck@kernel.org>
上级 18538248
...@@ -1903,6 +1903,7 @@ rcutorture_loop_extend(int *readstate, struct torture_random_state *trsp, ...@@ -1903,6 +1903,7 @@ rcutorture_loop_extend(int *readstate, struct torture_random_state *trsp,
*/ */
static bool rcu_torture_one_read(struct torture_random_state *trsp, long myid) static bool rcu_torture_one_read(struct torture_random_state *trsp, long myid)
{ {
bool checkpolling = !(torture_random(trsp) & 0xfff);
unsigned long cookie; unsigned long cookie;
struct rcu_gp_oldstate cookie_full; struct rcu_gp_oldstate cookie_full;
int i; int i;
...@@ -1920,10 +1921,12 @@ static bool rcu_torture_one_read(struct torture_random_state *trsp, long myid) ...@@ -1920,10 +1921,12 @@ static bool rcu_torture_one_read(struct torture_random_state *trsp, long myid)
WARN_ON_ONCE(!rcu_is_watching()); WARN_ON_ONCE(!rcu_is_watching());
newstate = rcutorture_extend_mask(readstate, trsp); newstate = rcutorture_extend_mask(readstate, trsp);
rcutorture_one_extend(&readstate, newstate, trsp, rtrsp++); rcutorture_one_extend(&readstate, newstate, trsp, rtrsp++);
if (cur_ops->get_gp_state && cur_ops->poll_gp_state) if (checkpolling) {
cookie = cur_ops->get_gp_state(); if (cur_ops->get_gp_state && cur_ops->poll_gp_state)
if (cur_ops->get_gp_state_full && cur_ops->poll_gp_state_full) cookie = cur_ops->get_gp_state();
cur_ops->get_gp_state_full(&cookie_full); if (cur_ops->get_gp_state_full && cur_ops->poll_gp_state_full)
cur_ops->get_gp_state_full(&cookie_full);
}
started = cur_ops->get_gp_seq(); started = cur_ops->get_gp_seq();
ts = rcu_trace_clock_local(); ts = rcu_trace_clock_local();
p = rcu_dereference_check(rcu_torture_current, p = rcu_dereference_check(rcu_torture_current,
...@@ -1957,20 +1960,22 @@ static bool rcu_torture_one_read(struct torture_random_state *trsp, long myid) ...@@ -1957,20 +1960,22 @@ static bool rcu_torture_one_read(struct torture_random_state *trsp, long myid)
} }
__this_cpu_inc(rcu_torture_batch[completed]); __this_cpu_inc(rcu_torture_batch[completed]);
preempt_enable(); preempt_enable();
if (cur_ops->get_gp_state && cur_ops->poll_gp_state) if (checkpolling) {
WARN_ONCE(cur_ops->poll_gp_state(cookie), if (cur_ops->get_gp_state && cur_ops->poll_gp_state)
"%s: Cookie check 2 failed %s(%d) %lu->%lu\n", WARN_ONCE(cur_ops->poll_gp_state(cookie),
__func__, "%s: Cookie check 2 failed %s(%d) %lu->%lu\n",
rcu_torture_writer_state_getname(), __func__,
rcu_torture_writer_state, rcu_torture_writer_state_getname(),
cookie, cur_ops->get_gp_state()); rcu_torture_writer_state,
if (cur_ops->get_gp_state_full && cur_ops->poll_gp_state_full) cookie, cur_ops->get_gp_state());
WARN_ONCE(cur_ops->poll_gp_state_full(&cookie_full), if (cur_ops->get_gp_state_full && cur_ops->poll_gp_state_full)
"%s: Cookie check 6 failed %s(%d) online %*pbl\n", WARN_ONCE(cur_ops->poll_gp_state_full(&cookie_full),
__func__, "%s: Cookie check 6 failed %s(%d) online %*pbl\n",
rcu_torture_writer_state_getname(), __func__,
rcu_torture_writer_state, rcu_torture_writer_state_getname(),
cpumask_pr_args(cpu_online_mask)); rcu_torture_writer_state,
cpumask_pr_args(cpu_online_mask));
}
rcutorture_one_extend(&readstate, 0, trsp, rtrsp); rcutorture_one_extend(&readstate, 0, trsp, rtrsp);
WARN_ON_ONCE(readstate); WARN_ON_ONCE(readstate);
// This next splat is expected behavior if leakpointer, especially // This next splat is expected behavior if leakpointer, especially
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册