summary refs log tree commit diff
path: root/kernel/panic.c
diff options
context:
space:
mode:
authorSteven Rostedt (Red Hat) <rostedt@goodmis.org>2013-06-14 16:21:43 -0400
committerSteven Rostedt <rostedt@goodmis.org>2013-06-19 23:32:07 -0400
commitde7edd31457b626e54a0b2a7e8ff4d65492f01ad (patch)
treefc98cad3155f6cded6192709c4cb496dd17282db /kernel/panic.c
parentc3e13c7c0605677a2c94957b39157f4501cea9a8 (diff)
downloadlinux-de7edd31457b626e54a0b2a7e8ff4d65492f01ad.tar.gz
tracing: Disable tracing on warning
Add a traceoff_on_warning option in both the kernel command line as well
as a sysctl option. When set, any WARN*() function that is hit will cause
the tracing_on variable to be cleared, which disables writing to the
ring buffer.

This is useful especially when tracing a bug with function tracing. When
a warning is hit, the print caused by the warning can flood the trace with
the functions that producing the output for the warning. This can make the
resulting trace useless by either hiding where the bug happened, or worse,
by overflowing the buffer and losing the trace of the bug totally.

Acked-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel/panic.c')
-rw-r--r--kernel/panic.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/kernel/panic.c b/kernel/panic.c
index 167ec097ce8b..4cea6cc628ab 100644
--- a/kernel/panic.c
+++ b/kernel/panic.c
@@ -15,6 +15,7 @@
 #include <linux/notifier.h>
 #include <linux/module.h>
 #include <linux/random.h>
+#include <linux/ftrace.h>
 #include <linux/reboot.h>
 #include <linux/delay.h>
 #include <linux/kexec.h>
@@ -399,6 +400,8 @@ struct slowpath_args {
 static void warn_slowpath_common(const char *file, int line, void *caller,
 				 unsigned taint, struct slowpath_args *args)
 {
+	disable_trace_on_warning();
+
 	printk(KERN_WARNING "------------[ cut here ]------------\n");
 	printk(KERN_WARNING "WARNING: at %s:%d %pS()\n", file, line, caller);