diff options
| author | Steven Rostedt <rostedt@goodmis.org> | 2008-07-10 20:58:15 -0400 |
|---|---|---|
| committer | Ingo Molnar <mingo@elte.hu> | 2008-07-11 09:49:21 -0400 |
| commit | a2bb6a3d85ef3124cd336403a95abc0540d3fbe2 (patch) | |
| tree | 3048f355cc3ca814222ba34943c9a8f735e7a5e6 | |
| parent | 26bc83f4cb911a0b4dabfe23b700aaf3235f2955 (diff) | |
ftrace: add ftrace_kill_atomic
It has been suggested that I add a way to disable the function tracer
on an oops. This code adds a ftrace_kill_atomic. It is not meant to be
used in normal situations. It will disable the ftrace tracer, but will
not perform the nice shutdown that requires scheduling.
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Cc: Steven Rostedt <srostedt@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
| -rw-r--r-- | include/linux/ftrace.h | 1 | ||||
| -rw-r--r-- | kernel/trace/ftrace.c | 15 |
2 files changed, 16 insertions, 0 deletions
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h index 3121b95443d9..f368d041e02d 100644 --- a/include/linux/ftrace.h +++ b/include/linux/ftrace.h | |||
| @@ -89,6 +89,7 @@ void ftrace_enable_daemon(void); | |||
| 89 | 89 | ||
| 90 | /* totally disable ftrace - can not re-enable after this */ | 90 | /* totally disable ftrace - can not re-enable after this */ |
| 91 | void ftrace_kill(void); | 91 | void ftrace_kill(void); |
| 92 | void ftrace_kill_atomic(void); | ||
| 92 | 93 | ||
| 93 | static inline void tracer_disable(void) | 94 | static inline void tracer_disable(void) |
| 94 | { | 95 | { |
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index 0f271c45cd02..1359632668a4 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c | |||
| @@ -1602,6 +1602,21 @@ core_initcall(ftrace_dynamic_init); | |||
| 1602 | #endif /* CONFIG_DYNAMIC_FTRACE */ | 1602 | #endif /* CONFIG_DYNAMIC_FTRACE */ |
| 1603 | 1603 | ||
| 1604 | /** | 1604 | /** |
| 1605 | * ftrace_kill_atomic - kill ftrace from critical sections | ||
| 1606 | * | ||
| 1607 | * This function should be used by panic code. It stops ftrace | ||
| 1608 | * but in a not so nice way. If you need to simply kill ftrace | ||
| 1609 | * from a non-atomic section, use ftrace_kill. | ||
| 1610 | */ | ||
| 1611 | void ftrace_kill_atomic(void) | ||
| 1612 | { | ||
| 1613 | ftrace_disabled = 1; | ||
| 1614 | ftrace_enabled = 0; | ||
| 1615 | ftraced_suspend = -1; | ||
| 1616 | clear_ftrace_function(); | ||
| 1617 | } | ||
| 1618 | |||
| 1619 | /** | ||
| 1605 | * ftrace_kill - totally shutdown ftrace | 1620 | * ftrace_kill - totally shutdown ftrace |
| 1606 | * | 1621 | * |
| 1607 | * This is a safety measure. If something was detected that seems | 1622 | * This is a safety measure. If something was detected that seems |
