tracing/ftrace: fix the check of ftrace_trace_task
PATCH 2/3 tracing/ftrace: fix the check of ftrace_trace_task
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.
--- kernel/trace/trace.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
kernel/trace/trace.h +1 -1
@@ -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);
Signature · 1 line
1.5.6.3
Quoted 9 lines · Frederic Weisbecker
Impact: fix default empty traces on function-graph-tracer
The actual
ftrace_trace_task()checks ifftrace_pid_traceis 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 andfilter_by_pidwhenftrace_pid_traceis 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
Quoted 28 lines
The appropriate condition should be to return 1 if
filter_by_pidis set.Cc Steven Rostedt <[email protected]>Signed-off-by Frederic Weisbecker <[email protected]>--- kernel/trace/trace.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)kernel/trace/trace.h +1
-1@@ -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);Signature · 1 line
1.5.6.3
Ingo Molnar
AppliedQuoted 12 lines · Steven Rostedt
Quoted 8 lines · Frederic Weisbecker
Impact: fix default empty traces on function-graph-tracer
The actual
ftrace_trace_task()checks ifftrace_pid_traceis 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 andfilter_by_pidwhenftrace_pid_traceis allocated.
Quoted 8 lines
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 <[email protected]>
applied to tip/tracing/ftrace, thanks!
Ingo