aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace
diff options
context:
space:
mode:
authorSteven Rostedt (Red Hat) <rostedt@goodmis.org>2015-03-06 19:55:13 -0500
committerSteven Rostedt <rostedt@goodmis.org>2015-03-09 10:55:34 -0400
commit524a38682573b2e15ab6317ccfe50280441514be (patch)
tree3c720aa57454bd920aad5d94937a78e4c4a196f8 /kernel/trace
parent1619dc3f8f555ee1cdd3c75db3885d5715442b12 (diff)
ftrace: Fix ftrace enable ordering of sysctl ftrace_enabled
Some archs (specifically PowerPC), are sensitive with the ordering of the enabling of the calls to function tracing and setting of the function to use to be traced. That is, update_ftrace_function() sets what function the ftrace_caller trampoline should call. Some archs require this to be set before calling ftrace_run_update_code(). Another bug was discovered, that ftrace_startup_sysctl() called ftrace_run_update_code() directly. If the function the ftrace_caller trampoline changes, then it will not be updated. Instead a call to ftrace_startup_enable() should be called because it tests to see if the callback changed since the code was disabled, and will tell the arch to update appropriately. Most archs do not need this notification, but PowerPC does. The problem could be seen by the following commands: # echo 0 > /proc/sys/kernel/ftrace_enabled # echo function > /sys/kernel/debug/tracing/current_tracer # echo 1 > /proc/sys/kernel/ftrace_enabled # cat /sys/kernel/debug/tracing/trace The trace will show that function tracing was not active. Cc: stable@vger.kernel.org # 2.6.27+ Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel/trace')
-rw-r--r--kernel/trace/ftrace.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index ea520bb54d44..4f228024055b 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -2710,7 +2710,7 @@ static void ftrace_startup_sysctl(void)
2710 command = FTRACE_UPDATE_CALLS; 2710 command = FTRACE_UPDATE_CALLS;
2711 if (ftrace_graph_active) 2711 if (ftrace_graph_active)
2712 command |= FTRACE_START_FUNC_RET; 2712 command |= FTRACE_START_FUNC_RET;
2713 ftrace_run_update_code(command); 2713 ftrace_startup_enable(command);
2714 } 2714 }
2715} 2715}
2716 2716
@@ -5580,12 +5580,12 @@ ftrace_enable_sysctl(struct ctl_table *table, int write,
5580 5580
5581 if (ftrace_enabled) { 5581 if (ftrace_enabled) {
5582 5582
5583 ftrace_startup_sysctl();
5584
5585 /* we are starting ftrace again */ 5583 /* we are starting ftrace again */
5586 if (ftrace_ops_list != &ftrace_list_end) 5584 if (ftrace_ops_list != &ftrace_list_end)
5587 update_ftrace_function(); 5585 update_ftrace_function();
5588 5586
5587 ftrace_startup_sysctl();
5588
5589 } else { 5589 } else {
5590 /* stopping ftrace calls (just send to ftrace_stub) */ 5590 /* stopping ftrace calls (just send to ftrace_stub) */
5591 ftrace_trace_function = ftrace_stub; 5591 ftrace_trace_function = ftrace_stub;