summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2008-11-21 12:59:38 -0500
committerIngo Molnar <mingo@elte.hu>2008-11-23 11:45:34 +0100
commit69bb54ec05f57da7f6fac2cec0820cbc970df20f (patch)
treecdee5802117c2e78cf18df7fa524c7390d1bdb67
parente58918ab9d4cd375f6d842e6d88cf4d7a55cbfcc (diff)
downloadop-kernel-dev-69bb54ec05f57da7f6fac2cec0820cbc970df20f.zip
op-kernel-dev-69bb54ec05f57da7f6fac2cec0820cbc970df20f.tar.gz
ftrace: add ftrace_off_permanent
Impact: add new API to disable all of ftrace on anomalies It case of a serious anomaly being detected (like something caught by lockdep) it is a good idea to disable all tracing immediately, without grabing any locks. This patch adds ftrace_off_permanent that disables the tracers, function tracing and ring buffers without a way to enable them again. This should only be used when something serious has been detected. Signed-off-by: Steven Rostedt <srostedt@redhat.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r--include/linux/ftrace.h2
-rw-r--r--kernel/trace/trace.c15
2 files changed, 17 insertions, 0 deletions
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index f7ba4ea..13e9cfc 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -257,6 +257,7 @@ extern int ftrace_dump_on_oops;
extern void tracing_start(void);
extern void tracing_stop(void);
+extern void ftrace_off_permanent(void);
extern void
ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3);
@@ -290,6 +291,7 @@ ftrace_printk(const char *fmt, ...) __attribute__ ((format (printf, 1, 0)));
static inline void tracing_start(void) { }
static inline void tracing_stop(void) { }
+static inline void ftrace_off_permanent(void) { }
static inline int
ftrace_printk(const char *fmt, ...)
{
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 4ee6f037..0dbfb23 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -661,6 +661,21 @@ static int trace_stop_count;
static DEFINE_SPINLOCK(tracing_start_lock);
/**
+ * ftrace_off_permanent - disable all ftrace code permanently
+ *
+ * This should only be called when a serious anomally has
+ * been detected. This will turn off the function tracing,
+ * ring buffers, and other tracing utilites. It takes no
+ * locks and can be called from any context.
+ */
+void ftrace_off_permanent(void)
+{
+ tracing_disabled = 1;
+ ftrace_stop();
+ tracing_off_permanent();
+}
+
+/**
* tracing_start - quick start of the tracer
*
* If tracing is enabled but was stopped by tracing_stop,
OpenPOWER on IntegriCloud