All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/3] tracing/ftrace: fix the check of ftrace_trace_task
@ 2008-12-04 22:49 Frederic Weisbecker
  2008-12-04 23:18 ` Steven Rostedt
  0 siblings, 1 reply; 3+ messages in thread
From: Frederic Weisbecker @ 2008-12-04 22:49 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Steven Rostedt, Linux Kernel

Impact: fix default empty traces on function-graph-tracer

The actual ftrace_trace_task() checks if ftrace_pid_trace is allocated
and return 1 if it is true.
If it is NULL, it will check the bit of pid tracing flag for the current
task (which are not set by default).
So by default, a task is not traced.
Actually all tasks should be traced by default and filter_by_pid when
ftrace_pid_trace is allocated.

The appropriate condition should be to return 1 if filter_by_pid is
set.

Cc: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
---
 kernel/trace/trace.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index a71bbe0..5ac6970 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -551,7 +551,7 @@ extern struct pid *ftrace_pid_trace;
 
 static inline int ftrace_trace_task(struct task_struct *task)
 {
-	if (ftrace_pid_trace)
+	if (!ftrace_pid_trace)
 		return 1;
 
 	return test_tsk_trace_trace(task);
-- 
1.5.6.3


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

* Re: [PATCH 2/3] tracing/ftrace: fix the check of ftrace_trace_task
  2008-12-04 22:49 [PATCH 2/3] tracing/ftrace: fix the check of ftrace_trace_task Frederic Weisbecker
@ 2008-12-04 23:18 ` Steven Rostedt
  2008-12-05 13:48   ` Ingo Molnar
  0 siblings, 1 reply; 3+ messages in thread
From: Steven Rostedt @ 2008-12-04 23:18 UTC (permalink / raw)
  To: Frederic Weisbecker; +Cc: Ingo Molnar, Linux Kernel


On Thu, 4 Dec 2008, Frederic Weisbecker wrote:

> Impact: fix default empty traces on function-graph-tracer
> 
> The actual ftrace_trace_task() checks if ftrace_pid_trace is allocated
> and return 1 if it is true.
> If it is NULL, it will check the bit of pid tracing flag for the current
> task (which are not set by default).
> So by default, a task is not traced.
> Actually all tasks should be traced by default and filter_by_pid when
> ftrace_pid_trace is allocated.

Heh, I thought my output look funny. The function tracer does not use it 
since it registers a different function. But because the graph tracer
only shows the current task on switch (I did not look into trace options)
I could not really test it well.

-- Steve

Acked-by: Steven Rostedt <srostedt@redhat.com>

> 
> The appropriate condition should be to return 1 if filter_by_pid is
> set.
> 
> Cc: Steven Rostedt <rostedt@goodmis.org>
> Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
> ---
>  kernel/trace/trace.h |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
> index a71bbe0..5ac6970 100644
> --- a/kernel/trace/trace.h
> +++ b/kernel/trace/trace.h
> @@ -551,7 +551,7 @@ extern struct pid *ftrace_pid_trace;
>  
>  static inline int ftrace_trace_task(struct task_struct *task)
>  {
> -	if (ftrace_pid_trace)
> +	if (!ftrace_pid_trace)
>  		return 1;
>  
>  	return test_tsk_trace_trace(task);
> -- 
> 1.5.6.3
> 
> 
> 

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

* Re: [PATCH 2/3] tracing/ftrace: fix the check of ftrace_trace_task
  2008-12-04 23:18 ` Steven Rostedt
@ 2008-12-05 13:48   ` Ingo Molnar
  0 siblings, 0 replies; 3+ messages in thread
From: Ingo Molnar @ 2008-12-05 13:48 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: Frederic Weisbecker, Linux Kernel


* Steven Rostedt <rostedt@goodmis.org> wrote:

> 
> On Thu, 4 Dec 2008, Frederic Weisbecker wrote:
> 
> > Impact: fix default empty traces on function-graph-tracer
> > 
> > The actual ftrace_trace_task() checks if ftrace_pid_trace is 
> > allocated and return 1 if it is true. If it is NULL, it will check 
> > the bit of pid tracing flag for the current task (which are not set 
> > by default). So by default, a task is not traced. Actually all tasks 
> > should be traced by default and filter_by_pid when ftrace_pid_trace 
> > is allocated.
> 
> Heh, I thought my output look funny. The function tracer does not use 
> it since it registers a different function. But because the graph 
> tracer only shows the current task on switch (I did not look into trace 
> options) I could not really test it well.
> 
> -- Steve
> 
> Acked-by: Steven Rostedt <srostedt@redhat.com>

applied to tip/tracing/ftrace, thanks!

	Ingo

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

end of thread, other threads:[~2008-12-05 13:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-04 22:49 [PATCH 2/3] tracing/ftrace: fix the check of ftrace_trace_task Frederic Weisbecker
2008-12-04 23:18 ` Steven Rostedt
2008-12-05 13:48   ` Ingo Molnar

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.