From 38828d44f31e4366b2963d5786d06d3358e8ae58 Mon Sep 17 00:00:00 2001 From: Song Liu Date: Tue, 10 Nov 2026 21:35:51 -0800 Subject: rcu-tasks: Use pr_debug() for callback contend/collapse messages Commit 5de907d24919 ("rcu-tasks: Disable callback contend/collapse messages by default") added the rcupdate.rcu_task_collapse_debug module parameter to gate the three pr_info() messages that report RCU Tasks switching between CPU-0 and per-CPU callback queuing. The kernel already has a mechanism for debug-only messages that are off by default: pr_debug(). Use pr_debug() for these messages, and remove the rcu_task_collapse_debug module parameter, its documentation, and its boot-time announcement. The messages stay off by default. On CONFIG_DYNAMIC_DEBUG=y kernels, they can be enabled at boot with: dyndbg="file kernel/rcu/tasks.h +p" or at runtime with: echo 'file kernel/rcu/tasks.h +p' > /proc/dynamic_debug/control Assisted-by: Claude:claude-opus-5 Signed-off-by: Song Liu Reviewed-by: Joel Fernandes Reviewed-by: Paul E. McKenney Tested-by: Breno Leitao Signed-off-by: Joel Fernandes --- Documentation/admin-guide/kernel-parameters.txt | 7 ------- kernel/rcu/tasks.h | 15 +++------------ 2 files changed, 3 insertions(+), 19 deletions(-) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index 0b3c140babd9..176648941aec 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -6369,13 +6369,6 @@ Kernel parameters period to instead use normal non-expedited grace-period processing. - rcupdate.rcu_task_collapse_debug= [KNL] - Enable debugging prints that record when RCU Tasks - and RCU Tasks Trace expand to per-CPU callback - queuing and collapse back to CPU-0 queuing. - This is default-disabled due to the fact that - some workloads can make it quite noisy. - rcupdate.rcu_task_collapse_lim= [KNL] Set the maximum number of callbacks present at the beginning of a grace period that allows diff --git a/kernel/rcu/tasks.h b/kernel/rcu/tasks.h index fcac7361ec51..743f777b4c18 100644 --- a/kernel/rcu/tasks.h +++ b/kernel/rcu/tasks.h @@ -178,8 +178,6 @@ static int rcu_task_contend_lim __read_mostly = 100; module_param(rcu_task_contend_lim, int, 0444); static int rcu_task_collapse_lim __read_mostly = 10; module_param(rcu_task_collapse_lim, int, 0444); -static bool rcu_task_collapse_debug __read_mostly; -module_param(rcu_task_collapse_debug, bool, 0644); static int rcu_task_lazy_lim __read_mostly = 32; module_param(rcu_task_lazy_lim, int, 0444); @@ -392,8 +390,7 @@ static void call_rcu_tasks_generic(struct rcu_head *rhp, rcu_callback_t func, WRITE_ONCE(rtp->percpu_enqueue_shift, 0); WRITE_ONCE(rtp->percpu_dequeue_lim, rcu_task_cpu_ids); smp_store_release(&rtp->percpu_enqueue_lim, rcu_task_cpu_ids); - if (data_race(rcu_task_collapse_debug)) - pr_info("Switching %s to per-CPU callback queuing.\n", rtp->name); + pr_debug("Switching %s to per-CPU callback queuing.\n", rtp->name); } raw_spin_unlock_irqrestore(&rtp->cbs_gbl_lock, flags); } @@ -514,9 +511,7 @@ static int rcu_tasks_need_gpcb(struct rcu_tasks *rtp) smp_store_release(&rtp->percpu_enqueue_lim, 1); rtp->percpu_dequeue_gpseq = get_state_synchronize_rcu(); gpdone = false; - if (data_race(rcu_task_collapse_debug)) - pr_info("Starting switch %s to CPU-0 callback queuing.\n", - rtp->name); + pr_debug("Starting switch %s to CPU-0 callback queuing.\n", rtp->name); } raw_spin_unlock_irqrestore(&rtp->cbs_gbl_lock, flags); } @@ -524,9 +519,7 @@ static int rcu_tasks_need_gpcb(struct rcu_tasks *rtp) raw_spin_lock_irqsave(&rtp->cbs_gbl_lock, flags); if (rtp->percpu_enqueue_lim < rtp->percpu_dequeue_lim) { WRITE_ONCE(rtp->percpu_dequeue_lim, 1); - if (data_race(rcu_task_collapse_debug)) - pr_info("Completing switch %s to CPU-0 callback queuing.\n", - rtp->name); + pr_debug("Completing switch %s to CPU-0 callback queuing.\n", rtp->name); } if (rtp->percpu_dequeue_lim == 1) { for (cpu = rtp->percpu_dequeue_lim; cpu < rcu_task_cpu_ids; cpu++) { @@ -711,8 +704,6 @@ static void __init rcu_tasks_bootup_oddness(void) pr_info("\tTasks-RCU CPU stall info multiplier clamped to %d (rcu_task_stall_info_mult).\n", rtsimc); rcu_task_stall_info_mult = rtsimc; } - if (rcu_task_collapse_debug) - pr_info("\tTasks-RCU callback contend/collapse debug enabled.\n"); #endif /* #ifdef CONFIG_TASKS_RCU */ #ifdef CONFIG_TASKS_RCU pr_info("\tTrampoline variant of Tasks RCU enabled.\n"); -- cgit v1.3.1-4-g156e From c3f98ff6309a29979e1867bc3c9d4172755ca122 Mon Sep 17 00:00:00 2001 From: Nathan Chancellor Date: Sat, 14 Nov 2026 21:26:10 -0700 Subject: rcu/nocb: Avoid unsequenced accesses to jiffies in show_rcu_nocb_state() After a recent improvement in clang to warn on unsequenced accesses to volatile variables [1], an instance appears in show_rcu_nocb_state(), which can break the build with CONFIG_WERROR=y / W=e: In file included from kernel/rcu/tree.c:5123: kernel/rcu/tree_nocb.h:1651:3: error: unsequenced accesses to volatile qualified 'jiffies' [-Werror,-Wunsequenced] 1650 | jiffies - rdp->nocb_bypass_first, | ~~~~~~~ 1651 | jiffies - rdp->nocb_nobypass_last, | ^ Per C11 5.1.2.3.2, accessing a volatile object is a side effect. Per C11 6.5.2, unsequenced side effects on the same scalar object are undefined behavior. Per C11 6.5.2.2.10/12, the evaluation of arguments in a function call is indeterminately sequenced, meaning any side effects in the arguments are unsequenced. Add a local variable to hold the value of jiffies before the function call so that there are no unsequenced side effects, clearing up the warning. Cc: stable@vger.kernel.org Fixes: f7a81b12d6af ("rcu/nocb: Print no-CBs diagnostics when rcutorture writer unduly delayed") Closes: https://github.com/ClangBuiltLinux/linux/issues/2192 Link: https://github.com/llvm/llvm-project/commit/955715460eaf9188c241c74750637fc82dfcc423 [1] Signed-off-by: Nathan Chancellor Reviewed-by: Joel Fernandes Signed-off-by: Joel Fernandes --- kernel/rcu/tree_nocb.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/kernel/rcu/tree_nocb.h b/kernel/rcu/tree_nocb.h index b6cfee4e5039..8448a7c578e8 100644 --- a/kernel/rcu/tree_nocb.h +++ b/kernel/rcu/tree_nocb.h @@ -1618,6 +1618,7 @@ static void show_rcu_nocb_state(struct rcu_data *rdp) struct rcu_segcblist *rsclp = &rdp->cblist; bool waslocked; bool wassleep; + unsigned long j; if (rdp->nocb_gp_rdp == rdp) show_rcu_nocb_gp_state(rdp); @@ -1639,6 +1640,7 @@ static void show_rcu_nocb_state(struct rcu_data *rdp) rsclp->gp_seq[RCU_NEXT_READY_TAIL].exp); sprintf(bufn, "%ld", rsclp->seglen[RCU_NEXT_TAIL]); sprintf(bufb, "%ld", rcu_cblist_n_cbs(&rdp->nocb_bypass)); + j = jiffies; pr_info(" CB %d^%d->%d %c%c%c%c%c F%ld L%ld C%d %c%s%c%s%c%s%c%s%c%s q%ld %c CPU %d%s\n", rdp->cpu, rdp->nocb_gp_rdp->cpu, nocb_next_rdp ? nocb_next_rdp->cpu : -1, @@ -1647,8 +1649,8 @@ static void show_rcu_nocb_state(struct rcu_data *rdp) "lL"[raw_spin_is_locked(&rdp->nocb_lock)], "sS"[!!rdp->nocb_cb_sleep], ".W"[swait_active(&rdp->nocb_cb_wq)], - jiffies - rdp->nocb_bypass_first, - jiffies - rdp->nocb_nobypass_last, + j - rdp->nocb_bypass_first, + j - rdp->nocb_nobypass_last, rdp->nocb_nobypass_count, ".D"[rcu_segcblist_ready_cbs(rsclp)], rcu_segcblist_segempty(rsclp, RCU_DONE_TAIL) ? "" : bufd, -- cgit v1.3.1-4-g156e