summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul E. McKenney <paulmck@kernel.org>2024-11-13 19:10:19 -0800
committerUladzislau Rezki (Sony) <urezki@gmail.com>2024-12-14 17:05:52 +0100
commit223f16b87d70a62058d3b3f4aae0da570b4380a1 (patch)
tree905b14ef82a591e5db7ab99ce0399e8e24f4e83b
parent885a6f4729c688c50bb2f470dfcc0ad0dea43c1e (diff)
rcutorture: Add per-reader-segment preemption diagnostics
For preemptible RCU, this commit adds an indication for each reader segments to whether the rcu_torture_reader() task was on the ->blkd_tasks lists, though only in kernels built with CONFIG_RCU_TORTURE_TEST_LOG_CPU=y. Signed-off-by: Paul E. McKenney <paulmck@kernel.org> Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
-rw-r--r--kernel/rcu/rcutorture.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c
index ab354bb7f1b6..41b661bf000a 100644
--- a/kernel/rcu/rcutorture.c
+++ b/kernel/rcu/rcutorture.c
@@ -464,10 +464,8 @@ rcu_read_delay(struct torture_random_state *rrsp, struct rt_read_seg *rtrsp)
rtrsp->rt_delay_us = shortdelay_us;
}
if (!preempt_count() &&
- !(torture_random(rrsp) % (nrealreaders * 500))) {
+ !(torture_random(rrsp) % (nrealreaders * 500)))
torture_preempt_schedule(); /* QS only if preemptible. */
- rtrsp->rt_preempted = true;
- }
}
static void rcu_torture_read_unlock(int idx)
@@ -1961,8 +1959,11 @@ static void rcutorture_one_extend(int *readstate, int newstate, bool insoftirq,
if (IS_ENABLED(CONFIG_RCU_TORTURE_TEST_LOG_CPU)) {
int cpu = raw_smp_processor_id();
rtrsp->rt_cpu = cpu;
- if (!first)
+ if (!first) {
rtrsp[-1].rt_end_cpu = cpu;
+ if (cur_ops->reader_blocked)
+ rtrsp[-1].rt_preempted = cur_ops->reader_blocked();
+ }
}
/*