Skip to content

Commit 967c298

Browse files
committed
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: Paul E. McKenney <[email protected]>
1 parent 1853824 commit 967c298

File tree

1 file changed

+23
-18
lines changed

1 file changed

+23
-18
lines changed

kernel/rcu/rcutorture.c

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1903,6 +1903,7 @@ rcutorture_loop_extend(int *readstate, struct torture_random_state *trsp,
19031903
*/
19041904
static bool rcu_torture_one_read(struct torture_random_state *trsp, long myid)
19051905
{
1906+
bool checkpolling = !(torture_random(trsp) & 0xfff);
19061907
unsigned long cookie;
19071908
struct rcu_gp_oldstate cookie_full;
19081909
int i;
@@ -1920,10 +1921,12 @@ static bool rcu_torture_one_read(struct torture_random_state *trsp, long myid)
19201921
WARN_ON_ONCE(!rcu_is_watching());
19211922
newstate = rcutorture_extend_mask(readstate, trsp);
19221923
rcutorture_one_extend(&readstate, newstate, trsp, rtrsp++);
1923-
if (cur_ops->get_gp_state && cur_ops->poll_gp_state)
1924-
cookie = cur_ops->get_gp_state();
1925-
if (cur_ops->get_gp_state_full && cur_ops->poll_gp_state_full)
1926-
cur_ops->get_gp_state_full(&cookie_full);
1924+
if (checkpolling) {
1925+
if (cur_ops->get_gp_state && cur_ops->poll_gp_state)
1926+
cookie = cur_ops->get_gp_state();
1927+
if (cur_ops->get_gp_state_full && cur_ops->poll_gp_state_full)
1928+
cur_ops->get_gp_state_full(&cookie_full);
1929+
}
19271930
started = cur_ops->get_gp_seq();
19281931
ts = rcu_trace_clock_local();
19291932
p = rcu_dereference_check(rcu_torture_current,
@@ -1957,20 +1960,22 @@ static bool rcu_torture_one_read(struct torture_random_state *trsp, long myid)
19571960
}
19581961
__this_cpu_inc(rcu_torture_batch[completed]);
19591962
preempt_enable();
1960-
if (cur_ops->get_gp_state && cur_ops->poll_gp_state)
1961-
WARN_ONCE(cur_ops->poll_gp_state(cookie),
1962-
"%s: Cookie check 2 failed %s(%d) %lu->%lu\n",
1963-
__func__,
1964-
rcu_torture_writer_state_getname(),
1965-
rcu_torture_writer_state,
1966-
cookie, cur_ops->get_gp_state());
1967-
if (cur_ops->get_gp_state_full && cur_ops->poll_gp_state_full)
1968-
WARN_ONCE(cur_ops->poll_gp_state_full(&cookie_full),
1969-
"%s: Cookie check 6 failed %s(%d) online %*pbl\n",
1970-
__func__,
1971-
rcu_torture_writer_state_getname(),
1972-
rcu_torture_writer_state,
1973-
cpumask_pr_args(cpu_online_mask));
1963+
if (checkpolling) {
1964+
if (cur_ops->get_gp_state && cur_ops->poll_gp_state)
1965+
WARN_ONCE(cur_ops->poll_gp_state(cookie),
1966+
"%s: Cookie check 2 failed %s(%d) %lu->%lu\n",
1967+
__func__,
1968+
rcu_torture_writer_state_getname(),
1969+
rcu_torture_writer_state,
1970+
cookie, cur_ops->get_gp_state());
1971+
if (cur_ops->get_gp_state_full && cur_ops->poll_gp_state_full)
1972+
WARN_ONCE(cur_ops->poll_gp_state_full(&cookie_full),
1973+
"%s: Cookie check 6 failed %s(%d) online %*pbl\n",
1974+
__func__,
1975+
rcu_torture_writer_state_getname(),
1976+
rcu_torture_writer_state,
1977+
cpumask_pr_args(cpu_online_mask));
1978+
}
19741979
rcutorture_one_extend(&readstate, 0, trsp, rtrsp);
19751980
WARN_ON_ONCE(readstate);
19761981
// This next splat is expected behavior if leakpointer, especially

0 commit comments

Comments
 (0)