mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/4] [GIT PULL] tracing: various fixes
@ 2009-10-23 23:36 Steven Rostedt
  2009-10-23 23:36 ` [PATCH 1/4] [PATCH 1/4] tracing: updating *ppos instead of filp->f_pos Steven Rostedt
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Steven Rostedt @ 2009-10-23 23:36 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton, Frederic Weisbecker


Ingo,

Please pull the latest tip/tracing/core tree, which can be found at:

  git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace.git
tip/tracing/core


Jiri Olsa (4):
      tracing: updating *ppos instead of filp->f_pos
      tracing: fix trace_seq_printf return value
      tracing: comment typo and documentation example fix
      tracing: removing cpu arg from rb_time_stamp function

----
 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    |    5 ++++-
 6 files changed, 18 insertions(+), 13 deletions(-)

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

* [PATCH 1/4] [PATCH 1/4] tracing: updating *ppos instead of filp->f_pos
  2009-10-23 23:36 [PATCH 0/4] [GIT PULL] tracing: various fixes Steven Rostedt
@ 2009-10-23 23:36 ` Steven Rostedt
  2009-10-23 23:36 ` [PATCH 2/4] [PATCH 2/4] tracing: fix trace_seq_printf return value Steven Rostedt
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Steven Rostedt @ 2009-10-23 23:36 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton, Frederic Weisbecker, Jiri Olsa

[-- Attachment #1: 0001-tracing-updating-ppos-instead-of-filp-f_pos.patch --]
[-- Type: text/plain, Size: 1715 bytes --]

From: Jiri Olsa <jolsa@redhat.com>

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.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
LKML-Reference: <1256135801-1849-2-git-send-email-jolsa@redhat.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 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.3.3



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

* [PATCH 2/4] [PATCH 2/4] tracing: fix trace_seq_printf return value
  2009-10-23 23:36 [PATCH 0/4] [GIT PULL] tracing: various fixes Steven Rostedt
  2009-10-23 23:36 ` [PATCH 1/4] [PATCH 1/4] tracing: updating *ppos instead of filp->f_pos Steven Rostedt
@ 2009-10-23 23:36 ` Steven Rostedt
  2009-10-23 23:36 ` [PATCH 3/4] [PATCH 3/4] tracing: comment typo and documentation example fix Steven Rostedt
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Steven Rostedt @ 2009-10-23 23:36 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton, Frederic Weisbecker, Jiri Olsa

[-- Attachment #1: 0002-tracing-fix-trace_seq_printf-return-value.patch --]
[-- Type: text/plain, Size: 1667 bytes --]

From: Jiri Olsa <jolsa@redhat.com>

trace_seq_printf return value is a little ambiguous. It currently
returns the length of the space available in the buffer. printf
usually returns the amount written. This is not adequate here, because

  trace_seq_printf(s, "");

is perfectly legal, and returning 0 would indicate that it failed.

We can always see the amount written by looking at the before and after
values of s->len. This is not quite the same use as printf. We only care
if the string was successfully written to the buffer or not.

Making trace_seq_printf return 0 if the trace oversizes the buffer's free
space, 1 otherwise.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
LKML-Reference: <20091022120958.GB2311@jolsa.redhat.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 kernel/trace/trace_output.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

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);
 
-- 
1.6.3.3



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

* [PATCH 3/4] [PATCH 3/4] tracing: comment typo and documentation example fix
  2009-10-23 23:36 [PATCH 0/4] [GIT PULL] tracing: various fixes Steven Rostedt
  2009-10-23 23:36 ` [PATCH 1/4] [PATCH 1/4] tracing: updating *ppos instead of filp->f_pos Steven Rostedt
  2009-10-23 23:36 ` [PATCH 2/4] [PATCH 2/4] tracing: fix trace_seq_printf return value Steven Rostedt
@ 2009-10-23 23:36 ` Steven Rostedt
  2009-10-23 23:36 ` [PATCH 4/4] [PATCH 4/4] tracing: removing cpu arg from rb_time_stamp function Steven Rostedt
  2009-10-24  9:08 ` [PATCH 0/4] [GIT PULL] tracing: various fixes Ingo Molnar
  4 siblings, 0 replies; 6+ messages in thread
From: Steven Rostedt @ 2009-10-23 23:36 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton, Frederic Weisbecker, Jiri Olsa

[-- Attachment #1: 0003-tracing-comment-typo-and-documentation-example-fix.patch --]
[-- Type: text/plain, Size: 1496 bytes --]

From: Jiri Olsa <jolsa@redhat.com>

Trivial patch to fix a documentation example and fixes a comment.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
LKML-Reference: <1256135801-1849-4-git-send-email-jolsa@redhat.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 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 d4ff019..217f699 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -2681,7 +2681,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.3.3



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

* [PATCH 4/4] [PATCH 4/4] tracing: removing cpu arg from rb_time_stamp function
  2009-10-23 23:36 [PATCH 0/4] [GIT PULL] tracing: various fixes Steven Rostedt
                   ` (2 preceding siblings ...)
  2009-10-23 23:36 ` [PATCH 3/4] [PATCH 3/4] tracing: comment typo and documentation example fix Steven Rostedt
@ 2009-10-23 23:36 ` Steven Rostedt
  2009-10-24  9:08 ` [PATCH 0/4] [GIT PULL] tracing: various fixes Ingo Molnar
  4 siblings, 0 replies; 6+ messages in thread
From: Steven Rostedt @ 2009-10-23 23:36 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton, Frederic Weisbecker, Jiri Olsa

[-- Attachment #1: 0004-tracing-removing-cpu-arg-from-rb_time_stamp-function.patch --]
[-- Type: text/plain, Size: 2573 bytes --]

From: Jiri Olsa <jolsa@redhat.com>

The cpu argument is not used inside rb_time_stamp function. Plus typo fix.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
LKML-Reference: <1256135801-1849-5-git-send-email-jolsa@redhat.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 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 217f699..3ffa502 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -483,7 +483,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;
@@ -494,7 +494,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;
@@ -599,7 +599,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
@@ -1868,7 +1868,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;
 	}
 
@@ -2111,7 +2111,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.3.3



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

* Re: [PATCH 0/4] [GIT PULL] tracing: various fixes
  2009-10-23 23:36 [PATCH 0/4] [GIT PULL] tracing: various fixes Steven Rostedt
                   ` (3 preceding siblings ...)
  2009-10-23 23:36 ` [PATCH 4/4] [PATCH 4/4] tracing: removing cpu arg from rb_time_stamp function Steven Rostedt
@ 2009-10-24  9:08 ` Ingo Molnar
  4 siblings, 0 replies; 6+ messages in thread
From: Ingo Molnar @ 2009-10-24  9:08 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: linux-kernel, Andrew Morton, Frederic Weisbecker


* Steven Rostedt <rostedt@goodmis.org> wrote:

> 
> Ingo,
> 
> Please pull the latest tip/tracing/core tree, which can be found at:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace.git
> tip/tracing/core
> 
> 
> Jiri Olsa (4):
>       tracing: updating *ppos instead of filp->f_pos
>       tracing: fix trace_seq_printf return value
>       tracing: comment typo and documentation example fix
>       tracing: removing cpu arg from rb_time_stamp function
> 
> ----
>  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    |    5 ++++-
>  6 files changed, 18 insertions(+), 13 deletions(-)

Applied, thanks Steve!

	Ingo

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

end of thread, other threads:[~2009-10-24  9:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-23 23:36 [PATCH 0/4] [GIT PULL] tracing: various fixes Steven Rostedt
2009-10-23 23:36 ` [PATCH 1/4] [PATCH 1/4] tracing: updating *ppos instead of filp->f_pos Steven Rostedt
2009-10-23 23:36 ` [PATCH 2/4] [PATCH 2/4] tracing: fix trace_seq_printf return value Steven Rostedt
2009-10-23 23:36 ` [PATCH 3/4] [PATCH 3/4] tracing: comment typo and documentation example fix Steven Rostedt
2009-10-23 23:36 ` [PATCH 4/4] [PATCH 4/4] tracing: removing cpu arg from rb_time_stamp function Steven Rostedt
2009-10-24  9:08 ` [PATCH 0/4] [GIT PULL] tracing: various fixes Ingo Molnar

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

Powered by JetHome