public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tracing: add checks for printing graph irq
@ 2009-12-11  9:38 Wenji Huang
  2009-12-11 11:18 ` Frederic Weisbecker
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Wenji Huang @ 2009-12-11  9:38 UTC (permalink / raw)
  To: linux-kernel; +Cc: rostedt, fweisbec, Wenji Huang

Check return value of trace_seq_printf.

Signed-off-by: Wenji Huang <wenji.huang@oracle.com>
---
 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


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

* Re: [PATCH] tracing: add checks for printing graph irq
  2009-12-11  9:38 [PATCH] tracing: add checks for printing graph irq Wenji Huang
@ 2009-12-11 11:18 ` Frederic Weisbecker
  2009-12-11 11:19 ` Frederic Weisbecker
  2009-12-11 15:00 ` Steven Rostedt
  2 siblings, 0 replies; 6+ messages in thread
From: Frederic Weisbecker @ 2009-12-11 11:18 UTC (permalink / raw)
  To: Wenji Huang; +Cc: linux-kernel, rostedt

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 <wenji.huang@oracle.com>
> ---


Thanks.

Acked-by: Frederic Weisbecker <fweisbec@gmail.com>


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

* Re: [PATCH] tracing: add checks for printing graph irq
  2009-12-11  9:38 [PATCH] tracing: add checks for printing graph irq Wenji Huang
  2009-12-11 11:18 ` Frederic Weisbecker
@ 2009-12-11 11:19 ` Frederic Weisbecker
  2009-12-11 15:00   ` Steven Rostedt
  2009-12-11 15:00 ` Steven Rostedt
  2 siblings, 1 reply; 6+ messages in thread
From: Frederic Weisbecker @ 2009-12-11 11:19 UTC (permalink / raw)
  To: Wenji Huang; +Cc: linux-kernel, rostedt

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 <wenji.huang@oracle.com>
> ---


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

Thanks.


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

* Re: [PATCH] tracing: add checks for printing graph irq
  2009-12-11  9:38 [PATCH] tracing: add checks for printing graph irq Wenji Huang
  2009-12-11 11:18 ` Frederic Weisbecker
  2009-12-11 11:19 ` Frederic Weisbecker
@ 2009-12-11 15:00 ` Steven Rostedt
  2 siblings, 0 replies; 6+ messages in thread
From: Steven Rostedt @ 2009-12-11 15:00 UTC (permalink / raw)
  To: Wenji Huang; +Cc: linux-kernel, fweisbec

On Fri, 2009-12-11 at 17:38 +0800, Wenji Huang wrote:
> Check return value of trace_seq_printf.
> 
> Signed-off-by: Wenji Huang <wenji.huang@oracle.com>
> ---
>  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)



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

* Re: [PATCH] tracing: add checks for printing graph irq
  2009-12-11 11:19 ` Frederic Weisbecker
@ 2009-12-11 15:00   ` Steven Rostedt
  2009-12-11 17:44     ` Frederic Weisbecker
  0 siblings, 1 reply; 6+ messages in thread
From: Steven Rostedt @ 2009-12-11 15:00 UTC (permalink / raw)
  To: Frederic Weisbecker; +Cc: Wenji Huang, linux-kernel

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 <wenji.huang@oracle.com>
> > ---
> 
> 
> 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



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

* Re: [PATCH] tracing: add checks for printing graph irq
  2009-12-11 15:00   ` Steven Rostedt
@ 2009-12-11 17:44     ` Frederic Weisbecker
  0 siblings, 0 replies; 6+ messages in thread
From: Frederic Weisbecker @ 2009-12-11 17:44 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: Wenji Huang, linux-kernel

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 <wenji.huang@oracle.com>
> > > ---
> > 
> > 
> > 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.


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

end of thread, other threads:[~2009-12-11 17:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-11  9:38 [PATCH] tracing: add checks for printing graph irq Wenji Huang
2009-12-11 11:18 ` Frederic Weisbecker
2009-12-11 11:19 ` Frederic Weisbecker
2009-12-11 15:00   ` Steven Rostedt
2009-12-11 17:44     ` Frederic Weisbecker
2009-12-11 15:00 ` Steven Rostedt

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