tracing: various fixes
Subsystems (4)
Steven Rostedt
maintainerIngo,
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(-)
Steven Rostedt
maintainerPATCH 1/4 tracing: updating *ppos instead of filp->f_pos
From: Jiri Olsa <[email protected]>
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.
LKML-Reference: <[email protected]>
--- kernel/trace/ftrace.c | 2 +- kernel/trace/trace.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-)
kernel/trace/ftrace.c +1 -1
@@ -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; }
kernel/trace/trace.c +4 -4
@@ -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)
Signature · 1 line
1.6.3.3
Steven Rostedt
maintainerPATCH 2/4 tracing: fix trace_seq_printf return value
In reply to Steven RostedtFrom: Jiri Olsa <[email protected]>
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.
LKML-Reference: <[email protected]>
--- kernel/trace/trace_output.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
kernel/trace/trace_output.c +4 -1
@@ -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);
Signature · 1 line
1.6.3.3
Steven Rostedt
maintainerPATCH 3/4 tracing: comment typo and documentation example fix
In reply to Steven RostedtFrom: Jiri Olsa <[email protected]>
Trivial patch to fix a documentation example and fixes a comment.
LKML-Reference: <[email protected]>
--- Documentation/trace/ftrace.txt | 2 ++ kernel/trace/ring_buffer.c | 2 +- 2 files changed, 3 insertions(+), 1 deletions(-)
Documentation/trace/ftrace.txt +2 -0
@@ -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;
kernel/trace/ring_buffer.c +1 -1
@@ -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
Signature · 1 line
1.6.3.3
Steven Rostedt
maintainerPATCH 4/4 tracing: removing cpu arg from rb_time_stamp function
In reply to Steven RostedtFrom: Jiri Olsa <[email protected]>
The cpu argument is not used inside rb_time_stamp function. Plus typo fix.
LKML-Reference: <[email protected]>
--- include/linux/trace_seq.h | 2 +- kernel/trace/ring_buffer.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-)
include/linux/trace_seq.h +1 -1
@@ -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 {
kernel/trace/ring_buffer.c +5 -5
@@ -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.
Signature · 1 line
1.6.3.3
Ingo Molnar
AppliedQuoted 15 lines · Steven Rostedt
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/coreJiri Olsa (4):
tracing: updating *ppos instead offilp->f_pos
tracing: fixtrace_seq_printfreturn value
tracing: comment typo and documentation example fix
tracing: removing cpu arg fromrb_time_stampfunction
Quoted 8 lines
----
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