diff options
author | 2024-10-16 09:50:40 -0700 | |
---|---|---|
committer | 2024-12-14 17:02:11 +0100 | |
commit | 579a05da40a4980870a13d30cd0532f77aa15b8b (patch) | |
tree | 5f18f6d61fb4d8a085516c2d68d6d33815fc7d9b /kernel/rcu/rcutorture.c | |
parent | rcutorture: Make the TREE03 scenario do preemption (diff) | |
download | wireguard-linux-579a05da40a4980870a13d30cd0532f77aa15b8b.tar.xz wireguard-linux-579a05da40a4980870a13d30cd0532f77aa15b8b.zip |
rcutorture: Decorate failing reader segments with CPU ID
This commit adds CPU number to the "Failure/close-call rcutorture reader
segments" list printed at the end of an rcutorture run that had too-short
grace periods. This information can help debugging interactions with
migration and CPU hotplug.
However, experience indicates that sampling the CPU number in rcutorture's
read-side code can reduce the probability of too-short bugs by a small
integer factor. And small integer factors are crucial to RCU bug hunting,
so this commit also introduces a default-off RCU_TORTURE_TEST_LOG_CPU
Kconfig option to enable this CPU-number-logging functionality at
build time.
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
Diffstat (limited to 'kernel/rcu/rcutorture.c')
-rw-r--r-- | kernel/rcu/rcutorture.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c index 99780a74da44..0bc6fc582215 100644 --- a/kernel/rcu/rcutorture.c +++ b/kernel/rcu/rcutorture.c @@ -262,6 +262,7 @@ struct rt_read_seg { unsigned long rt_delay_ms; unsigned long rt_delay_us; bool rt_preempted; + int rt_cpu; }; static int err_segs_recorded; static struct rt_read_seg err_segs[RCUTORTURE_RDR_MAX_SEGS]; @@ -1862,6 +1863,8 @@ static void rcutorture_one_extend(int *readstate, int newstate, WARN_ON_ONCE(idxold2 < 0); WARN_ON_ONCE(idxold2 & ~RCUTORTURE_RDR_ALLBITS); rtrsp->rt_readstate = newstate; + if (IS_ENABLED(CONFIG_RCU_TORTURE_TEST_LOG_CPU)) + rtrsp->rt_cpu = raw_smp_processor_id(); /* First, put new protection in place to avoid critical-section gap. */ if (statesnew & RCUTORTURE_RDR_BH) @@ -3559,8 +3562,10 @@ rcu_torture_cleanup(void) err_segs[i].rt_delay_us); firsttime = 0; } - pr_cont("%s\n", - err_segs[i].rt_preempted ? "preempted" : ""); + pr_cont("%s", err_segs[i].rt_preempted ? "preempted" : ""); + if (IS_ENABLED(CONFIG_RCU_TORTURE_TEST_LOG_CPU)) + pr_cont(" CPU %d", err_segs[i].rt_cpu); + pr_cont("\n"); } } |