2009-12-11 09:41:48

by tip-bot for Wenji Huang

[permalink] [raw]
Subject: [PATCH] tracing: add checks for printing graph irq

Check return value of trace_seq_printf.

Signed-off-by: Wenji Huang <[email protected]>
---
kernel/trace/trace_functions_graph.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c
index 45e6c01..3fa4055 100644
--- a/kernel/trace/trace_functions_graph.c
+++ b/kernel/trace/trace_functions_graph.c
@@ -555,8 +555,11 @@ print_graph_irq(struct trace_iterator *iter, unsigned long addr,
return TRACE_TYPE_PARTIAL_LINE;

/* Don't close the duration column if haven't one */
- if (tracer_flags.val & TRACE_GRAPH_PRINT_DURATION)
- trace_seq_printf(s, " |");
+ if (tracer_flags.val & TRACE_GRAPH_PRINT_DURATION) {
+ ret = trace_seq_printf(s, " |");
+ if (!ret)
+ return TRACE_TYPE_PARTIAL_LINE;
+ }
ret = trace_seq_printf(s, "\n");

if (!ret)
--
1.5.6


2009-12-11 11:18:34

by Frederic Weisbecker

[permalink] [raw]
Subject: Re: [PATCH] tracing: add checks for printing graph irq

On Fri, Dec 11, 2009 at 05:38:35PM +0800, Wenji Huang wrote:
> Check return value of trace_seq_printf.
>
> Signed-off-by: Wenji Huang <[email protected]>
> ---


Thanks.

Acked-by: Frederic Weisbecker <[email protected]>

2009-12-11 11:19:50

by Frederic Weisbecker

[permalink] [raw]
Subject: Re: [PATCH] tracing: add checks for printing graph irq

On Fri, Dec 11, 2009 at 05:38:35PM +0800, Wenji Huang wrote:
> Check return value of trace_seq_printf.
>
> Signed-off-by: Wenji Huang <[email protected]>
> ---


I'm applying it, I'll send the fix for the problem you've reported
at the same time.

Thanks.

2009-12-11 15:00:26

by Steven Rostedt

[permalink] [raw]
Subject: Re: [PATCH] tracing: add checks for printing graph irq

On Fri, 2009-12-11 at 17:38 +0800, Wenji Huang wrote:
> Check return value of trace_seq_printf.
>
> Signed-off-by: Wenji Huang <[email protected]>
> ---
> kernel/trace/trace_functions_graph.c | 7 +++++--
> 1 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c
> index 45e6c01..3fa4055 100644
> --- a/kernel/trace/trace_functions_graph.c
> +++ b/kernel/trace/trace_functions_graph.c
> @@ -555,8 +555,11 @@ print_graph_irq(struct trace_iterator *iter, unsigned long addr,
> return TRACE_TYPE_PARTIAL_LINE;
>
> /* Don't close the duration column if haven't one */
> - if (tracer_flags.val & TRACE_GRAPH_PRINT_DURATION)
> - trace_seq_printf(s, " |");
> + if (tracer_flags.val & TRACE_GRAPH_PRINT_DURATION) {
> + ret = trace_seq_printf(s, " |");
> + if (!ret)
> + return TRACE_TYPE_PARTIAL_LINE;
> + }
> ret = trace_seq_printf(s, "\n");

Actually these checks are no longer needed. I would like to start
removing them. Only the last one is needed.

This is because trace_seq_* now has a "full" attribute. If the s buffer
gets full, it wont write anymore, and all new "trace_seq_*" calls will
return the same.

-- Steve

>
> if (!ret)

2009-12-11 15:00:50

by Steven Rostedt

[permalink] [raw]
Subject: Re: [PATCH] tracing: add checks for printing graph irq

On Fri, 2009-12-11 at 12:19 +0100, Frederic Weisbecker wrote:
> On Fri, Dec 11, 2009 at 05:38:35PM +0800, Wenji Huang wrote:
> > Check return value of trace_seq_printf.
> >
> > Signed-off-by: Wenji Huang <[email protected]>
> > ---
>
>
> I'm applying it, I'll send the fix for the problem you've reported
> at the same time.

As for my comment to the patch. Please do not apply this.

Thanks,

-- Steve

2009-12-11 17:44:35

by Frederic Weisbecker

[permalink] [raw]
Subject: Re: [PATCH] tracing: add checks for printing graph irq

On Fri, Dec 11, 2009 at 10:00:50AM -0500, Steven Rostedt wrote:
> On Fri, 2009-12-11 at 12:19 +0100, Frederic Weisbecker wrote:
> > On Fri, Dec 11, 2009 at 05:38:35PM +0800, Wenji Huang wrote:
> > > Check return value of trace_seq_printf.
> > >
> > > Signed-off-by: Wenji Huang <[email protected]>
> > > ---
> >
> >
> > I'm applying it, I'll send the fix for the problem you've reported
> > at the same time.
>
> As for my comment to the patch. Please do not apply this.
>
> Thanks,


Ok. Yeah you're right, the seq buffer will refuse them once
it's fullfilled anyway, so only the last check matters, we have
too much of these checks in the current code.