diff options
author | Steven Rostedt <srostedt@redhat.com> | 2009-03-30 11:11:28 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-04-01 08:47:42 -0400 |
commit | 2aad1b76e6b0cc5a2e5d9b95a9f356ddddbfa8a9 (patch) | |
tree | 80ac6be0f1502079a50f8b1b4ffcc5e0586791e8 | |
parent | 8b54e45b0005875f59cb8b1c44d429a161d5f245 (diff) |
function-graph: allow unregistering twice
Impact: fix to permanent disabling of function graph tracer
There should be nothing to prevent a tracer from unregistering a
function graph callback more than once. This can simplify error paths.
But currently, the counter does not account for mulitple unregistering
of the function graph callback. If it happens, the function graph
tracer will be permanently disabled.
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | kernel/trace/ftrace.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index 1752a63f37c0..f1ed080406c3 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c | |||
@@ -2719,6 +2719,9 @@ void unregister_ftrace_graph(void) | |||
2719 | { | 2719 | { |
2720 | mutex_lock(&ftrace_lock); | 2720 | mutex_lock(&ftrace_lock); |
2721 | 2721 | ||
2722 | if (!unlikely(atomic_read(&ftrace_graph_active))) | ||
2723 | goto out; | ||
2724 | |||
2722 | atomic_dec(&ftrace_graph_active); | 2725 | atomic_dec(&ftrace_graph_active); |
2723 | unregister_trace_sched_switch(ftrace_graph_probe_sched_switch); | 2726 | unregister_trace_sched_switch(ftrace_graph_probe_sched_switch); |
2724 | ftrace_graph_return = (trace_func_graph_ret_t)ftrace_stub; | 2727 | ftrace_graph_return = (trace_func_graph_ret_t)ftrace_stub; |
@@ -2726,6 +2729,7 @@ void unregister_ftrace_graph(void) | |||
2726 | ftrace_shutdown(FTRACE_STOP_FUNC_RET); | 2729 | ftrace_shutdown(FTRACE_STOP_FUNC_RET); |
2727 | unregister_pm_notifier(&ftrace_suspend_notifier); | 2730 | unregister_pm_notifier(&ftrace_suspend_notifier); |
2728 | 2731 | ||
2732 | out: | ||
2729 | mutex_unlock(&ftrace_lock); | 2733 | mutex_unlock(&ftrace_lock); |
2730 | } | 2734 | } |
2731 | 2735 | ||