summaryrefslogtreecommitdiff
path: root/kernel/printk.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2011-07-22 15:58:40 (GMT)
committerScott Wood <scottwood@freescale.com>2013-04-04 22:09:11 (GMT)
commitcb950e4e5bfe1b0c18c46371b9ad9765b1270b97 (patch)
tree9b30a9a2686c33e6c761012b5065a6906c26a176 /kernel/printk.c
parentb87fc2a0054a6173cd8ce8b000ea46c7a409c086 (diff)
downloadlinux-fsl-qoriq-cb950e4e5bfe1b0c18c46371b9ad9765b1270b97.tar.xz
printk-kill.patch
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'kernel/printk.c')
-rw-r--r--kernel/printk.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/kernel/printk.c b/kernel/printk.c
index 69270a6..d429e73 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -770,6 +770,32 @@ asmlinkage void early_printk(const char *fmt, ...)
early_vprintk(fmt, ap);
va_end(ap);
}
+
+/*
+ * This is independent of any log levels - a global
+ * kill switch that turns off all of printk.
+ *
+ * Used by the NMI watchdog if early-printk is enabled.
+ */
+static bool __read_mostly printk_killswitch;
+
+void printk_kill(void)
+{
+ printk_killswitch = true;
+}
+
+static int forced_early_printk(const char *fmt, va_list ap)
+{
+ if (!printk_killswitch)
+ return 0;
+ early_vprintk(fmt, ap);
+ return 1;
+}
+#else
+static inline int forced_early_printk(const char *fmt, va_list ap)
+{
+ return 0;
+}
#endif
#ifdef CONFIG_BOOT_PRINTK_DELAY
@@ -1511,6 +1537,13 @@ asmlinkage int vprintk_emit(int facility, int level,
int this_cpu;
int printed_len = 0;
+ /*
+ * Fall back to early_printk if a debugging subsystem has
+ * killed printk output
+ */
+ if (unlikely(forced_early_printk(fmt, args)))
+ return 1;
+
boot_delay_msec(level);
printk_delay();