diff options
| author | Paul E. McKenney <paulmck@kernel.org> | 2025-05-08 16:45:00 -0700 |
|---|---|---|
| committer | Neeraj Upadhyay (AMD) <neeraj.upadhyay@kernel.org> | 2025-06-25 08:39:01 +0530 |
| commit | f6c8785f50443db4c70faebfc22e59e8064c35a5 (patch) | |
| tree | 09de4a6c58f62d7020dc62f85ebac1ee56cc6b93 /kernel | |
| parent | rcutorture: Check for ->up_read() without matching ->down_read() (diff) | |
| download | linux-f6c8785f50443db4c70faebfc22e59e8064c35a5.tar.gz linux-f6c8785f50443db4c70faebfc22e59e8064c35a5.zip | |
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 <paulmck@kernel.org>
Signed-off-by: Neeraj Upadhyay (AMD) <neeraj.upadhyay@kernel.org>
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/rcu/rcutorture.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c index f773d4f8f2ae..10f3cc4861ee 100644 --- a/kernel/rcu/rcutorture.c +++ b/kernel/rcu/rcutorture.c @@ -2232,6 +2232,7 @@ rcutorture_loop_extend(int *readstate, bool insoftirq, struct torture_random_sta i = ((i | (i >> 3)) & RCUTORTURE_RDR_MAX_LOOPS) + 1; for (j = 0; j < i; j++) { mask = rcutorture_extend_mask(*readstate, trsp); + WARN_ON_ONCE(mask & RCUTORTURE_RDR_UPDOWN); rcutorture_one_extend(readstate, mask, insoftirq, trsp, &rtrsp[j]); } return &rtrsp[j]; @@ -2368,6 +2369,7 @@ static bool rcu_torture_one_read(struct torture_random_state *trsp, long myid) WARN_ON_ONCE(!rcu_is_watching()); init_rcu_torture_one_read_state(&rtors, trsp); newstate = rcutorture_extend_mask(rtors.readstate, trsp); + WARN_ON_ONCE(newstate & RCUTORTURE_RDR_UPDOWN); rcutorture_one_extend(&rtors.readstate, newstate, myid < 0, trsp, rtors.rtrsp++); if (!rcu_torture_one_read_start(&rtors, trsp, myid)) { rcutorture_one_extend(&rtors.readstate, 0, myid < 0, trsp, rtors.rtrsp); |
