mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/1] function trace: fix a bug of single thread function trace
@ 2008-12-02  2:33 Liming Wang
  2008-12-02  8:23 ` Ingo Molnar
  0 siblings, 1 reply; 2+ messages in thread
From: Liming Wang @ 2008-12-02  2:33 UTC (permalink / raw)
  To: Steven Rostedt, Ingo Molnar; +Cc: linux-kernel, Liming Wang

Impact: fix a bug in 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>
---
 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 cbf8b09..7540ef1 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -243,10 +243,8 @@ static void ftrace_update_pid_func(void)
 		set_ftrace_pid_function(func);
 		func = ftrace_pid_func;
 	} else {
-		if (func != ftrace_pid_func)
-			goto out;
-
-		set_ftrace_pid_function(func);
+		if (func == ftrace_pid_func)
+			func = ftrace_pid_function;
 	}
 
 #ifdef CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST
-- 
1.6.0.3


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/1] function trace: fix a bug of single thread function trace
  2008-12-02  2:33 [PATCH 1/1] function trace: fix a bug of single thread function trace Liming Wang
@ 2008-12-02  8:23 ` Ingo Molnar
  0 siblings, 0 replies; 2+ messages in thread
From: Ingo Molnar @ 2008-12-02  8:23 UTC (permalink / raw)
  To: Liming Wang; +Cc: Steven Rostedt, linux-kernel


* Liming Wang <liming.wang@windriver.com> wrote:

> Impact: fix a bug in 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>
> ---
>  kernel/trace/ftrace.c |    6 ++----
>  1 files changed, 2 insertions(+), 4 deletions(-)

applied to tip/tracing/ftrace, thanks!

	Ingo

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-12-02  8:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-12-02  2:33 [PATCH 1/1] function trace: fix a bug of single thread function trace Liming Wang
2008-12-02  8:23 ` Ingo Molnar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®