Skip to content

Commit c292a5f

Browse files
Rik van Rielhnaz
authored andcommitted
sysrq,rcu: suppress RCU stall warnings while sysrq runs
Some sysrq handlers can run for a long time, because they dump a lot of data onto a serial console. Having RCU stall warnings pop up in the middle of them only makes the problem worse. This patch temporarily disables RCU stall warnings while a sysrq request is handled. [[email protected]: fix TINY_RCU build error] Signed-off-by: Rik van Riel <[email protected]> Suggested-by: Paul McKenney <[email protected]> Signed-off-by: Paul E. McKenney <[email protected]> Cc: Madper Xie <[email protected]> Cc: Randy Dunlap <[email protected]> Cc: Richard Weinberger <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent c6a884d commit c292a5f

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed

drivers/tty/sysrq.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
#include <linux/jiffies.h>
4747
#include <linux/syscalls.h>
4848
#include <linux/of.h>
49+
#include <linux/rcupdate.h>
4950

5051
#include <asm/ptrace.h>
5152
#include <asm/irq_regs.h>
@@ -511,6 +512,7 @@ void __handle_sysrq(int key, bool check_mask)
511512
int orig_log_level;
512513
int i;
513514

515+
rcu_sysrq_start();
514516
rcu_read_lock();
515517
/*
516518
* Raise the apparent loglevel to maximum so that the sysrq header
@@ -554,6 +556,7 @@ void __handle_sysrq(int key, bool check_mask)
554556
console_loglevel = orig_log_level;
555557
}
556558
rcu_read_unlock();
559+
rcu_sysrq_end();
557560
}
558561

559562
void handle_sysrq(int key)

include/linux/rcupdate.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,18 @@ void rcu_idle_exit(void);
228228
void rcu_irq_enter(void);
229229
void rcu_irq_exit(void);
230230

231+
#ifdef CONFIG_RCU_STALL_COMMON
232+
void rcu_sysrq_start(void);
233+
void rcu_sysrq_end(void);
234+
#else /* #ifdef CONFIG_RCU_STALL_COMMON */
235+
static inline void rcu_sysrq_start(void)
236+
{
237+
}
238+
static inline void rcu_sysrq_end(void)
239+
{
240+
}
241+
#endif /* #else #ifdef CONFIG_RCU_STALL_COMMON */
242+
231243
#ifdef CONFIG_RCU_USER_QS
232244
void rcu_user_enter(void);
233245
void rcu_user_exit(void);

kernel/rcu/update.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,18 @@ int rcu_jiffies_till_stall_check(void)
320320
return till_stall_check * HZ + RCU_STALL_DELAY_DELTA;
321321
}
322322

323+
void rcu_sysrq_start(void)
324+
{
325+
if (!rcu_cpu_stall_suppress)
326+
rcu_cpu_stall_suppress = 2;
327+
}
328+
329+
void rcu_sysrq_end(void)
330+
{
331+
if (rcu_cpu_stall_suppress == 2)
332+
rcu_cpu_stall_suppress = 0;
333+
}
334+
323335
static int rcu_panic(struct notifier_block *this, unsigned long ev, void *ptr)
324336
{
325337
rcu_cpu_stall_suppress = 1;

0 commit comments

Comments
 (0)