boot tracer updates
Steven Rostedt
maintainercover boot tracer updates
Ingo,
The following patches are in:
git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace.git
branch: tip/devel
Frederic Weisbecker (2):
tracing/fastboot: Move boot tracer structs and funcs into their own header. tracing/fastboot: Use the ring-buffer timestamp for initcall entries
----
include/linux/ftrace.h | 41 --------------- include/trace/boot.h | 56 ++++++++++++++++++++ init/main.c | 33 +++++++------ kernel/trace/trace.h | 16 ++++-- kernel/trace/trace_boot.c | 123 ++++++++++++++++++++++++++++++++++----------- 5 files changed, 179 insertions(+), 90 deletions(-)
Steven Rostedt
maintainerPATCH 1/2 tracing/fastboot: Move boot tracer structs and funcs into their own header.
Impact: Cleanups on the boot tracer and ftrace
This patch bring some cleanups about the boot tracer headers. The functions and structures of this tracer have nothing related to ftrace and should have so their own header file.
--- include/linux/ftrace.h | 41 ----------------------------------------- include/trace/boot.h | 43 +++++++++++++++++++++++++++++++++++++++++++ init/main.c | 1 + kernel/trace/trace.h | 1 + 4 files changed, 45 insertions(+), 41 deletions(-) create mode 100644 include/trace/boot.h
include/linux/ftrace.h +0 -41
@@ -287,45 +287,4 @@ extern trace_function_return_t ftrace_function_return;extern void unregister_ftrace_return (void );#endif -/* -* Structure which defines the trace of an initcall. -* You don't have to fill the func field since it is -* only used internally by the tracer. -*/ -struct boot_trace { -pid_t caller; -char func[KSYM_NAME_LEN ]; -int result; -unsigned long long duration;/* usecs */ -ktime_t calltime; -ktime_t rettime; -}; - -#ifdef CONFIG_BOOT_TRACER -/* Append the trace on the ring-buffer */ -extern void trace_boot (struct boot_trace *it,initcall_t fn); - -/* Tells the tracer that smp_pre_initcall is finished. -* So we can start the tracing -*/ -extern void start_boot_trace (void ); - -/* Resume the tracing of other necessary events -* such as sched switches -*/ -extern void enable_boot_trace (void ); - -/* Suspend this tracing. Actually, only sched_switches tracing have -* to be suspended. Initcalls doesn't need it.) -*/ -extern void disable_boot_trace (void ); -#else -static inline void trace_boot (struct boot_trace *it,initcall_t fn) { } -static inline void start_boot_trace (void ) { } -static inline void enable_boot_trace (void ) { } -static inline void disable_boot_trace (void ) { } -#endif - - -#endif /* _LINUX_FTRACE_H */
include/trace/boot.h new file +43 -0
43 lines not on this page · raw message
init/main.c +1 -0
@@ -65,6 +65,7 @@#include <linux/idr.h> #include <linux/kmemcheck.h> #include <linux/ftrace.h> +#include <trace/boot.h> #include <asm/io.h> #include <asm/bugs.h>
kernel/trace/trace.h +1 -0
@@ -8,6 +8,7 @@#include <linux/ring_buffer.h> #include <linux/mmiotrace.h> #include <linux/ftrace.h> +#include <trace/boot.h> enum trace_type { __TRACE_FIRST_TYPE =0 ,
Signature · 3 lines
1.5.6.5 --
Steven Rostedt
maintainerPATCH 2/2 tracing/fastboot: Use the ring-buffer timestamp for initcall entries
In reply to Steven RostedtImpact: Split the boot tracer entries in two parts: call and return
Now that we are using the sched tracer from the boot tracer, we want to use the same timestamp than the ring-buffer to have consistent time captures between sched events and initcall events.
So we get rid of the old time capture by the boot tracer and split the initcall events in two parts: call and return. This way we have the ring buffer timestamp of both.
There is an example of a trace in attachment.
--- include/trace/boot.h | 31 ++++++++--- init/main.c | 32 ++++++------ kernel/trace/trace.h | 15 ++++-- kernel/trace/trace_boot.c | 123 ++++++++++++++++++++++++++++++++++----------- 4 files changed, 143 insertions(+), 58 deletions(-)
include/trace/boot.h +22 -9
@@ -2,22 +2,30 @@#define _LINUX_TRACE_BOOT_H/* -* Structure which defines the trace of an initcall. +* Structure which defines the trace of an initcall +* while it is called. * You don't have to fill the func field since it is * only used internally by the tracer. */ -struct boot_trace { +struct boot_trace_call {pid_t caller;char func[KSYM_NAME_LEN ]; -int result; -unsigned long long duration;/* usecs */ -ktime_t calltime; -ktime_t rettime; +}; + +/* +* Structure which defines the trace of an initcall +* while it returns. +*/ +struct boot_trace_ret { +char func[KSYM_NAME_LEN ]; +int result; +unsigned long long duration; };#ifdef CONFIG_BOOT_TRACER -/* Append the trace on the ring-buffer */ -extern void trace_boot (struct boot_trace *it,initcall_t fn); +/* Append the traces on the ring-buffer */ +extern void trace_boot_call (struct boot_trace_call *bt,initcall_t fn); +extern void trace_boot_ret (struct boot_trace_ret *bt,initcall_t fn);/* Tells the tracer that smp_pre_initcall is finished. * So we can start the tracing
@@ -34,7 +42,12 @@ extern void enable_boot_trace(void);*/ extern void disable_boot_trace (void );#else -static inline void trace_boot (struct boot_trace *it,initcall_t fn) { } +static inline +void trace_boot_call (struct boot_trace_call *bt,initcall_t fn) { } + +static inline +void trace_boot_ret (struct boot_trace_ret *bt,initcall_t fn) { } +static inline void start_boot_trace (void ) { }static inline void enable_boot_trace (void ) { }static inline void disable_boot_trace (void ) { }
init/main.c +17 -15
@@ -712,33 +712,35 @@ core_param(initcall_debug, initcall_debug, bool, 0644);int do_one_initcall (initcall_t fn) {int count =preempt_count (); -ktime_t delta; +ktime_t calltime, delta, rettime;char msgbuf[64 ]; -struct boot_trace it; +struct boot_trace_call call; +struct boot_trace_ret ret;if (initcall_debug) { - it.caller =task_pid_nr (current); -printk ("calling %pF @ %i\n" , fn, it.caller); - it.calltime =ktime_get (); + call.caller =task_pid_nr (current); +printk ("calling %pF @ %i\n" , fn, call.caller); + calltime =ktime_get (); +trace_boot_call (&call, fn);enable_boot_trace (); } - it.result =fn (); + ret.result =fn ();if (initcall_debug) { - it.rettime =ktime_get (); - delta =ktime_sub (it.rettime, it.calltime); - it.duration = (unsigned long long ) delta.tv64 >>10 ; -printk ("initcall %pF returned %d after %Ld usecs\n" , fn, - it.result, it.duration); -trace_boot (&it, fn);disable_boot_trace (); + rettime =ktime_get (); + delta =ktime_sub (rettime, calltime); + ret.duration = (unsigned long long ) delta.tv64 >>10 ; +trace_boot_ret (&ret, fn); +printk ("initcall %pF returned %d after %Ld usecs\n" , fn, + ret.result, ret.duration); } msgbuf[0 ] =0 ; -if (it.result && it.result != -ENODEV && initcall_debug) -sprintf (msgbuf,"error code %d " , it.result); +if (ret.result && ret.result != -ENODEV && initcall_debug) +sprintf (msgbuf,"error code %d " , ret.result);if (preempt_count () != count) {strlcat (msgbuf,"preemption imbalance " ,sizeof (msgbuf));
@@ -752,7 +754,7 @@ int do_one_initcall(initcall_t fn)printk ("initcall %pF returned with %s\n" , fn, msgbuf); } -return it.result; +return ret.result; }
kernel/trace/trace.h +11 -4
@@ -23,7 +23,8 @@ enum trace_type {TRACE_MMIO_RW ,TRACE_MMIO_MAP ,TRACE_UNLIKELY , -TRACE_BOOT , +TRACE_BOOT_CALL , +TRACE_BOOT_RET ,TRACE_FN_RET , __TRACE_LAST_TYPE
@@ -124,9 +125,14 @@ struct trace_mmiotrace_map {struct mmiotrace_map map; }; -struct trace_boot { +struct trace_boot_call {struct trace_entry ent; -struct boot_trace initcall; +struct boot_trace_call boot_call; +}; + +struct trace_boot_ret { +struct trace_entry ent; +struct boot_trace_ret boot_ret; };#define TRACE_FUNC_SIZE 30
@@ -239,7 +245,8 @@ extern void __ftrace_bad_type(void); TRACE_MMIO_RW); \ IF_ASSIGN(var, ent, struct trace_mmiotrace_map, \TRACE_MMIO_MAP ); \ - IF_ASSIGN(var, ent, struct trace_boot, TRACE_BOOT); \ + IF_ASSIGN(var, ent, struct trace_boot_call, TRACE_BOOT_CALL);\ + IF_ASSIGN(var, ent, struct trace_boot_ret, TRACE_BOOT_RET);\ IF_ASSIGN(var, ent, struct trace_unlikely, TRACE_UNLIKELY); \ IF_ASSIGN(var, ent, struct ftrace_ret_entry, TRACE_FN_RET); \__ftrace_bad_type (); \
kernel/trace/trace_boot.c +93 -30
156 lines not on this page · raw message
Signature · 3 lines
1.5.6.5 --
Re: [PATCH 2/2] tracing/fastboot: Use the ring-buffer timestamp for initcall entries
include/trace/boot.h line 22
Quoted 2 lines · On Wed, 12 Nov 2008 00:54:56 -0500 Steven Rostedt <[email protected]> wrote:
include/trace/boot.h +1
-1-unsigned long long duration;/* usecs */ +unsigned long long duration;
my hard-won comment got fragged.
Re: [PATCH 2/2] tracing/fastboot: Use the ring-buffer timestamp for initcall entries
2008/11/12 Andrew Morton <[email protected]>:
Quoted 6 lines · On Wed, 12 Nov 2008 00:54:56 -0500 Steven Rostedt <[email protected]> wrote:
include/trace/boot.h line 22
Quoted 3 lines
include/trace/boot.h +1
-1-unsigned long long duration;/* usecs */ +unsigned long long duration;my hard-won comment got fragged.
Oops. I forgot it.
Perhaps I should resend a patch that reset this comment? BTW it is nsecs actually.
Re: [PATCH 2/2] tracing/fastboot: Use the ring-buffer timestamp for initcall entries
Quoted 6 lines · Frédéric Weisbecker
2008/11/12 Andrew Morton <[email protected]>:
Quoted 5 lines · On Wed, 12 Nov 2008 00:54:56 -0500 Steven Rostedt <[email protected]> wrote:
Quoted 3 lines
include/trace/boot.h +1
-1-unsigned long long duration;/* usecs */ +unsigned long long duration;
Quoted 6 lines
Quoted 1 line
my hard-won comment got fragged.
Oops. I forgot it.
Perhaps I should resend a patch that reset this comment? BTW it is nsecs actually.
no need, i fixed it up when applying your patch to tracing/fastboot, and also changed it to nsecs.
Ingo
Re: [PATCH 2/2] tracing/fastboot: Use the ring-buffer timestamp for initcall entries
2008/11/12 Ingo Molnar <[email protected]>:
Quoted 12 lines · Frédéric Weisbecker
Quoted 10 lines
2008/11/12 Andrew Morton <[email protected]>:
Quoted 6 lines · On Wed, 12 Nov 2008 00:54:56 -0500 Steven Rostedt <[email protected]> wrote:
include/trace/boot.h line 22
Quoted 3 lines
include/trace/boot.h +1
-1-unsigned long long duration;/* usecs */ +unsigned long long duration;my hard-won comment got fragged.
Quoted 9 lines
Quoted 3 lines
Oops. I forgot it.
Perhaps I should resend a patch that reset this comment? BTW it is nsecs actually.no need, i fixed it up when applying your patch to tracing/fastboot, and also changed it to nsecs.
Ingo
Thanks Ingo.
2008/11/12 Steven Rostedt <[email protected]>:
Quoted 21 lines
Ingo,
The following patches are in:
git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace.gitbranch: tip/devel
Frederic Weisbecker (2):
tracing/fastboot: Move boot tracer structs and funcs into their own header. tracing/fastboot: Use the ring-buffer timestamp for initcall entries----
include/linux/ftrace.h | 41 --------------- include/trace/boot.h | 56 ++++++++++++++++++++ init/main.c | 33 +++++++------ kernel/trace/trace.h | 16 ++++-- kernel/trace/trace_boot.c | 123 ++++++++++++++++++++++++++++++++++----------- 5 files changed, 179 insertions(+), 90 deletions(-)
Quoted 6 lines
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Hi Steven,
I didn't know that your tree was the new first repository for tracing. Should I now send you all my tracing related
patches (including function return tracing?).
Thanks.