* [PATCH 0/4] tracing: couple of minor fixies
@ 2009-10-21 14:36 Jiri Olsa
2009-10-21 14:36 ` [PATCH 1/4] tracing: updating *ppos instead of filp->f_pos Jiri Olsa
` (4 more replies)
0 siblings, 5 replies; 12+ messages in thread
From: Jiri Olsa @ 2009-10-21 14:36 UTC (permalink / raw)
To: mingo, rostedt; +Cc: linux-kernel, Jiri Olsa
Hi,
sending few minor fixes.
1/4 - tracing: updating *ppos instead of filp->f_pos
2/4 - tracing: fix trace_seq_printf return value
3/4 - tracing: comment typo and documentation example fix
4/4 - tracing: removing cpu arg from rb_time_stamp function
wbr,
jirka
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
---
Documentation/trace/ftrace.txt | 2 ++
include/linux/trace_seq.h | 2 +-
kernel/trace/ftrace.c | 2 +-
kernel/trace/ring_buffer.c | 12 ++++++------
kernel/trace/trace.c | 8 ++++----
kernel/trace/trace_output.c | 2 +-
6 files changed, 15 insertions(+), 13 deletions(-)
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 1/4] tracing: updating *ppos instead of filp->f_pos
2009-10-21 14:36 [PATCH 0/4] tracing: couple of minor fixies Jiri Olsa
@ 2009-10-21 14:36 ` Jiri Olsa
2009-10-21 14:36 ` [PATCH 2/4] tracing: fix trace_seq_printf return value Jiri Olsa
` (3 subsequent siblings)
4 siblings, 0 replies; 12+ messages in thread
From: Jiri Olsa @ 2009-10-21 14:36 UTC (permalink / raw)
To: mingo, rostedt; +Cc: linux-kernel, Jiri Olsa
Instead of direct updating filp->f_pos we should update *ppos argument.
The filp->f_pos gets updated within the file_pos_write function called
from sys_write.
wbr,
jirka
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
---
kernel/trace/ftrace.c | 2 +-
kernel/trace/trace.c | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index b10c0d9..1ed514f 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -751,7 +751,7 @@ ftrace_profile_write(struct file *filp, const char __user *ubuf,
out:
mutex_unlock(&ftrace_profile_lock);
- filp->f_pos += cnt;
+ *ppos += cnt;
return cnt;
}
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 026e715..9d3067a 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -2440,7 +2440,7 @@ tracing_trace_options_write(struct file *filp, const char __user *ubuf,
return ret;
}
- filp->f_pos += cnt;
+ *ppos += cnt;
return cnt;
}
@@ -2582,7 +2582,7 @@ tracing_ctrl_write(struct file *filp, const char __user *ubuf,
}
mutex_unlock(&trace_types_lock);
- filp->f_pos += cnt;
+ *ppos += cnt;
return cnt;
}
@@ -2764,7 +2764,7 @@ tracing_set_trace_write(struct file *filp, const char __user *ubuf,
if (err)
return err;
- filp->f_pos += ret;
+ *ppos += ret;
return ret;
}
@@ -3299,7 +3299,7 @@ tracing_entries_write(struct file *filp, const char __user *ubuf,
}
}
- filp->f_pos += cnt;
+ *ppos += cnt;
/* If check pages failed, return ENOMEM */
if (tracing_disabled)
--
1.6.2.5
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 2/4] tracing: fix trace_seq_printf return value
2009-10-21 14:36 [PATCH 0/4] tracing: couple of minor fixies Jiri Olsa
2009-10-21 14:36 ` [PATCH 1/4] tracing: updating *ppos instead of filp->f_pos Jiri Olsa
@ 2009-10-21 14:36 ` Jiri Olsa
2009-10-21 16:20 ` Steven Rostedt
2009-10-21 14:36 ` [PATCH 3/4] tracing: comment typo and documentation example fix Jiri Olsa
` (2 subsequent siblings)
4 siblings, 1 reply; 12+ messages in thread
From: Jiri Olsa @ 2009-10-21 14:36 UTC (permalink / raw)
To: mingo, rostedt; +Cc: linux-kernel, Jiri Olsa
I believe we want to return the number of written characters,
instead of the available buffer length.
wbr,
jirka
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
---
kernel/trace/trace_output.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c
index ed17565..e871125 100644
--- a/kernel/trace/trace_output.c
+++ b/kernel/trace/trace_output.c
@@ -95,7 +95,7 @@ trace_seq_printf(struct trace_seq *s, const char *fmt, ...)
s->len += ret;
- return len;
+ return ret;
}
EXPORT_SYMBOL_GPL(trace_seq_printf);
--
1.6.2.5
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 3/4] tracing: comment typo and documentation example fix
2009-10-21 14:36 [PATCH 0/4] tracing: couple of minor fixies Jiri Olsa
2009-10-21 14:36 ` [PATCH 1/4] tracing: updating *ppos instead of filp->f_pos Jiri Olsa
2009-10-21 14:36 ` [PATCH 2/4] tracing: fix trace_seq_printf return value Jiri Olsa
@ 2009-10-21 14:36 ` Jiri Olsa
2009-10-21 14:36 ` [PATCH 4/4] tracing: removing cpu arg from rb_time_stamp function Jiri Olsa
2009-10-21 16:25 ` [PATCH 0/4] tracing: couple of minor fixies Steven Rostedt
4 siblings, 0 replies; 12+ messages in thread
From: Jiri Olsa @ 2009-10-21 14:36 UTC (permalink / raw)
To: mingo, rostedt; +Cc: linux-kernel, Jiri Olsa
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
---
Documentation/trace/ftrace.txt | 2 ++
kernel/trace/ring_buffer.c | 2 +-
2 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/Documentation/trace/ftrace.txt b/Documentation/trace/ftrace.txt
index 957b22f..8179692 100644
--- a/Documentation/trace/ftrace.txt
+++ b/Documentation/trace/ftrace.txt
@@ -1231,6 +1231,7 @@ something like this simple program:
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
+#include <string.h>
#define _STR(x) #x
#define STR(x) _STR(x)
@@ -1265,6 +1266,7 @@ const char *find_debugfs(void)
return NULL;
}
+ strcat(debugfs, "/tracing/");
debugfs_found = 1;
return debugfs;
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index e43c928..d33e5ca 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -2684,7 +2684,7 @@ unsigned long ring_buffer_entries(struct ring_buffer *buffer)
EXPORT_SYMBOL_GPL(ring_buffer_entries);
/**
- * ring_buffer_overrun_cpu - get the number of overruns in buffer
+ * ring_buffer_overruns - get the number of overruns in buffer
* @buffer: The ring buffer
*
* Returns the total number of overruns in the ring buffer
--
1.6.2.5
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 4/4] tracing: removing cpu arg from rb_time_stamp function
2009-10-21 14:36 [PATCH 0/4] tracing: couple of minor fixies Jiri Olsa
` (2 preceding siblings ...)
2009-10-21 14:36 ` [PATCH 3/4] tracing: comment typo and documentation example fix Jiri Olsa
@ 2009-10-21 14:36 ` Jiri Olsa
2009-10-21 16:24 ` Steven Rostedt
2009-10-21 16:25 ` [PATCH 0/4] tracing: couple of minor fixies Steven Rostedt
4 siblings, 1 reply; 12+ messages in thread
From: Jiri Olsa @ 2009-10-21 14:36 UTC (permalink / raw)
To: mingo, rostedt; +Cc: linux-kernel, Jiri Olsa
The cpu argument is not used inside rb_time_stamp function. Plus typo fix.
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
---
include/linux/trace_seq.h | 2 +-
kernel/trace/ring_buffer.c | 10 +++++-----
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/include/linux/trace_seq.h b/include/linux/trace_seq.h
index c134dd1..09077f6 100644
--- a/include/linux/trace_seq.h
+++ b/include/linux/trace_seq.h
@@ -7,7 +7,7 @@
/*
* Trace sequences are used to allow a function to call several other functions
- * to create a string of data to use (up to a max of PAGE_SIZE.
+ * to create a string of data to use (up to a max of PAGE_SIZE).
*/
struct trace_seq {
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index d33e5ca..63446f1 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -486,7 +486,7 @@ struct ring_buffer_iter {
/* Up this if you want to test the TIME_EXTENTS and normalization */
#define DEBUG_SHIFT 0
-static inline u64 rb_time_stamp(struct ring_buffer *buffer, int cpu)
+static inline u64 rb_time_stamp(struct ring_buffer *buffer)
{
/* shift to debug/test normalization and TIME_EXTENTS */
return buffer->clock() << DEBUG_SHIFT;
@@ -497,7 +497,7 @@ u64 ring_buffer_time_stamp(struct ring_buffer *buffer, int cpu)
u64 time;
preempt_disable_notrace();
- time = rb_time_stamp(buffer, cpu);
+ time = rb_time_stamp(buffer);
preempt_enable_no_resched_notrace();
return time;
@@ -602,7 +602,7 @@ static struct list_head *rb_list_head(struct list_head *list)
}
/*
- * rb_is_head_page - test if the give page is the head page
+ * rb_is_head_page - test if the given page is the head page
*
* Because the reader may move the head_page pointer, we can
* not trust what the head page is (it may be pointing to
@@ -1871,7 +1871,7 @@ rb_move_tail(struct ring_buffer_per_cpu *cpu_buffer,
* Nested commits always have zero deltas, so
* just reread the time stamp
*/
- *ts = rb_time_stamp(buffer, cpu_buffer->cpu);
+ *ts = rb_time_stamp(buffer);
next_page->page->time_stamp = *ts;
}
@@ -2114,7 +2114,7 @@ rb_reserve_next_event(struct ring_buffer *buffer,
if (RB_WARN_ON(cpu_buffer, ++nr_loops > 1000))
goto out_fail;
- ts = rb_time_stamp(cpu_buffer->buffer, cpu_buffer->cpu);
+ ts = rb_time_stamp(cpu_buffer->buffer);
/*
* Only the first commit can update the timestamp.
--
1.6.2.5
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/4] tracing: fix trace_seq_printf return value
2009-10-21 14:36 ` [PATCH 2/4] tracing: fix trace_seq_printf return value Jiri Olsa
@ 2009-10-21 16:20 ` Steven Rostedt
2009-10-21 22:02 ` Jiri Olsa
0 siblings, 1 reply; 12+ messages in thread
From: Steven Rostedt @ 2009-10-21 16:20 UTC (permalink / raw)
To: Jiri Olsa; +Cc: mingo, linux-kernel
On Wed, 2009-10-21 at 16:36 +0200, Jiri Olsa wrote:
> I believe we want to return the number of written characters,
> instead of the available buffer length.
>
> wbr,
> jirka
>
> Signed-off-by: Jiri Olsa <jolsa@redhat.com>
> ---
> kernel/trace/trace_output.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c
> index ed17565..e871125 100644
> --- a/kernel/trace/trace_output.c
> +++ b/kernel/trace/trace_output.c
> @@ -95,7 +95,7 @@ trace_seq_printf(struct trace_seq *s, const char *fmt, ...)
>
> s->len += ret;
>
> - return len;
> + return ret;
Actually the return value here is ambiguous. Returning len is actually
safer. It probably should only return 0 (buffer not big enough to write
to) or 1 (buffer is big enough).
Because this should actually return non zero:
trace_seq_printf(s, "");
-- Steve
> }
> EXPORT_SYMBOL_GPL(trace_seq_printf);
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 4/4] tracing: removing cpu arg from rb_time_stamp function
2009-10-21 14:36 ` [PATCH 4/4] tracing: removing cpu arg from rb_time_stamp function Jiri Olsa
@ 2009-10-21 16:24 ` Steven Rostedt
0 siblings, 0 replies; 12+ messages in thread
From: Steven Rostedt @ 2009-10-21 16:24 UTC (permalink / raw)
To: Jiri Olsa; +Cc: mingo, linux-kernel
On Wed, 2009-10-21 at 16:36 +0200, Jiri Olsa wrote:
> The cpu argument is not used inside rb_time_stamp function. Plus typo fix.
>
> Signed-off-by: Jiri Olsa <jolsa@redhat.com>
> ---
> include/linux/trace_seq.h | 2 +-
> kernel/trace/ring_buffer.c | 10 +++++-----
> 2 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/include/linux/trace_seq.h b/include/linux/trace_seq.h
> index c134dd1..09077f6 100644
> --- a/include/linux/trace_seq.h
> +++ b/include/linux/trace_seq.h
> @@ -7,7 +7,7 @@
>
> /*
> * Trace sequences are used to allow a function to call several other functions
> - * to create a string of data to use (up to a max of PAGE_SIZE.
> + * to create a string of data to use (up to a max of PAGE_SIZE).
> */
>
> struct trace_seq {
> diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
> index d33e5ca..63446f1 100644
> --- a/kernel/trace/ring_buffer.c
> +++ b/kernel/trace/ring_buffer.c
> @@ -486,7 +486,7 @@ struct ring_buffer_iter {
> /* Up this if you want to test the TIME_EXTENTS and normalization */
> #define DEBUG_SHIFT 0
>
> -static inline u64 rb_time_stamp(struct ring_buffer *buffer, int cpu)
> +static inline u64 rb_time_stamp(struct ring_buffer *buffer)
> {
> /* shift to debug/test normalization and TIME_EXTENTS */
> return buffer->clock() << DEBUG_SHIFT;
> @@ -497,7 +497,7 @@ u64 ring_buffer_time_stamp(struct ring_buffer *buffer, int cpu)
> u64 time;
>
> preempt_disable_notrace();
> - time = rb_time_stamp(buffer, cpu);
> + time = rb_time_stamp(buffer);
Yeah, originally this was to deal with cpu_clock() which takes cpu as
its parameter. But we now just call "raw_smp_processor_id" instead
directly when using cpu_clock.
Thanks,
-- Steve
> preempt_enable_no_resched_notrace();
>
> return time;
> @@ -602,7 +602,7 @@ static struct list_head *rb_list_head(struct list_head *list)
> }
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 0/4] tracing: couple of minor fixies
2009-10-21 14:36 [PATCH 0/4] tracing: couple of minor fixies Jiri Olsa
` (3 preceding siblings ...)
2009-10-21 14:36 ` [PATCH 4/4] tracing: removing cpu arg from rb_time_stamp function Jiri Olsa
@ 2009-10-21 16:25 ` Steven Rostedt
4 siblings, 0 replies; 12+ messages in thread
From: Steven Rostedt @ 2009-10-21 16:25 UTC (permalink / raw)
To: Jiri Olsa; +Cc: mingo, linux-kernel
On Wed, 2009-10-21 at 16:36 +0200, Jiri Olsa wrote:
> Hi,
>
> sending few minor fixes.
>
> 1/4 - tracing: updating *ppos instead of filp->f_pos
> 2/4 - tracing: fix trace_seq_printf return value
> 3/4 - tracing: comment typo and documentation example fix
> 4/4 - tracing: removing cpu arg from rb_time_stamp function
Thanks,
I'll take 1,3 and 4. As 2 we should change it to return 0 or 1 and add a
comment to the use of it.
-- Steve
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/4] tracing: fix trace_seq_printf return value
2009-10-21 16:20 ` Steven Rostedt
@ 2009-10-21 22:02 ` Jiri Olsa
2009-10-21 22:14 ` Steven Rostedt
0 siblings, 1 reply; 12+ messages in thread
From: Jiri Olsa @ 2009-10-21 22:02 UTC (permalink / raw)
To: Steven Rostedt; +Cc: mingo, linux-kernel
On Wed, Oct 21, 2009 at 12:20:35PM -0400, Steven Rostedt wrote:
> On Wed, 2009-10-21 at 16:36 +0200, Jiri Olsa wrote:
> > I believe we want to return the number of written characters,
> > instead of the available buffer length.
> >
> > wbr,
> > jirka
> >
> > Signed-off-by: Jiri Olsa <jolsa@redhat.com>
> > ---
> > kernel/trace/trace_output.c | 2 +-
> > 1 files changed, 1 insertions(+), 1 deletions(-)
> >
> > diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c
> > index ed17565..e871125 100644
> > --- a/kernel/trace/trace_output.c
> > +++ b/kernel/trace/trace_output.c
> > @@ -95,7 +95,7 @@ trace_seq_printf(struct trace_seq *s, const char *fmt, ...)
> >
> > s->len += ret;
> >
> > - return len;
> > + return ret;
>
> Actually the return value here is ambiguous. Returning len is actually
> safer. It probably should only return 0 (buffer not big enough to write
> to) or 1 (buffer is big enough).
>
> Because this should actually return non zero:
>
> trace_seq_printf(s, "");
>
> -- Steve
>
> > }
> > EXPORT_SYMBOL_GPL(trace_seq_printf);
> >
>
I made the suggested fix, plus spot not used function.
---
Making trace_seq_printf return 0 if the trace oversizes the buffer's free
space, 1 otherwise. Removing not used trace_seq_vprintf function.
wbr,
jirka
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
---
include/linux/trace_seq.h | 2 --
kernel/trace/trace_output.c | 37 ++++---------------------------------
2 files changed, 4 insertions(+), 35 deletions(-)
diff --git a/include/linux/trace_seq.h b/include/linux/trace_seq.h
index c134dd1..6fc4651 100644
--- a/include/linux/trace_seq.h
+++ b/include/linux/trace_seq.h
@@ -29,8 +29,6 @@ trace_seq_init(struct trace_seq *s)
#ifdef CONFIG_TRACING
extern int trace_seq_printf(struct trace_seq *s, const char *fmt, ...)
__attribute__ ((format (printf, 2, 3)));
-extern int trace_seq_vprintf(struct trace_seq *s, const char *fmt, va_list args)
- __attribute__ ((format (printf, 2, 0)));
extern int
trace_seq_bprintf(struct trace_seq *s, const char *fmt, const u32 *binary);
extern void trace_print_seq(struct seq_file *m, struct trace_seq *s);
diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c
index ed17565..11bd0e5 100644
--- a/kernel/trace/trace_output.c
+++ b/kernel/trace/trace_output.c
@@ -69,6 +69,9 @@ enum print_line_t trace_print_printk_msg_only(struct trace_iterator *iter)
* @s: trace sequence descriptor
* @fmt: printf format string
*
+ * It returns 0 if the trace oversizes the buffer's free
+ * space, 1 otherwise.
+ *
* The tracer may use either sequence operations or its own
* copy to user routines. To simplify formating of a trace
* trace_seq_printf is used to store strings into a special
@@ -95,42 +98,10 @@ trace_seq_printf(struct trace_seq *s, const char *fmt, ...)
s->len += ret;
- return len;
+ return 1;
}
EXPORT_SYMBOL_GPL(trace_seq_printf);
-/**
- * trace_seq_vprintf - sequence printing of trace information
- * @s: trace sequence descriptor
- * @fmt: printf format string
- *
- * The tracer may use either sequence operations or its own
- * copy to user routines. To simplify formating of a trace
- * trace_seq_printf is used to store strings into a special
- * buffer (@s). Then the output may be either used by
- * the sequencer or pulled into another buffer.
- */
-int
-trace_seq_vprintf(struct trace_seq *s, const char *fmt, va_list args)
-{
- int len = (PAGE_SIZE - 1) - s->len;
- int ret;
-
- if (!len)
- return 0;
-
- ret = vsnprintf(s->buffer + s->len, len, fmt, args);
-
- /* If we can't write it all, don't bother writing anything */
- if (ret >= len)
- return 0;
-
- s->len += ret;
-
- return len;
-}
-EXPORT_SYMBOL_GPL(trace_seq_vprintf);
-
int trace_seq_bprintf(struct trace_seq *s, const char *fmt, const u32 *binary)
{
int len = (PAGE_SIZE - 1) - s->len;
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/4] tracing: fix trace_seq_printf return value
2009-10-21 22:02 ` Jiri Olsa
@ 2009-10-21 22:14 ` Steven Rostedt
2009-10-22 12:09 ` Jiri Olsa
0 siblings, 1 reply; 12+ messages in thread
From: Steven Rostedt @ 2009-10-21 22:14 UTC (permalink / raw)
To: Jiri Olsa; +Cc: mingo, linux-kernel
On Thu, 2009-10-22 at 00:02 +0200, Jiri Olsa wrote:
> On Wed, Oct 21, 2009 at 12:20:35PM -0400, Steven Rostedt wrote:
> > On Wed, 2009-10-21 at 16:36 +0200, Jiri Olsa wrote:
> > > I believe we want to return the number of written characters,
> > > instead of the available buffer length.
> > >
> > > wbr,
> > > jirka
> > >
> > > Signed-off-by: Jiri Olsa <jolsa@redhat.com>
> > > ---
> > > kernel/trace/trace_output.c | 2 +-
> > > 1 files changed, 1 insertions(+), 1 deletions(-)
> > >
> > > diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c
> > > index ed17565..e871125 100644
> > > --- a/kernel/trace/trace_output.c
> > > +++ b/kernel/trace/trace_output.c
> > > @@ -95,7 +95,7 @@ trace_seq_printf(struct trace_seq *s, const char *fmt, ...)
> > >
> > > s->len += ret;
> > >
> > > - return len;
> > > + return ret;
> >
> > Actually the return value here is ambiguous. Returning len is actually
> > safer. It probably should only return 0 (buffer not big enough to write
> > to) or 1 (buffer is big enough).
> >
> > Because this should actually return non zero:
> >
> > trace_seq_printf(s, "");
> >
> > -- Steve
> >
> > > }
> > > EXPORT_SYMBOL_GPL(trace_seq_printf);
> > >
> >
>
> I made the suggested fix, plus spot not used function.
>
> ---
> Making trace_seq_printf return 0 if the trace oversizes the buffer's free
> space, 1 otherwise. Removing not used trace_seq_vprintf function.
err, I hate to remove that function. This is a utility file that is
exported for other parts of the kernel to use. At least make that a
separate patch.
-- Steve
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/4] tracing: fix trace_seq_printf return value
2009-10-21 22:14 ` Steven Rostedt
@ 2009-10-22 12:09 ` Jiri Olsa
2009-10-22 12:51 ` Steven Rostedt
0 siblings, 1 reply; 12+ messages in thread
From: Jiri Olsa @ 2009-10-22 12:09 UTC (permalink / raw)
To: Steven Rostedt; +Cc: mingo, linux-kernel
On Wed, Oct 21, 2009 at 06:14:07PM -0400, Steven Rostedt wrote:
> On Thu, 2009-10-22 at 00:02 +0200, Jiri Olsa wrote:
> > On Wed, Oct 21, 2009 at 12:20:35PM -0400, Steven Rostedt wrote:
> > > On Wed, 2009-10-21 at 16:36 +0200, Jiri Olsa wrote:
> > > > I believe we want to return the number of written characters,
> > > > instead of the available buffer length.
> > > >
> > > > wbr,
> > > > jirka
> > > >
> > > > Signed-off-by: Jiri Olsa <jolsa@redhat.com>
> > > > ---
> > > > kernel/trace/trace_output.c | 2 +-
> > > > 1 files changed, 1 insertions(+), 1 deletions(-)
> > > >
> > > > diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c
> > > > index ed17565..e871125 100644
> > > > --- a/kernel/trace/trace_output.c
> > > > +++ b/kernel/trace/trace_output.c
> > > > @@ -95,7 +95,7 @@ trace_seq_printf(struct trace_seq *s, const char *fmt, ...)
> > > >
> > > > s->len += ret;
> > > >
> > > > - return len;
> > > > + return ret;
> > >
> > > Actually the return value here is ambiguous. Returning len is actually
> > > safer. It probably should only return 0 (buffer not big enough to write
> > > to) or 1 (buffer is big enough).
> > >
> > > Because this should actually return non zero:
> > >
> > > trace_seq_printf(s, "");
> > >
> > > -- Steve
> > >
> > > > }
> > > > EXPORT_SYMBOL_GPL(trace_seq_printf);
> > > >
> > >
> >
> > I made the suggested fix, plus spot not used function.
> >
> > ---
> > Making trace_seq_printf return 0 if the trace oversizes the buffer's free
> > space, 1 otherwise. Removing not used trace_seq_vprintf function.
>
> err, I hate to remove that function. This is a utility file that is
> exported for other parts of the kernel to use. At least make that a
> separate patch.
np, sending out just the first part
jirka
---
Making trace_seq_printf return 0 if the trace oversizes the buffer's free
space, 1 otherwise.
wbr,
jirka
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
---
diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c
index ed17565..b6c12c6 100644
--- a/kernel/trace/trace_output.c
+++ b/kernel/trace/trace_output.c
@@ -69,6 +69,9 @@ enum print_line_t trace_print_printk_msg_only(struct trace_iterator *iter)
* @s: trace sequence descriptor
* @fmt: printf format string
*
+ * It returns 0 if the trace oversizes the buffer's free
+ * space, 1 otherwise.
+ *
* The tracer may use either sequence operations or its own
* copy to user routines. To simplify formating of a trace
* trace_seq_printf is used to store strings into a special
@@ -95,7 +98,7 @@ trace_seq_printf(struct trace_seq *s, const char *fmt, ...)
s->len += ret;
- return len;
+ return 1;
}
EXPORT_SYMBOL_GPL(trace_seq_printf);
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/4] tracing: fix trace_seq_printf return value
2009-10-22 12:09 ` Jiri Olsa
@ 2009-10-22 12:51 ` Steven Rostedt
0 siblings, 0 replies; 12+ messages in thread
From: Steven Rostedt @ 2009-10-22 12:51 UTC (permalink / raw)
To: Jiri Olsa; +Cc: mingo, linux-kernel
On Thu, 2009-10-22 at 14:09 +0200, Jiri Olsa wrote:
> > err, I hate to remove that function. This is a utility file that is
> > exported for other parts of the kernel to use. At least make that a
> > separate patch.
> np, sending out just the first part
Thanks, I'll pull you patches in today and queue them up for 2.6.33.
-- Steve
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2009-10-22 12:51 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-21 14:36 [PATCH 0/4] tracing: couple of minor fixies Jiri Olsa
2009-10-21 14:36 ` [PATCH 1/4] tracing: updating *ppos instead of filp->f_pos Jiri Olsa
2009-10-21 14:36 ` [PATCH 2/4] tracing: fix trace_seq_printf return value Jiri Olsa
2009-10-21 16:20 ` Steven Rostedt
2009-10-21 22:02 ` Jiri Olsa
2009-10-21 22:14 ` Steven Rostedt
2009-10-22 12:09 ` Jiri Olsa
2009-10-22 12:51 ` Steven Rostedt
2009-10-21 14:36 ` [PATCH 3/4] tracing: comment typo and documentation example fix Jiri Olsa
2009-10-21 14:36 ` [PATCH 4/4] tracing: removing cpu arg from rb_time_stamp function Jiri Olsa
2009-10-21 16:24 ` Steven Rostedt
2009-10-21 16:25 ` [PATCH 0/4] tracing: couple of minor fixies 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®