aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/linux/ftrace.h1
-rw-r--r--kernel/trace/ftrace.c15
2 files changed, 16 insertions, 0 deletions
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index 3121b95443d..f368d041e02 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -89,6 +89,7 @@ void ftrace_enable_daemon(void);
/* totally disable ftrace - can not re-enable after this */
void ftrace_kill(void);
+void ftrace_kill_atomic(void);
static inline void tracer_disable(void)
{
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 0f271c45cd0..1359632668a 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -1602,6 +1602,21 @@ core_initcall(ftrace_dynamic_init);
#endif /* CONFIG_DYNAMIC_FTRACE */
/**
+ * ftrace_kill_atomic - kill ftrace from critical sections
+ *
+ * This function should be used by panic code. It stops ftrace
+ * but in a not so nice way. If you need to simply kill ftrace
+ * from a non-atomic section, use ftrace_kill.
+ */
+void ftrace_kill_atomic(void)
+{
+ ftrace_disabled = 1;
+ ftrace_enabled = 0;
+ ftraced_suspend = -1;
+ clear_ftrace_function();
+}
+
+/**
* ftrace_kill - totally shutdown ftrace
*
* This is a safety measure. If something was detected that seems