Skip to content

Commit f6c8785

Browse files
paulmckrcuNeeraj Upadhyay (AMD)
authored andcommitted
rcutorture: Check for no up/down readers at task level
The design of testing of up/down readers such as srcu_down_read() and srcu_up_read() assumes that these are tested only by the rcu_torture_updown() kthread, and never by the rcu_torture_reader() kthread. Because we all know which road is paved with good intentions, this commit adds WARN_ON_ONCE() to verify that things are going to plan. Signed-off-by: Paul E. McKenney <[email protected]> Signed-off-by: Neeraj Upadhyay (AMD) <[email protected]>
1 parent 9385694 commit f6c8785

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

kernel/rcu/rcutorture.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2232,6 +2232,7 @@ rcutorture_loop_extend(int *readstate, bool insoftirq, struct torture_random_sta
22322232
i = ((i | (i >> 3)) & RCUTORTURE_RDR_MAX_LOOPS) + 1;
22332233
for (j = 0; j < i; j++) {
22342234
mask = rcutorture_extend_mask(*readstate, trsp);
2235+
WARN_ON_ONCE(mask & RCUTORTURE_RDR_UPDOWN);
22352236
rcutorture_one_extend(readstate, mask, insoftirq, trsp, &rtrsp[j]);
22362237
}
22372238
return &rtrsp[j];
@@ -2368,6 +2369,7 @@ static bool rcu_torture_one_read(struct torture_random_state *trsp, long myid)
23682369
WARN_ON_ONCE(!rcu_is_watching());
23692370
init_rcu_torture_one_read_state(&rtors, trsp);
23702371
newstate = rcutorture_extend_mask(rtors.readstate, trsp);
2372+
WARN_ON_ONCE(newstate & RCUTORTURE_RDR_UPDOWN);
23712373
rcutorture_one_extend(&rtors.readstate, newstate, myid < 0, trsp, rtors.rtrsp++);
23722374
if (!rcu_torture_one_read_start(&rtors, trsp, myid)) {
23732375
rcutorture_one_extend(&rtors.readstate, 0, myid < 0, trsp, rtors.rtrsp);

0 commit comments

Comments
 (0)