Skip to content

Commit 1dd01c0

Browse files
paulmckrcuNeeraj Upadhyay
authored andcommitted
rcu: Summarize RCU CPU stall warnings during CSD-lock stalls
During CSD-lock stalls, the additional information output by RCU CPU stall warnings is usually redundant, flooding the console for not good reason. However, this has been the way things work for a few years. This commit therefore adds an rcutree.csd_lock_suppress_rcu_stall kernel boot parameter that causes RCU CPU stall warnings to be abbreviated to a single line when there is at least one CPU that has been stuck waiting for CSD lock for more than five seconds. To make this abbreviated message happen with decent probability: tools/testing/selftests/rcutorture/bin/kvm.sh --allcpus --duration 8 \ --configs "2*TREE01" --kconfig "CONFIG_CSD_LOCK_WAIT_DEBUG=y" \ --bootargs "csdlock_debug=1 rcutorture.stall_cpu=200 \ rcutorture.stall_cpu_holdoff=120 rcutorture.stall_cpu_irqsoff=1 \ rcutree.csd_lock_suppress_rcu_stall=1 \ rcupdate.rcu_exp_cpu_stall_timeout=5000" --trust-make [ paulmck: Apply kernel test robot feedback. ] Signed-off-by: Paul E. McKenney <[email protected]> Signed-off-by: Neeraj Upadhyay <[email protected]>
1 parent 9fbaa44 commit 1dd01c0

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

Documentation/admin-guide/kernel-parameters.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4937,6 +4937,10 @@
49374937
Set maximum number of finished RCU callbacks to
49384938
process in one batch.
49394939

4940+
rcutree.csd_lock_suppress_rcu_stall= [KNL]
4941+
Do only a one-line RCU CPU stall warning when
4942+
there is an ongoing too-long CSD-lock wait.
4943+
49404944
rcutree.do_rcu_barrier= [KNL]
49414945
Request a call to rcu_barrier(). This is
49424946
throttled so that userspace tests can safely

kernel/rcu/tree_stall.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
#include <linux/kvm_para.h>
1111
#include <linux/rcu_notifier.h>
12+
#include <linux/smp.h>
1213

1314
//////////////////////////////////////////////////////////////////////////////
1415
//
@@ -719,6 +720,9 @@ static void print_cpu_stall(unsigned long gps)
719720
set_preempt_need_resched();
720721
}
721722

723+
static bool csd_lock_suppress_rcu_stall;
724+
module_param(csd_lock_suppress_rcu_stall, bool, 0644);
725+
722726
static void check_cpu_stall(struct rcu_data *rdp)
723727
{
724728
bool self_detected;
@@ -791,7 +795,9 @@ static void check_cpu_stall(struct rcu_data *rdp)
791795
return;
792796

793797
rcu_stall_notifier_call_chain(RCU_STALL_NOTIFY_NORM, (void *)j - gps);
794-
if (self_detected) {
798+
if (READ_ONCE(csd_lock_suppress_rcu_stall) && csd_lock_is_stuck()) {
799+
pr_err("INFO: %s detected stall, but suppressed full report due to a stuck CSD-lock.\n", rcu_state.name);
800+
} else if (self_detected) {
795801
/* We haven't checked in, so go dump stack. */
796802
print_cpu_stall(gps);
797803
} else {

0 commit comments

Comments
 (0)