Skip to content

Commit 58c5336

Browse files
committed
rcutorture: Allow boottime stall warnings to be suppressed
In normal production, an RCU CPU stall warning at boottime is often just as bad as at any other time. In fact, given the desire for fast boot, any sort of long-term stall at boot is a bad idea. However, heavy rcutorture testing on large hyperthreaded systems can generate boottime RCU CPU stalls as a matter of course. This commit therefore provides a kernel boot parameter that suppresses reporting of boottime RCU CPU stall warnings and similarly of rcutorture writer stalls. Signed-off-by: Paul E. McKenney <[email protected]>
1 parent a59ee76 commit 58c5336

File tree

6 files changed

+35
-6
lines changed

6 files changed

+35
-6
lines changed

Documentation/admin-guide/kernel-parameters.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4195,6 +4195,12 @@
41954195
rcupdate.rcu_cpu_stall_suppress= [KNL]
41964196
Suppress RCU CPU stall warning messages.
41974197

4198+
rcupdate.rcu_cpu_stall_suppress_at_boot= [KNL]
4199+
Suppress RCU CPU stall warning messages and
4200+
rcutorture writer stall warnings that occur
4201+
during early boot, that is, during the time
4202+
before the init task is spawned.
4203+
41984204
rcupdate.rcu_cpu_stall_timeout= [KNL]
41994205
Set timeout for RCU CPU stall warning messages.
42004206

kernel/rcu/rcu.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,13 +198,25 @@ static inline void debug_rcu_head_unqueue(struct rcu_head *head)
198198
}
199199
#endif /* #else !CONFIG_DEBUG_OBJECTS_RCU_HEAD */
200200

201+
extern int rcu_cpu_stall_suppress_at_boot;
202+
203+
static inline bool rcu_stall_is_suppressed_at_boot(void)
204+
{
205+
return rcu_cpu_stall_suppress_at_boot && !rcu_inkernel_boot_has_ended();
206+
}
207+
201208
#ifdef CONFIG_RCU_STALL_COMMON
202209

203210
extern int rcu_cpu_stall_ftrace_dump;
204211
extern int rcu_cpu_stall_suppress;
205212
extern int rcu_cpu_stall_timeout;
206213
int rcu_jiffies_till_stall_check(void);
207214

215+
static inline bool rcu_stall_is_suppressed(void)
216+
{
217+
return rcu_stall_is_suppressed_at_boot() || rcu_cpu_stall_suppress;
218+
}
219+
208220
#define rcu_ftrace_dump_stall_suppress() \
209221
do { \
210222
if (!rcu_cpu_stall_suppress) \
@@ -218,6 +230,11 @@ do { \
218230
} while (0)
219231

220232
#else /* #endif #ifdef CONFIG_RCU_STALL_COMMON */
233+
234+
static inline bool rcu_stall_is_suppressed(void)
235+
{
236+
return rcu_stall_is_suppressed_at_boot();
237+
}
221238
#define rcu_ftrace_dump_stall_suppress()
222239
#define rcu_ftrace_dump_stall_unsuppress()
223240
#endif /* #ifdef CONFIG_RCU_STALL_COMMON */

kernel/rcu/rcutorture.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1479,7 +1479,7 @@ rcu_torture_stats_print(void)
14791479
if (cur_ops->stats)
14801480
cur_ops->stats();
14811481
if (rtcv_snap == rcu_torture_current_version &&
1482-
rcu_torture_current != NULL) {
1482+
rcu_torture_current != NULL && !rcu_stall_is_suppressed()) {
14831483
int __maybe_unused flags = 0;
14841484
unsigned long __maybe_unused gp_seq = 0;
14851485

kernel/rcu/tree_exp.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ static void synchronize_rcu_expedited_wait(void)
518518
for (;;) {
519519
if (synchronize_rcu_expedited_wait_once(jiffies_stall))
520520
return;
521-
if (rcu_cpu_stall_suppress)
521+
if (rcu_stall_is_suppressed())
522522
continue;
523523
panic_on_rcu_stall();
524524
pr_err("INFO: %s detected expedited stalls on CPUs/tasks: {",

kernel/rcu/tree_stall.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ static void print_other_cpu_stall(unsigned long gp_seq)
383383

384384
/* Kick and suppress, if so configured. */
385385
rcu_stall_kick_kthreads();
386-
if (rcu_cpu_stall_suppress)
386+
if (rcu_stall_is_suppressed())
387387
return;
388388

389389
/*
@@ -452,7 +452,7 @@ static void print_cpu_stall(void)
452452

453453
/* Kick and suppress, if so configured. */
454454
rcu_stall_kick_kthreads();
455-
if (rcu_cpu_stall_suppress)
455+
if (rcu_stall_is_suppressed())
456456
return;
457457

458458
/*
@@ -504,7 +504,7 @@ static void check_cpu_stall(struct rcu_data *rdp)
504504
unsigned long js;
505505
struct rcu_node *rnp;
506506

507-
if ((rcu_cpu_stall_suppress && !rcu_kick_kthreads) ||
507+
if ((rcu_stall_is_suppressed() && !rcu_kick_kthreads) ||
508508
!rcu_gp_in_progress())
509509
return;
510510
rcu_stall_kick_kthreads();

kernel/rcu/update.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,13 +476,19 @@ EXPORT_SYMBOL_GPL(rcutorture_sched_setaffinity);
476476
#ifdef CONFIG_RCU_STALL_COMMON
477477
int rcu_cpu_stall_ftrace_dump __read_mostly;
478478
module_param(rcu_cpu_stall_ftrace_dump, int, 0644);
479-
int rcu_cpu_stall_suppress __read_mostly; /* 1 = suppress stall warnings. */
479+
int rcu_cpu_stall_suppress __read_mostly; // !0 = suppress stall warnings.
480480
EXPORT_SYMBOL_GPL(rcu_cpu_stall_suppress);
481481
module_param(rcu_cpu_stall_suppress, int, 0644);
482482
int rcu_cpu_stall_timeout __read_mostly = CONFIG_RCU_CPU_STALL_TIMEOUT;
483483
module_param(rcu_cpu_stall_timeout, int, 0644);
484484
#endif /* #ifdef CONFIG_RCU_STALL_COMMON */
485485

486+
// Suppress boot-time RCU CPU stall warnings and rcutorture writer stall
487+
// warnings. Also used by rcutorture even if stall warnings are excluded.
488+
int rcu_cpu_stall_suppress_at_boot __read_mostly; // !0 = suppress boot stalls.
489+
EXPORT_SYMBOL_GPL(rcu_cpu_stall_suppress_at_boot);
490+
module_param(rcu_cpu_stall_suppress_at_boot, int, 0444);
491+
486492
#ifdef CONFIG_TASKS_RCU
487493

488494
/*

0 commit comments

Comments
 (0)