Skip to content

Commit

Permalink
function-graph: allow unregistering twice
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Steven Rostedt authored and Ingo Molnar committed Apr 1, 2009
1 parent 8b54e45 commit 2aad1b7
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions kernel/trace/ftrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -2719,13 +2719,17 @@ void unregister_ftrace_graph(void)
{
mutex_lock(&ftrace_lock);

if (!unlikely(atomic_read(&ftrace_graph_active)))
goto out;

atomic_dec(&ftrace_graph_active);
unregister_trace_sched_switch(ftrace_graph_probe_sched_switch);
ftrace_graph_return = (trace_func_graph_ret_t)ftrace_stub;
ftrace_graph_entry = ftrace_graph_entry_stub;
ftrace_shutdown(FTRACE_STOP_FUNC_RET);
unregister_pm_notifier(&ftrace_suspend_notifier);

out:
mutex_unlock(&ftrace_lock);
}

Expand Down

0 comments on commit 2aad1b7

Please sign in to comment.