Commit 2aad1b76 authored by Steven Rostedt's avatar Steven Rostedt Committed by Ingo Molnar

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: default avatarSteven Rostedt <srostedt@redhat.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 8b54e45b
...@@ -2719,6 +2719,9 @@ void unregister_ftrace_graph(void) ...@@ -2719,6 +2719,9 @@ void unregister_ftrace_graph(void)
{ {
mutex_lock(&ftrace_lock); mutex_lock(&ftrace_lock);
if (!unlikely(atomic_read(&ftrace_graph_active)))
goto out;
atomic_dec(&ftrace_graph_active); atomic_dec(&ftrace_graph_active);
unregister_trace_sched_switch(ftrace_graph_probe_sched_switch); unregister_trace_sched_switch(ftrace_graph_probe_sched_switch);
ftrace_graph_return = (trace_func_graph_ret_t)ftrace_stub; ftrace_graph_return = (trace_func_graph_ret_t)ftrace_stub;
...@@ -2726,6 +2729,7 @@ void unregister_ftrace_graph(void) ...@@ -2726,6 +2729,7 @@ void unregister_ftrace_graph(void)
ftrace_shutdown(FTRACE_STOP_FUNC_RET); ftrace_shutdown(FTRACE_STOP_FUNC_RET);
unregister_pm_notifier(&ftrace_suspend_notifier); unregister_pm_notifier(&ftrace_suspend_notifier);
out:
mutex_unlock(&ftrace_lock); mutex_unlock(&ftrace_lock);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment