for tip/tracing/core
Subsystems (6)
Steven Rostedt
maintainerPATCH 1/10 tracing: remove CALLER_ADDR2 from wakeup tracer
In reply to Steven RostedtFrom: Steven Rostedt <[email protected]>
Maneesh Soni was getting a crash when running the wakeup tracer. We debugged it down to the recording of the function with the CALLER_ADDR2 macro. This is used to get the location of the caller to schedule.
But the problem comes when schedule is called by assmebly. In the case that Maneesh had, retint_careful would call schedule. But retint_careful does not set up a proper frame pointer. CALLER_ADDR2 is defined as __builtin_return_address(2). This produces the following assembly in the wakeup tracer code.
mov 0x0(%rbp),%rcx <--- get the frame pointer of the caller mov %r14d,%r8d mov 0xf2de8e(%rip),%rdi
mov 0x8(%rcx),%rsi <-- this is __builtin_return_address(1)
mov 0x28(%rdi,%rax,8),%rbx
mov (%rcx),%rax <-- get the frame pointer of the caller's caller mov %r12,%rcx mov 0x8(%rax),%rdx <-- this is __builtin_return_address(2)
At the reading of 0x8(%rax) Maneesh's machine would take a fault. The reason is that retint_careful did not set up the return address and the content of %rax here was zero.
To verify this, I sent Maneesh a patch to create a frame pointer in retint_careful. He ran the test again but this time he would take the same type of fault from sysret_careful. The retint_careful was no longer an issue, but there are other callers that still have issues.
Instead of adding frame pointers for all callers to schedule (in possibly all archs), it is much safer to simply not use CALLER_ADDR2. This loses out on knowing what called schedule, but the function tracer will help there if needed.
--- kernel/trace/trace_sched_wakeup.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-)
kernel/trace/trace_sched_wakeup.c +7 -1
@@ -154,7 +154,7 @@ probe_wakeup_sched_switch(struct rq *rq, struct task_struct *prev,if (unlikely (!tracer_enabled || next != wakeup_task)) goto out_unlock; -trace_function (wakeup_trace,CALLER_ADDR1 ,CALLER_ADDR2 , flags, pc); +trace_function (wakeup_trace,CALLER_ADDR0 ,CALLER_ADDR1 , flags, pc);tracing_sched_switch_trace (wakeup_trace, prev, next, flags, pc);/*
@@ -257,6 +257,12 @@ probe_wakeup(struct rq *rq, struct task_struct *p, int success) data = wakeup_trace->data[wakeup_cpu]; data->preempt_timestamp =ftrace_now (cpu);tracing_sched_wakeup_trace (wakeup_trace, p, current, flags, pc); + +/* +* We must be careful in using CALLER_ADDR2. But since wake_up +* is not called by an assembly function (where as schedule is) +* it should be safe to use it here. +*/ trace_function (wakeup_trace,CALLER_ADDR1 ,CALLER_ADDR2 , flags, pc); out_locked:
Signature · 3 lines
1.6.2.1 --
Steven Rostedt
maintainerIngo,
These are the same patches I sent out earlier, but I rebased them to tip/tracing/core. I also changed my S-o-B to be [email protected] since I prefer email going to that address instead.
-- Steve
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
Frederic Weisbecker (2):
tracing/ftrace: fix missing include string.h tracing/ftrace: factorize the tracing files creation
Huang Weiyi (1):
tracing, x86: remove duplicated #include
Lai Jiangshan (1):
tracing: fix incorrect return type of ns2usecs() V2
Li Zefan (1):
tracing: use macros to denote usec and nsec per second
Steven Rostedt (3):
tracing: remove CALLER_ADDR2 from wakeup tracer
function-graph: add proper initialization for init task
function-graph: use int instead of atomic for ftrace_graph_active
Zhaolei (2):
ftrace: Add check of sched_stopped for probe_sched_wakeup
ftrace: Clean up enable logic for sched_switch
----
arch/x86/kernel/ftrace.c | 1 - include/linux/ftrace.h | 8 ++- include/linux/init_task.h | 2 + kernel/trace/ftrace.c | 53 ++++-------- kernel/trace/ring_buffer.c | 7 +- kernel/trace/trace.c | 163 ++++++++++++++---------------------- kernel/trace/trace.h | 8 ++- kernel/trace/trace_boot.c | 5 +- kernel/trace/trace_event_profile.c | 3 +- kernel/trace/trace_mmiotrace.c | 6 +- kernel/trace/trace_output.c | 2 +- kernel/trace/trace_printk.c | 6 +- kernel/trace/trace_sched_switch.c | 11 ++- kernel/trace/trace_sched_wakeup.c | 8 ++- kernel/trace/trace_stack.c | 13 +-- kernel/trace/trace_sysprof.c | 6 +- 16 files changed, 128 insertions(+), 174 deletions(-)
Steven Rostedt
maintainerPATCH 9/10 ftrace: Clean up enable logic for sched_switch
From: Zhaolei <[email protected]>
Unify sched_switch and sched_wakeup's action to following logic:
Do record_cmdline when start_cmdline_record() is called. Start tracing events when the tracer is started.
LKML-Reference: <[email protected]>
--- kernel/trace/trace_sched_switch.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-)
kernel/trace/trace_sched_switch.c +5 -5
@@ -29,13 +29,13 @@ probe_sched_switch(struct rq *__rq, struct task_struct *prev,int cpu;int pc; -if (!sched_ref || sched_stopped) +if (unlikely (!sched_ref))return ;tracing_record_cmdline (prev);tracing_record_cmdline (next); -if (!tracer_enabled) +if (!tracer_enabled || sched_stopped)return ; pc =preempt_count ();
@@ -56,15 +56,15 @@ probe_sched_wakeup(struct rq *__rq, struct task_struct *wakee, int success)unsigned long flags;int cpu, pc; -if (!likely (tracer_enabled)) +if (unlikely (!sched_ref))return ; - pc =preempt_count ();tracing_record_cmdline (current); -if (sched_stopped) +if (!tracer_enabled || sched_stopped)return ; + pc =preempt_count ();local_irq_save (flags); cpu =raw_smp_processor_id (); data = ctx_trace->data[cpu];
Signature · 3 lines
1.6.2.1 --
Steven Rostedt
maintainerPATCH 10/10 tracing, x86: remove duplicated #include
In reply to Steven RostedtFrom: Huang Weiyi <[email protected]>
Remove duplicated #include in arch/x86/kernel/ftrace.c.
LKML-Reference: <[email protected]>
--- arch/x86/kernel/ftrace.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
arch/x86/kernel/ftrace.c +0 -1
@@ -20,7 +20,6 @@#include <asm/cacheflush.h> #include <asm/ftrace.h> -#include <linux/ftrace.h> #include <asm/nops.h> #include <asm/nmi.h>
Signature · 3 lines
1.6.2.1 --
Steven Rostedt
maintainerPATCH 8/10 ftrace: Add check of sched_stopped for probe_sched_wakeup
In reply to Steven RostedtFrom: Zhaolei <[email protected]>
The wakeup tracing in sched_switch does not stop when a user disables tracing. This is because the probe_sched_wakeup() is missing the check to prevent the wakeup from being traced.
LKML-Reference: <[email protected]>
--- kernel/trace/trace_sched_switch.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
kernel/trace/trace_sched_switch.c +3 -0
@@ -62,6 +62,9 @@ probe_sched_wakeup(struct rq *__rq, struct task_struct *wakee, int success) pc =preempt_count ();tracing_record_cmdline (current); +if (sched_stopped) +return ; +local_irq_save (flags); cpu =raw_smp_processor_id (); data = ctx_trace->data[cpu];
Signature · 3 lines
1.6.2.1 --
Steven Rostedt
maintainerPATCH 7/10 function-graph: use int instead of atomic for ftrace_graph_active
In reply to Steven RostedtFrom: Steven Rostedt <[email protected]>
Impact: cleanup
The variable ftrace_graph_active is only modified under the ftrace_lock mutex, thus an atomic is not necessary for modification.
--- kernel/trace/ftrace.c | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-)
kernel/trace/ftrace.c +7 -7
@@ -3092,7 +3092,7 @@ ftrace_enable_sysctl(struct ctl_table *table, int write,#ifdef CONFIG_FUNCTION_GRAPH_TRACER -static atomic_t ftrace_graph_active; +static int ftrace_graph_active;static struct notifier_block ftrace_suspend_notifier;int ftrace_graph_entry_stub (struct ftrace_graph_ent *trace)
@@ -3244,7 +3244,7 @@ int register_ftrace_graph(trace_func_graph_ret_t retfunc,mutex_lock (&ftrace_lock);/* we currently allow only one tracer registered at a time */ -if (atomic_read (&ftrace_graph_active)) { +if (ftrace_graph_active) { ret = -EBUSY ; goto out; }
@@ -3252,10 +3252,10 @@ int register_ftrace_graph(trace_func_graph_ret_t retfunc, ftrace_suspend_notifier.notifier_call = ftrace_suspend_notifier_call;register_pm_notifier (&ftrace_suspend_notifier); -atomic_inc (&ftrace_graph_active); + ftrace_graph_active++; ret =start_graph_tracing ();if (ret) { -atomic_dec (&ftrace_graph_active); + ftrace_graph_active--; goto out; }
@@ -3273,10 +3273,10 @@ void unregister_ftrace_graph(void) {mutex_lock (&ftrace_lock); -if (!unlikely (atomic_read (&ftrace_graph_active))) +if (unlikely (!ftrace_graph_active)) goto out; -atomic_dec (&ftrace_graph_active); + ftrace_graph_active--;unregister_trace_sched_switch (ftrace_graph_probe_sched_switch); ftrace_graph_return = (trace_func_graph_ret_t )ftrace_stub; ftrace_graph_entry = ftrace_graph_entry_stub;
@@ -3290,7 +3290,7 @@ void unregister_ftrace_graph(void)/* Allocate a return stack for newly created task */ void ftrace_graph_init_task (struct task_struct *t) { -if (atomic_read (&ftrace_graph_active)) { +if (ftrace_graph_active) { t->ret_stack =kmalloc (FTRACE_RETFUNC_DEPTH *sizeof (struct ftrace_ret_stack ),GFP_KERNEL );
Signature · 3 lines
1.6.2.1 --
Steven Rostedt
maintainerPATCH 6/10 function-graph: add proper initialization for init task
In reply to Steven RostedtFrom: Steven Rostedt <[email protected]>
Impact: fix to crash going to kexec
The init task did not properly initialize the function graph pointers. Altough these pointers are NULL, they can not be assumed to be NULL for the init task, and must still be properly initialize.
This usually is not an issue since a problem only arises when a task exits, and the init tasks do not usually exit. But when doing tests with kexec, the init tasks do exit, and the bug appears.
This patch properly initializes the init tasks function graph data structures.
LKML-Reference: <[email protected]>
--- include/linux/ftrace.h | 8 ++++++-- include/linux/init_task.h | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-)
include/linux/ftrace.h +6 -2
@@ -356,6 +356,9 @@ struct ftrace_graph_ret {#ifdef CONFIG_FUNCTION_GRAPH_TRACER +/* for init task */ +#define INIT_FTRACE_GRAPH .ret_stack = NULL +/* * Stack of return addresses for functions * of a thread.
@@ -429,10 +432,11 @@ static inline void unpause_graph_tracing(void) {atomic_dec (¤t->tracing_graph_pause); } -#else +#else /* !CONFIG_FUNCTION_GRAPH_TRACER */ #define __notrace_funcgraph#define __irq_entry +#define INIT_FTRACE_GRAPH static inline void ftrace_graph_init_task (struct task_struct *t) { }static inline void ftrace_graph_exit_task (struct task_struct *t) { }
@@ -444,7 +448,7 @@ static inline int task_curr_ret_stack(struct task_struct *tsk)static inline void pause_graph_tracing (void ) { }static inline void unpause_graph_tracing (void ) { } -#endif +#endif /* CONFIG_FUNCTION_GRAPH_TRACER */ #ifdef CONFIG_TRACING #include <linux/sched.h>
include/linux/init_task.h +2 -0
@@ -5,6 +5,7 @@#include <linux/irqflags.h> #include <linux/utsname.h> #include <linux/lockdep.h> +#include <linux/ftrace.h> #include <linux/ipc.h> #include <linux/pid_namespace.h> #include <linux/user_namespace.h>
@@ -185,6 +186,7 @@ extern struct cred init_cred;INIT_IDS \ INIT_TRACE_IRQFLAGS \INIT_LOCKDEP \ + INIT_FTRACE_GRAPH \ }
Signature · 3 lines
1.6.2.1 --
Steven Rostedt
maintainerPATCH 5/10 tracing/ftrace: factorize the tracing files creation
In reply to Steven RostedtFrom: Frederic Weisbecker <[email protected]>
Impact: cleanup
Most of the tracing files creation follow the same pattern:
ret = debugfs_create_file(...)
if (!ret)
pr_warning("Couldn't create ... entry\n")
Unify it!
LKML-Reference: <[email protected]>
--- kernel/trace/ftrace.c | 39 ++------- kernel/trace/ring_buffer.c | 7 +- kernel/trace/trace.c | 159 ++++++++++++++---------------------- kernel/trace/trace.h | 6 ++ kernel/trace/trace_event_profile.c | 3 +- kernel/trace/trace_printk.c | 6 +- kernel/trace/trace_stack.c | 13 +-- kernel/trace/trace_sysprof.c | 6 +- 8 files changed, 88 insertions(+), 151 deletions(-)
kernel/trace/ftrace.c +10 -29
@@ -2698,38 +2698,23 @@ static const struct file_operations ftrace_graph_fops = {static __init int ftrace_init_dyn_debugfs (struct dentry *d_tracer) { -struct dentry *entry; - entry =debugfs_create_file ("available_filter_functions" ,0444 , - d_tracer,NULL , &ftrace_avail_fops); -if (!entry) -pr_warning ("Could not create debugfs " -"'available_filter_functions' entry\n" ); +trace_create_file ("available_filter_functions" ,0444 , + d_tracer,NULL , &ftrace_avail_fops); - entry =debugfs_create_file ("failures" ,0444 , - d_tracer,NULL , &ftrace_failures_fops); -if (!entry) -pr_warning ("Could not create debugfs 'failures' entry\n" ); +trace_create_file ("failures" ,0444 , + d_tracer,NULL , &ftrace_failures_fops); - entry =debugfs_create_file ("set_ftrace_filter" ,0644 , d_tracer, -NULL , &ftrace_filter_fops); -if (!entry) -pr_warning ("Could not create debugfs " -"'set_ftrace_filter' entry\n" ); +trace_create_file ("set_ftrace_filter" ,0644 , d_tracer, +NULL , &ftrace_filter_fops); - entry =debugfs_create_file ("set_ftrace_notrace" ,0644 , d_tracer, +trace_create_file ("set_ftrace_notrace" ,0644 , d_tracer,NULL , &ftrace_notrace_fops); -if (!entry) -pr_warning ("Could not create debugfs " -"'set_ftrace_notrace' entry\n" );#ifdef CONFIG_FUNCTION_GRAPH_TRACER - entry =debugfs_create_file ("set_graph_function" ,0444 , d_tracer, +trace_create_file ("set_graph_function" ,0444 , d_tracer,NULL , &ftrace_graph_fops); -if (!entry) -pr_warning ("Could not create debugfs " -"'set_graph_function' entry\n" );#endif /* CONFIG_FUNCTION_GRAPH_TRACER */ return 0 ;
@@ -2987,7 +2972,6 @@ static const struct file_operations ftrace_pid_fops = {static __init int ftrace_init_debugfs (void ) {struct dentry *d_tracer; -struct dentry *entry; d_tracer =tracing_init_dentry ();if (!d_tracer)
@@ -2995,11 +2979,8 @@ static __init int ftrace_init_debugfs(void)ftrace_init_dyn_debugfs (d_tracer); - entry =debugfs_create_file ("set_ftrace_pid" ,0644 , d_tracer, -NULL , &ftrace_pid_fops); -if (!entry) -pr_warning ("Could not create debugfs " -"'set_ftrace_pid' entry\n" ); +trace_create_file ("set_ftrace_pid" ,0644 , d_tracer, +NULL , &ftrace_pid_fops);ftrace_profile_debugfs (d_tracer);
kernel/trace/ring_buffer.c +2 -5
@@ -2845,14 +2845,11 @@ static const struct file_operations rb_simple_fops = {static __init int rb_init_debugfs (void ) {struct dentry *d_tracer; -struct dentry *entry; d_tracer =tracing_init_dentry (); - entry =debugfs_create_file ("tracing_on" ,0644 , d_tracer, - &ring_buffer_flags, &rb_simple_fops); -if (!entry) -pr_warning ("Could not create debugfs 'tracing_on' entry\n" ); +trace_create_file ("tracing_on" ,0644 , d_tracer, + &ring_buffer_flags, &rb_simple_fops);return 0 ; }
kernel/trace/trace.c +62 -97
237 lines not on this page · raw message
kernel/trace/trace.h +6 -0
@@ -470,6 +470,12 @@ void trace_wake_up(void);void tracing_reset (struct trace_array *tr,int cpu);void tracing_reset_online_cpus (struct trace_array *tr);int tracing_open_generic (struct inode *inode,struct file *filp); +struct dentry *trace_create_file (const char *name, +mode_t mode, +struct dentry *parent, +void *data, +const struct file_operations *fops); +struct dentry *tracing_init_dentry (void );void init_tracer_sysprof_debugfs (struct dentry *d_tracer);
kernel/trace/trace_event_profile.c +2 -1
@@ -6,7 +6,7 @@*/ #include "trace.h" - +#if 0 int ftrace_profile_enable (int event_id) {struct ftrace_event_call *event;
@@ -29,3 +29,4 @@ void ftrace_profile_disable(int event_id) } } +#endif
kernel/trace/trace_printk.c +1 -5
@@ -245,17 +245,13 @@ static const struct file_operations ftrace_formats_fops = {static __init int init_trace_printk_function_export (void ) {struct dentry *d_tracer; -struct dentry *entry; d_tracer =tracing_init_dentry ();if (!d_tracer)return 0 ; - entry =debugfs_create_file ("printk_formats" ,0444 , d_tracer, +trace_create_file ("printk_formats" ,0444 , d_tracer,NULL , &ftrace_formats_fops); -if (!entry) -pr_warning ("Could not create debugfs " -"'printk_formats' entry\n" );return 0 ; }
kernel/trace/trace_stack.c +4 -9
@@ -352,19 +352,14 @@ __setup("stacktrace", enable_stacktrace);static __init int stack_trace_init (void ) {struct dentry *d_tracer; -struct dentry *entry; d_tracer =tracing_init_dentry (); - entry =debugfs_create_file ("stack_max_size" ,0644 , d_tracer, - &max_stack_size, &stack_max_size_fops); -if (!entry) -pr_warning ("Could not create debugfs 'stack_max_size' entry\n" ); +trace_create_file ("stack_max_size" ,0644 , d_tracer, + &max_stack_size, &stack_max_size_fops); - entry =debugfs_create_file ("stack_trace" ,0444 , d_tracer, -NULL , &stack_trace_fops); -if (!entry) -pr_warning ("Could not create debugfs 'stack_trace' entry\n" ); +trace_create_file ("stack_trace" ,0444 , d_tracer, +NULL , &stack_trace_fops);if (stack_tracer_enabled)register_ftrace_function (&trace_ops);
kernel/trace/trace_sysprof.c +1 -5
@@ -321,11 +321,7 @@ static const struct file_operations sysprof_sample_fops = {void init_tracer_sysprof_debugfs (struct dentry *d_tracer) { -struct dentry *entry; - entry =debugfs_create_file ("sysprof_sample_period" ,0644 , +trace_create_file ("sysprof_sample_period" ,0644 , d_tracer,NULL , &sysprof_sample_fops); -if (entry) -return ; -pr_warning ("Could not create debugfs 'sysprof_sample_period' entry\n" ); }
Signature · 3 lines
1.6.2.1 --
Steven Rostedt
maintainerPATCH 4/10 tracing/ftrace: fix missing include string.h
In reply to Steven RostedtFrom: Frederic Weisbecker <[email protected]>
Building a kernel with tracing can raise the following warning on tip/master:
kernel/trace/trace.c:1249: error: implicit declaration of function 'vbin_printf'
We are missing an include to string.h
LKML-Reference: <[email protected]>
--- kernel/trace/trace.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
kernel/trace/trace.c +1 -0
@@ -30,6 +30,7 @@#include <linux/percpu.h> #include <linux/splice.h> #include <linux/kdebug.h> +#include <linux/string.h> #include <linux/ctype.h> #include <linux/init.h> #include <linux/poll.h>
Signature · 3 lines
1.6.2.1 --
Steven Rostedt
maintainerPATCH 3/10 tracing: fix incorrect return type of ns2usecs() V2
In reply to Steven RostedtFrom: Lai Jiangshan <[email protected]>
Impact: fix time output bug in 32bits system
ns2usecs() returns 'long', it's incorrect.
(In i386)
...
<idle>-0 [000] 521.442100: _spin_lock <-tick_do_update_jiffies64
<idle>-0 [000] 521.442101: do_timer <-tick_do_update_jiffies64
<idle>-0 [000] 521.442102: update_wall_time <-do_timer
<idle>-0 [000] 521.442102: update_xtime_cache <-update_wall_time....
(It always print the time less than 2200 seconds besides ...) Because 'long' is 32bits in i386. ( (1<<31) useconds is about 2200 seconds)
...
<idle>-0 [001] 4154502640.134759: rcu_bh_qsctr_inc <-__do_softirq
<idle>-0 [001] 4154502640.134760: _local_bh_enable <-__do_softirq
<idle>-0 [001] 4154502640.134761: idle_cpu <-irq_exit...
(very large value)
Because 'long' is a signed type and it is 32bits in i386.
Changed from V1:
return 'unsigned long long' instead of 'cycle_t'
LKML-Reference: <[email protected]>
--- kernel/trace/trace.c | 3 +-- kernel/trace/trace.h | 2 +- kernel/trace/trace_output.c | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-)
kernel/trace/trace.c +1 -2
@@ -147,8 +147,7 @@ static int __init set_ftrace_dump_on_oops(char *str) }__setup ("ftrace_dump_on_oops" , set_ftrace_dump_on_oops); -long -ns2usecs (cycle_t nsec) +unsigned long long ns2usecs (cycle_t nsec) { nsec +=500 ;do_div (nsec,1000 );
kernel/trace/trace.h +1 -1
@@ -602,7 +602,7 @@ extern int trace_selftest_startup_branch(struct tracer *trace,#endif /* CONFIG_FTRACE_STARTUP_TEST */ extern void *head_page (struct trace_array_cpu *data); -extern long ns2usecs (cycle_t nsec); +extern unsigned long long ns2usecs (cycle_t nsec);extern int trace_vbprintk (unsigned long ip,const char *fmt,va_list args); extern int
kernel/trace/trace_output.c +1 -1
@@ -433,7 +433,7 @@ int trace_print_lat_context(struct trace_iterator *iter)trace_find_cmdline (entry->pid, comm); - ret = trace_seq_printf(s, "%16s %5d %3d %d %08x %08lx [%08lx]" + ret = trace_seq_printf(s, "%16s %5d %3d %d %08x %08lx [%08llx]" " %ld.%03ldms (+%ld.%03ldms): ", comm, entry->pid, iter->cpu, entry->flags, entry->preempt_count, iter->idx,
Signature · 3 lines
1.6.2.1 --
Steven Rostedt
maintainerPATCH 2/10 tracing: use macros to denote usec and nsec per second
In reply to Steven RostedtFrom: Li Zefan <[email protected]>
Impact: cleanup
Use USEC_PER_SEC and NSEC_PER_SEC instead of 1000000 and 1000000000.
LKML-Reference: <[email protected]>
--- kernel/trace/trace_boot.c | 5 +++-- kernel/trace/trace_mmiotrace.c | 6 ++++-- 2 files changed, 7 insertions(+), 4 deletions(-)
kernel/trace/trace_boot.c +3 -2
@@ -9,6 +9,7 @@#include <linux/debugfs.h> #include <linux/ftrace.h> #include <linux/kallsyms.h> +#include <linux/time.h> #include "trace.h" #include "trace_output.h"
@@ -67,7 +68,7 @@ initcall_call_print_line(struct trace_iterator *iter)trace_assign_type (field, entry); call = &field->boot_call; ts = iter->ts; - nsec_rem =do_div (ts,1000000000 ); + nsec_rem =do_div (ts,NSEC_PER_SEC ); ret =trace_seq_printf (s,"[%5ld.%09ld] calling %s @ %i\n" , (unsigned long )ts, nsec_rem, call->func, call->caller);
@@ -92,7 +93,7 @@ initcall_ret_print_line(struct trace_iterator *iter)trace_assign_type (field, entry); init_ret = &field->boot_ret; ts = iter->ts; - nsec_rem =do_div (ts,1000000000 ); + nsec_rem =do_div (ts,NSEC_PER_SEC ); ret = trace_seq_printf(s, "[%5ld.%09ld] initcall %s " "returned %d after %llu msecs\n",
kernel/trace/trace_mmiotrace.c +4 -2
@@ -9,6 +9,8 @@#include <linux/kernel.h> #include <linux/mmiotrace.h> #include <linux/pci.h> +#include <linux/time.h> +#include <asm/atomic.h> #include "trace.h"
@@ -174,7 +176,7 @@ static enum print_line_t mmio_print_rw(struct trace_iterator *iter)struct mmiotrace_rw *rw;struct trace_seq *s = &iter->seq;unsigned long long t =ns2usecs (iter->ts); -unsigned long usec_rem =do_div (t,1000000ULL ); +unsigned long usec_rem =do_div (t,USEC_PER_SEC );unsigned secs = (unsigned long )t;int ret =1 ;
@@ -221,7 +223,7 @@ static enum print_line_t mmio_print_map(struct trace_iterator *iter)struct mmiotrace_map *m;struct trace_seq *s = &iter->seq;unsigned long long t =ns2usecs (iter->ts); -unsigned long usec_rem =do_div (t,1000000ULL ); +unsigned long usec_rem =do_div (t,USEC_PER_SEC );unsigned secs = (unsigned long )t;int ret;
Signature · 3 lines
1.6.2.1 --
Quoted 47 lines · Steven Rostedt
Ingo,
These are the same patches I sent out earlier, but I rebased them to tip/tracing/core. I also changed my S-o-B to be [email protected] since I prefer email going to that address instead.
-- Steve
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/coreFrederic Weisbecker (2):
tracing/ftrace: fix missing includestring.htracing/ftrace: factorize the tracing files creationHuang Weiyi (1):
tracing, x86: remove duplicated #includeLai Jiangshan (1):
tracing: fix incorrect return type ofns2usecs()V2Li Zefan (1):
tracing: use macros to denote usec and nsec per secondSteven Rostedt (3):
tracing: removeCALLER_ADDR2from wakeup tracer
function-graph: add proper initialization for init task
function-graph: use int instead of atomic forftrace_graph_activeZhaolei (2):
ftrace: Add check ofsched_stoppedforprobe_sched_wakeup
ftrace: Clean up enable logic forsched_switch----
arch/x86/kernel/ftrace.c | 1 - include/linux/ftrace.h | 8 ++- include/linux/init_task.h | 2 + kernel/trace/ftrace.c | 53 ++++-------- kernel/trace/ring_buffer.c | 7 +- kernel/trace/trace.c | 163 ++++++++++++++---------------------- kernel/trace/trace.h | 8 ++- kernel/trace/trace_boot.c | 5 +- kernel/trace/trace_event_profile.c | 3 +-
Quoted 8 lines
kernel/trace/trace_mmiotrace.c | 6 +- kernel/trace/trace_output.c | 2 +- kernel/trace/trace_printk.c | 6 +- kernel/trace/trace_sched_switch.c | 11 ++- kernel/trace/trace_sched_wakeup.c | 8 ++- kernel/trace/trace_stack.c | 13 +-- kernel/trace/trace_sysprof.c | 6 +- 16 files changed, 128 insertions(+), 174 deletions(-)
Pulled, thanks Steve!
Ingo
Re: [PATCH 05/10] tracing/ftrace: factorize the tracing files creation
In reply to Steven RostedtQuoted 12 lines · Steven Rostedt
kernel/trace/trace_event_profile.c +1
-1@@ -6,7 +6,7 @@*/ #include "trace.h" - +#if 0 int ftrace_profile_enable (int event_id) {struct ftrace_event_call *event;
kernel/trace/trace_event_profile.c void ftrace_profile_disable(int event_id) · line 32
Quoted 4 lines
kernel/trace/trace_event_profile.c +1
-0@@ -29,3 +29,4 @@ void ftrace_profile_disable(int event_id) } } +#endif
uhm, that's not a very nice to do ;-)
Ingo
Steven Rostedt
maintainerRe: [PATCH 05/10] tracing/ftrace: factorize the tracing files creation
Quoted 18 lines · Ingo Molnar
Quoted 15 lines · Steven Rostedt
kernel/trace/trace_event_profile.c +1
-1@@ -6,7 +6,7 @@*/ #include "trace.h" - +#if 0 int ftrace_profile_enable (int event_id) {struct ftrace_event_call *event;@@ -29,3 +29,4 @@ void ftrace_profile_disable(int event_id) } }
Quoted 3 lines
kernel/trace/trace_event_profile.c void ftrace_profile_disable(int event_id) · line 32
Quoted 1 line
kernel/trace/trace_event_profile.c +1
-0+#endif uhm, that's not a very nice to do ;-)
Ug! I mssed that :-p
-- Steve