* [PATCH] ftrace: Handle TRACE_BPUTS in print_graph_comment
@ 2016-09-01 2:43 Namhyung Kim
2016-09-01 16:20 ` Steven Rostedt
0 siblings, 1 reply; 2+ messages in thread
From: Namhyung Kim @ 2016-09-01 2:43 UTC (permalink / raw)
To: Steven Rostedt; +Cc: LKML, Ingo Molnar
It missed to handle TRACE_BPUTS so messages recorded by trace_bputs()
will be shown with symbol info unnecessarily.
You can see it with the trace_printk sample code:
# cd /sys/kernel/tracing/
# echo sys_sync > set_graph_function
# echo 1 > options/sym-offset
# echo function_graph > current_tracer
Note that the sys_sync filter was there to prevent recording other
functions and the sym-offset option was needed since the first message
was called from a module init function so kallsyms doesn't have the
symbol and omitted in the output.
# cd ~/build/kernel
# insmod samples/trace_printk/trace-printk.ko
# cd -
# head trace
Before:
# tracer: function_graph
#
# CPU DURATION FUNCTION CALLS
# | | | | | | |
1) | /* 0xffffffffa0002000: This is a static string that will use trace_bputs */
1) | /* This is a dynamic string that will use trace_puts */
1) | /* trace_printk_irq_work+0x5/0x7b [trace_printk]: (irq) This is a static string that will use trace_bputs */
1) | /* (irq) This is a dynamic string that will use trace_puts */
1) | /* (irq) This is a static string that will use trace_bprintk() */
1) | /* (irq) This is a dynamic string that will use trace_printk */
After:
# tracer: function_graph
#
# CPU DURATION FUNCTION CALLS
# | | | | | | |
1) | /* This is a static string that will use trace_bputs */
1) | /* This is a dynamic string that will use trace_puts */
1) | /* (irq) This is a static string that will use trace_bputs */
1) | /* (irq) This is a dynamic string that will use trace_puts */
1) | /* (irq) This is a static string that will use trace_bprintk() */
1) | /* (irq) This is a dynamic string that will use trace_printk */
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
kernel/trace/trace_functions_graph.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c
index 9c7ffa4df5a8..4e480e870474 100644
--- a/kernel/trace/trace_functions_graph.c
+++ b/kernel/trace/trace_functions_graph.c
@@ -1182,6 +1182,11 @@ print_graph_comment(struct trace_seq *s, struct trace_entry *ent,
trace_seq_puts(s, "/* ");
switch (iter->ent->type) {
+ case TRACE_BPUTS:
+ ret = trace_print_bputs_msg_only(iter);
+ if (ret != TRACE_TYPE_HANDLED)
+ return ret;
+ break;
case TRACE_BPRINT:
ret = trace_print_bprintk_msg_only(iter);
if (ret != TRACE_TYPE_HANDLED)
--
2.9.3
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] ftrace: Handle TRACE_BPUTS in print_graph_comment
2016-09-01 2:43 [PATCH] ftrace: Handle TRACE_BPUTS in print_graph_comment Namhyung Kim
@ 2016-09-01 16:20 ` Steven Rostedt
0 siblings, 0 replies; 2+ messages in thread
From: Steven Rostedt @ 2016-09-01 16:20 UTC (permalink / raw)
To: Namhyung Kim; +Cc: LKML, Ingo Molnar
On Thu, 1 Sep 2016 11:43:54 +0900
Namhyung Kim <namhyung@kernel.org> wrote:
> It missed to handle TRACE_BPUTS so messages recorded by trace_bputs()
> will be shown with symbol info unnecessarily.
>
> You can see it with the trace_printk sample code:
>
> # cd /sys/kernel/tracing/
> # echo sys_sync > set_graph_function
> # echo 1 > options/sym-offset
> # echo function_graph > current_tracer
>
> Note that the sys_sync filter was there to prevent recording other
> functions and the sym-offset option was needed since the first message
> was called from a module init function so kallsyms doesn't have the
> symbol and omitted in the output.
>
> # cd ~/build/kernel
> # insmod samples/trace_printk/trace-printk.ko
>
> # cd -
> # head trace
>
> Before:
>
> # tracer: function_graph
> #
> # CPU DURATION FUNCTION CALLS
> # | | | | | | |
> 1) | /* 0xffffffffa0002000: This is a static string that will use trace_bputs */
> 1) | /* This is a dynamic string that will use trace_puts */
> 1) | /* trace_printk_irq_work+0x5/0x7b [trace_printk]: (irq) This is a static string that will use trace_bputs */
> 1) | /* (irq) This is a dynamic string that will use trace_puts */
> 1) | /* (irq) This is a static string that will use trace_bprintk() */
> 1) | /* (irq) This is a dynamic string that will use trace_printk */
>
> After:
>
> # tracer: function_graph
> #
> # CPU DURATION FUNCTION CALLS
> # | | | | | | |
> 1) | /* This is a static string that will use trace_bputs */
> 1) | /* This is a dynamic string that will use trace_puts */
> 1) | /* (irq) This is a static string that will use trace_bputs */
> 1) | /* (irq) This is a dynamic string that will use trace_puts */
> 1) | /* (irq) This is a static string that will use trace_bprintk() */
> 1) | /* (irq) This is a dynamic string that will use trace_printk */
>
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> ---
Applied, thanks Namhyung!
-- Steve
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-09-01 16:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-01 2:43 [PATCH] ftrace: Handle TRACE_BPUTS in print_graph_comment Namhyung Kim
2016-09-01 16:20 ` Steven Rostedt
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®