diff options
| author | Liming Wang <liming.wang@windriver.com> | 2008-12-01 21:33:08 -0500 |
|---|---|---|
| committer | Ingo Molnar <mingo@elte.hu> | 2008-12-02 03:23:24 -0500 |
| commit | 66eafebc1086014709dc38f52ddcb3d67d9b346c (patch) | |
| tree | 10147e635d8d4d15d73cb23baa32a2357570eab0 | |
| parent | 222658e08f72cd539d01f3aabdc258c596f487e2 (diff) | |
function trace: fix a bug of single thread function trace
Impact: fix "no output from tracer" bug caused by ftrace_update_pid_func()
When disabling single thread function trace using
"echo -1 > set_ftrace_pid", the normal function trace
has to restore to original function, otherwise the normal
function trace will not work well.
Without this commit, something like below:
$ ps |grep 850
850 root 2556 S -/bin/sh
$ echo 850 > /debug/tracing/set_ftrace_pid
$ echo function > /debug/tracing/current_tracer
$ echo 1 > /debug/tracing/tracing_enabled
$ sleep 1
$ echo 0 > /debug/tracing/tracing_enabled
$ cat /debug/tracing/trace_pipe |wc -l
59704
$ echo -1 > /debug/tracing/set_ftrace_pid
$ echo 1 > /debug/tracing/tracing_enabled
$ sleep 1
$ echo 0 > /debug/tracing/tracing_enabled
$ more /debug/tracing/trace_pipe
<====== nothing output now!
it should output trace record.
Signed-off-by: Liming Wang <liming.wang@windriver.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
| -rw-r--r-- | kernel/trace/ftrace.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index 08b536a2614e..6d89ab46c6e3 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c | |||
| @@ -243,10 +243,8 @@ static void ftrace_update_pid_func(void) | |||
| 243 | set_ftrace_pid_function(func); | 243 | set_ftrace_pid_function(func); |
| 244 | func = ftrace_pid_func; | 244 | func = ftrace_pid_func; |
| 245 | } else { | 245 | } else { |
| 246 | if (func != ftrace_pid_func) | 246 | if (func == ftrace_pid_func) |
| 247 | goto out; | 247 | func = ftrace_pid_function; |
| 248 | |||
| 249 | set_ftrace_pid_function(func); | ||
| 250 | } | 248 | } |
| 251 | 249 | ||
| 252 | #ifdef CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST | 250 | #ifdef CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST |
