summaryrefslogtreecommitdiff
path: root/kernel/printk
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2011-07-22 15:58:40 (GMT)
committerScott Wood <scottwood@freescale.com>2015-02-13 22:20:16 (GMT)
commitb014e53ffb95146c8abc21265d5171531c42e92f (patch)
tree5aecf5fb999aefbd2e0d3479428e1d5d846284c7 /kernel/printk
parentcfd3f5dc9446bd165e0cac8e68e81518ad04b033 (diff)
downloadlinux-fsl-qoriq-b014e53ffb95146c8abc21265d5171531c42e92f.tar.xz
printk-kill.patch
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'kernel/printk')
-rw-r--r--kernel/printk/printk.c79
1 files changed, 56 insertions, 23 deletions
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index 0f91490..a93a03b 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -1487,6 +1487,55 @@ static size_t cont_print_text(char *text, size_t size)
return textlen;
}
+#ifdef CONFIG_EARLY_PRINTK
+struct console *early_console;
+
+void early_vprintk(const char *fmt, va_list ap)
+{
+ if (early_console) {
+ char buf[512];
+ int n = vscnprintf(buf, sizeof(buf), fmt, ap);
+
+ early_console->write(early_console, buf, n);
+ }
+}
+
+asmlinkage void early_printk(const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, 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
+
asmlinkage int vprintk_emit(int facility, int level,
const char *dict, size_t dictlen,
const char *fmt, va_list args)
@@ -1500,6 +1549,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();
@@ -1722,29 +1778,6 @@ static size_t cont_print_text(char *text, size_t size) { return 0; }
#endif /* CONFIG_PRINTK */
-#ifdef CONFIG_EARLY_PRINTK
-struct console *early_console;
-
-void early_vprintk(const char *fmt, va_list ap)
-{
- if (early_console) {
- char buf[512];
- int n = vscnprintf(buf, sizeof(buf), fmt, ap);
-
- early_console->write(early_console, buf, n);
- }
-}
-
-asmlinkage void early_printk(const char *fmt, ...)
-{
- va_list ap;
-
- va_start(ap, fmt);
- early_vprintk(fmt, ap);
- va_end(ap);
-}
-#endif
-
static int __add_preferred_console(char *name, int idx, char *options,
char *brl_options)
{