diff --git a/[refs] b/[refs] index 242af3706116..9ebd28588ccb 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 40ada30f9621fbd831ac2437b9a2a399aad34b00 +refs/heads/master: 0012693ad4f636c720fed3802027f9427962f540 diff --git a/trunk/Documentation/ftrace.txt b/trunk/Documentation/ftrace.txt index 22614bef6359..2041ee951c1a 100644 --- a/trunk/Documentation/ftrace.txt +++ b/trunk/Documentation/ftrace.txt @@ -1466,11 +1466,11 @@ want, depending on your needs. You can put some comments on specific functions by using -trace_printk() For example, if you want to put a comment inside +ftrace_printk() For example, if you want to put a comment inside the __might_sleep() function, you just have to include - and call trace_printk() inside __might_sleep() + and call ftrace_printk() inside __might_sleep() -trace_printk("I'm a comment!\n") +ftrace_printk("I'm a comment!\n") will produce: diff --git a/trunk/arch/Kconfig b/trunk/arch/Kconfig index a092dc77c24d..550dab22daa1 100644 --- a/trunk/arch/Kconfig +++ b/trunk/arch/Kconfig @@ -6,7 +6,6 @@ config OPROFILE tristate "OProfile system profiling (EXPERIMENTAL)" depends on PROFILING depends on HAVE_OPROFILE - depends on TRACING_SUPPORT select TRACING select RING_BUFFER help diff --git a/trunk/arch/x86/kernel/ftrace.c b/trunk/arch/x86/kernel/ftrace.c index 3925ec0184b1..a85da1764b1c 100644 --- a/trunk/arch/x86/kernel/ftrace.c +++ b/trunk/arch/x86/kernel/ftrace.c @@ -436,7 +436,7 @@ void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr) return; } - calltime = cpu_clock(raw_smp_processor_id()); + calltime = trace_clock_local(); if (ftrace_push_return_trace(old, calltime, self_addr, &trace.depth) == -EBUSY) { diff --git a/trunk/include/linux/ftrace.h b/trunk/include/linux/ftrace.h index 5b64303ec9f2..6ea62acbe4b6 100644 --- a/trunk/include/linux/ftrace.h +++ b/trunk/include/linux/ftrace.h @@ -1,15 +1,16 @@ #ifndef _LINUX_FTRACE_H #define _LINUX_FTRACE_H -#include -#include -#include -#include -#include -#include +#include #include +#include #include +#include +#include #include +#include +#include +#include #include @@ -318,6 +319,62 @@ static inline void __ftrace_enabled_restore(int enabled) # define trace_preempt_off(a0, a1) do { } while (0) #endif +#ifdef CONFIG_TRACING +extern int ftrace_dump_on_oops; + +extern void tracing_start(void); +extern void tracing_stop(void); +extern void ftrace_off_permanent(void); + +extern void +ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3); + +/** + * ftrace_printk - printf formatting in the ftrace buffer + * @fmt: the printf format for printing + * + * Note: __ftrace_printk is an internal function for ftrace_printk and + * the @ip is passed in via the ftrace_printk macro. + * + * This function allows a kernel developer to debug fast path sections + * that printk is not appropriate for. By scattering in various + * printk like tracing in the code, a developer can quickly see + * where problems are occurring. + * + * This is intended as a debugging tool for the developer only. + * Please refrain from leaving ftrace_printks scattered around in + * your code. + */ +# define ftrace_printk(fmt...) __ftrace_printk(_THIS_IP_, fmt) +extern int +__ftrace_printk(unsigned long ip, const char *fmt, ...) + __attribute__ ((format (printf, 2, 3))); +# define ftrace_vprintk(fmt, ap) __ftrace_printk(_THIS_IP_, fmt, ap) +extern int +__ftrace_vprintk(unsigned long ip, const char *fmt, va_list ap); +extern void ftrace_dump(void); +#else +static inline void +ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3) { } +static inline int +ftrace_printk(const char *fmt, ...) __attribute__ ((format (printf, 1, 2))); + +static inline void tracing_start(void) { } +static inline void tracing_stop(void) { } +static inline void ftrace_off_permanent(void) { } +static inline int +ftrace_printk(const char *fmt, ...) +{ + return 0; +} +static inline int +ftrace_vprintk(const char *fmt, va_list ap) +{ + return 0; +} +static inline void ftrace_dump(void) { } +#endif + #ifdef CONFIG_FTRACE_MCOUNT_RECORD extern void ftrace_init(void); extern void ftrace_init_module(struct module *mod, @@ -486,8 +543,6 @@ static inline int test_tsk_trace_graph(struct task_struct *tsk) return tsk->trace & TSK_TRACE_FL_GRAPH; } -extern int ftrace_dump_on_oops; - #endif /* CONFIG_TRACING */ diff --git a/trunk/include/linux/kernel.h b/trunk/include/linux/kernel.h index 08bf5da86676..7fa371898e3e 100644 --- a/trunk/include/linux/kernel.h +++ b/trunk/include/linux/kernel.h @@ -367,64 +367,6 @@ static inline char *pack_hex_byte(char *buf, u8 byte) ({ if (0) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); 0; }) #endif -/* - * General tracing related utility functions - trace_printk(), - * tracing_start()/tracing_stop: - */ -#ifdef CONFIG_TRACING -extern void tracing_start(void); -extern void tracing_stop(void); -extern void ftrace_off_permanent(void); - -extern void -ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3); - -/** - * trace_printk - printf formatting in the ftrace buffer - * @fmt: the printf format for printing - * - * Note: __trace_printk is an internal function for trace_printk and - * the @ip is passed in via the trace_printk macro. - * - * This function allows a kernel developer to debug fast path sections - * that printk is not appropriate for. By scattering in various - * printk like tracing in the code, a developer can quickly see - * where problems are occurring. - * - * This is intended as a debugging tool for the developer only. - * Please refrain from leaving trace_printks scattered around in - * your code. - */ -# define trace_printk(fmt...) __trace_printk(_THIS_IP_, fmt) -extern int -__trace_printk(unsigned long ip, const char *fmt, ...) - __attribute__ ((format (printf, 2, 3))); -# define ftrace_vprintk(fmt, ap) __trace_printk(_THIS_IP_, fmt, ap) -extern int -__ftrace_vprintk(unsigned long ip, const char *fmt, va_list ap); -extern void ftrace_dump(void); -#else -static inline void -ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3) { } -static inline int -trace_printk(const char *fmt, ...) __attribute__ ((format (printf, 1, 2))); - -static inline void tracing_start(void) { } -static inline void tracing_stop(void) { } -static inline void ftrace_off_permanent(void) { } -static inline int -trace_printk(const char *fmt, ...) -{ - return 0; -} -static inline int -ftrace_vprintk(const char *fmt, va_list ap) -{ - return 0; -} -static inline void ftrace_dump(void) { } -#endif - /* * Display an IP address in readable format. */ diff --git a/trunk/kernel/trace/Kconfig b/trunk/kernel/trace/Kconfig index 5d733da5345a..999c6a2485df 100644 --- a/trunk/kernel/trace/Kconfig +++ b/trunk/kernel/trace/Kconfig @@ -53,22 +53,12 @@ config TRACING select TRACEPOINTS select NOP_TRACER -# -# Minimum requirements an architecture has to meet for us to -# be able to offer generic tracing facilities: -# -config TRACING_SUPPORT - bool - depends on TRACE_IRQFLAGS_SUPPORT - depends on STACKTRACE_SUPPORT - -if TRACING_SUPPORT - menu "Tracers" config FUNCTION_TRACER bool "Kernel Function Tracer" depends on HAVE_FUNCTION_TRACER + depends on DEBUG_KERNEL select FRAME_POINTER select KALLSYMS select TRACING @@ -101,6 +91,7 @@ config IRQSOFF_TRACER default n depends on TRACE_IRQFLAGS_SUPPORT depends on GENERIC_TIME + depends on DEBUG_KERNEL select TRACE_IRQFLAGS select TRACING select TRACER_MAX_TRACE @@ -123,6 +114,7 @@ config PREEMPT_TRACER default n depends on GENERIC_TIME depends on PREEMPT + depends on DEBUG_KERNEL select TRACING select TRACER_MAX_TRACE help @@ -150,6 +142,7 @@ config SYSPROF_TRACER config SCHED_TRACER bool "Scheduling Latency Tracer" + depends on DEBUG_KERNEL select TRACING select CONTEXT_SWITCH_TRACER select TRACER_MAX_TRACE @@ -159,6 +152,7 @@ config SCHED_TRACER config CONTEXT_SWITCH_TRACER bool "Trace process context switches" + depends on DEBUG_KERNEL select TRACING select MARKERS help @@ -167,6 +161,7 @@ config CONTEXT_SWITCH_TRACER config EVENT_TRACER bool "Trace various events in the kernel" + depends on DEBUG_KERNEL select TRACING help This tracer hooks to various trace points in the kernel @@ -175,6 +170,7 @@ config EVENT_TRACER config BOOT_TRACER bool "Trace boot initcalls" + depends on DEBUG_KERNEL select TRACING select CONTEXT_SWITCH_TRACER help @@ -192,6 +188,7 @@ config BOOT_TRACER config TRACE_BRANCH_PROFILING bool "Trace likely/unlikely profiler" + depends on DEBUG_KERNEL select TRACING help This tracer profiles all the the likely and unlikely macros @@ -244,6 +241,7 @@ config BRANCH_TRACER config POWER_TRACER bool "Trace power consumption behavior" + depends on DEBUG_KERNEL depends on X86 select TRACING help @@ -255,6 +253,7 @@ config POWER_TRACER config STACK_TRACER bool "Trace max stack" depends on HAVE_FUNCTION_TRACER + depends on DEBUG_KERNEL select FUNCTION_TRACER select STACKTRACE select KALLSYMS @@ -344,6 +343,7 @@ config DYNAMIC_FTRACE bool "enable/disable ftrace tracepoints dynamically" depends on FUNCTION_TRACER depends on HAVE_DYNAMIC_FTRACE + depends on DEBUG_KERNEL default y help This option will modify all the calls to ftrace dynamically @@ -369,7 +369,7 @@ config FTRACE_SELFTEST config FTRACE_STARTUP_TEST bool "Perform a startup test on ftrace" - depends on TRACING + depends on TRACING && DEBUG_KERNEL select FTRACE_SELFTEST help This option performs a series of startup tests on ftrace. On bootup @@ -379,7 +379,7 @@ config FTRACE_STARTUP_TEST config MMIOTRACE bool "Memory mapped IO tracing" - depends on HAVE_MMIOTRACE_SUPPORT && PCI + depends on HAVE_MMIOTRACE_SUPPORT && DEBUG_KERNEL && PCI select TRACING help Mmiotrace traces Memory Mapped I/O access and is meant for @@ -401,6 +401,3 @@ config MMIOTRACE_TEST Say N, unless you absolutely know what you are doing. endmenu - -endif # TRACING_SUPPORT - diff --git a/trunk/kernel/trace/blktrace.c b/trunk/kernel/trace/blktrace.c index e39679a72a3b..e82cb9e930cc 100644 --- a/trunk/kernel/trace/blktrace.c +++ b/trunk/kernel/trace/blktrace.c @@ -1231,6 +1231,7 @@ static struct tracer blk_tracer __read_mostly = { static struct trace_event trace_blk_event = { .type = TRACE_BLK, .trace = blk_trace_event_print, + .latency_trace = blk_trace_event_print, .binary = blk_trace_event_print_binary, }; diff --git a/trunk/kernel/trace/ring_buffer.c b/trunk/kernel/trace/ring_buffer.c index f7473645b9c6..f2a163db52f9 100644 --- a/trunk/kernel/trace/ring_buffer.c +++ b/trunk/kernel/trace/ring_buffer.c @@ -2461,7 +2461,6 @@ int ring_buffer_read_page(struct ring_buffer *buffer, unsigned long flags; unsigned int commit; unsigned int read; - u64 save_timestamp; int ret = -1; /* @@ -2516,9 +2515,6 @@ int ring_buffer_read_page(struct ring_buffer *buffer, if (len < size) goto out; - /* save the current timestamp, since the user will need it */ - save_timestamp = cpu_buffer->read_stamp; - /* Need to copy one event at a time */ do { memcpy(bpage->data + pos, rpage->data + rpos, size); @@ -2535,7 +2531,7 @@ int ring_buffer_read_page(struct ring_buffer *buffer, /* update bpage */ local_set(&bpage->commit, pos); - bpage->time_stamp = save_timestamp; + bpage->time_stamp = rpage->time_stamp; /* we copied everything to the beginning */ read = 0; diff --git a/trunk/kernel/trace/trace.c b/trunk/kernel/trace/trace.c index c0e9c1263393..c8abbb0c8397 100644 --- a/trunk/kernel/trace/trace.c +++ b/trunk/kernel/trace/trace.c @@ -48,7 +48,7 @@ unsigned long __read_mostly tracing_thresh; * We need to change this state when a selftest is running. * A selftest will lurk into the ring-buffer to count the * entries inserted during the selftest although some concurrent - * insertions into the ring-buffer such as trace_printk could occurred + * insertions into the ring-buffer such as ftrace_printk could occurred * at the same time, giving false positive or negative results. */ static bool __read_mostly tracing_selftest_running; @@ -291,7 +291,7 @@ static const char *trace_options[] = { "block", "stacktrace", "sched-tree", - "trace_printk", + "ftrace_printk", "ftrace_preempt", "branch", "annotate", @@ -299,7 +299,6 @@ static const char *trace_options[] = { "sym-userobj", "printk-msg-only", "context-info", - "latency-format", NULL }; @@ -347,9 +346,6 @@ ssize_t trace_seq_to_user(struct trace_seq *s, char __user *ubuf, size_t cnt) int len; int ret; - if (!cnt) - return 0; - if (s->len <= s->readpos) return -EBUSY; @@ -357,12 +353,10 @@ ssize_t trace_seq_to_user(struct trace_seq *s, char __user *ubuf, size_t cnt) if (cnt > len) cnt = len; ret = copy_to_user(ubuf, s->buffer + s->readpos, cnt); - if (ret == cnt) + if (ret) return -EFAULT; - cnt -= ret; - - s->readpos += cnt; + s->readpos += len; return cnt; } @@ -381,7 +375,7 @@ ssize_t trace_seq_to_buffer(struct trace_seq *s, void *buf, size_t cnt) if (!ret) return -EFAULT; - s->readpos += cnt; + s->readpos += len; return cnt; } @@ -1468,6 +1462,33 @@ static void test_cpu_buff_start(struct trace_iterator *iter) trace_seq_printf(s, "##### CPU %u buffer started ####\n", iter->cpu); } +static enum print_line_t print_lat_fmt(struct trace_iterator *iter) +{ + struct trace_seq *s = &iter->seq; + unsigned long sym_flags = (trace_flags & TRACE_ITER_SYM_MASK); + struct trace_event *event; + struct trace_entry *entry = iter->ent; + + test_cpu_buff_start(iter); + + event = ftrace_find_event(entry->type); + + if (trace_flags & TRACE_ITER_CONTEXT_INFO) { + if (!trace_print_lat_context(iter)) + goto partial; + } + + if (event) + return event->latency_trace(iter, sym_flags); + + if (!trace_seq_printf(s, "Unknown type %d\n", entry->type)) + goto partial; + + return TRACE_TYPE_HANDLED; +partial: + return TRACE_TYPE_PARTIAL_LINE; +} + static enum print_line_t print_trace_fmt(struct trace_iterator *iter) { struct trace_seq *s = &iter->seq; @@ -1482,13 +1503,8 @@ static enum print_line_t print_trace_fmt(struct trace_iterator *iter) event = ftrace_find_event(entry->type); if (trace_flags & TRACE_ITER_CONTEXT_INFO) { - if (iter->iter_flags & TRACE_FILE_LAT_FMT) { - if (!trace_print_lat_context(iter)) - goto partial; - } else { - if (!trace_print_context(iter)) - goto partial; - } + if (!trace_print_context(iter)) + goto partial; } if (event) @@ -1630,6 +1646,9 @@ static enum print_line_t print_trace_line(struct trace_iterator *iter) if (trace_flags & TRACE_ITER_RAW) return print_raw_fmt(iter); + if (iter->iter_flags & TRACE_FILE_LAT_FMT) + return print_lat_fmt(iter); + return print_trace_fmt(iter); } @@ -1805,12 +1824,26 @@ static int tracing_open(struct inode *inode, struct file *file) iter = __tracing_open(inode, file); if (IS_ERR(iter)) ret = PTR_ERR(iter); - else if (trace_flags & TRACE_ITER_LATENCY_FMT) + + return ret; +} + +static int tracing_lt_open(struct inode *inode, struct file *file) +{ + struct trace_iterator *iter; + int ret = 0; + + iter = __tracing_open(inode, file); + + if (IS_ERR(iter)) + ret = PTR_ERR(iter); + else iter->iter_flags |= TRACE_FILE_LAT_FMT; return ret; } + static void * t_next(struct seq_file *m, void *v, loff_t *pos) { @@ -1889,6 +1922,13 @@ static struct file_operations tracing_fops = { .release = tracing_release, }; +static struct file_operations tracing_lt_fops = { + .open = tracing_lt_open, + .read = seq_read, + .llseek = seq_lseek, + .release = tracing_release, +}; + static struct file_operations show_traces_fops = { .open = show_traces_open, .read = seq_read, @@ -3009,9 +3049,6 @@ tracing_buffers_read(struct file *filp, char __user *ubuf, ssize_t ret; size_t size; - if (!count) - return 0; - /* Do we have previous read data to read? */ if (info->read < PAGE_SIZE) goto read; @@ -3036,10 +3073,8 @@ tracing_buffers_read(struct file *filp, char __user *ubuf, size = count; ret = copy_to_user(ubuf, info->spare + info->read, size); - if (ret == size) + if (ret) return -EFAULT; - size -= ret; - *ppos += size; info->read += size; @@ -3768,7 +3803,7 @@ int trace_vprintk(unsigned long ip, int depth, const char *fmt, va_list args) } EXPORT_SYMBOL_GPL(trace_vprintk); -int __trace_printk(unsigned long ip, const char *fmt, ...) +int __ftrace_printk(unsigned long ip, const char *fmt, ...) { int ret; va_list ap; @@ -3781,7 +3816,7 @@ int __trace_printk(unsigned long ip, const char *fmt, ...) va_end(ap); return ret; } -EXPORT_SYMBOL_GPL(__trace_printk); +EXPORT_SYMBOL_GPL(__ftrace_printk); int __ftrace_vprintk(unsigned long ip, const char *fmt, va_list ap) { @@ -3883,10 +3918,8 @@ void ftrace_dump(void) printk(KERN_TRACE "Dumping ftrace buffer:\n"); - /* Simulate the iterator */ iter.tr = &global_trace; iter.trace = current_trace; - iter.cpu_file = TRACE_PIPE_ALL_CPU; /* * We need to stop all tracing on all CPUS to read the diff --git a/trunk/kernel/trace/trace.h b/trunk/kernel/trace/trace.h index 8beff03fda68..561bb5c5d988 100644 --- a/trunk/kernel/trace/trace.h +++ b/trunk/kernel/trace/trace.h @@ -115,7 +115,7 @@ struct userstack_entry { }; /* - * trace_printk entry: + * ftrace_printk entry: */ struct print_entry { struct trace_entry ent; @@ -651,8 +651,7 @@ enum trace_iterator_flags { TRACE_ITER_USERSTACKTRACE = 0x4000, TRACE_ITER_SYM_USEROBJ = 0x8000, TRACE_ITER_PRINTK_MSGONLY = 0x10000, - TRACE_ITER_CONTEXT_INFO = 0x20000, /* Print pid/cpu/time */ - TRACE_ITER_LATENCY_FMT = 0x40000, + TRACE_ITER_CONTEXT_INFO = 0x20000 /* Print pid/cpu/time */ }; /* diff --git a/trunk/kernel/trace/trace_branch.c b/trunk/kernel/trace/trace_branch.c index aaa0755268b9..c2e68d440c4d 100644 --- a/trunk/kernel/trace/trace_branch.c +++ b/trunk/kernel/trace/trace_branch.c @@ -159,6 +159,7 @@ static enum print_line_t trace_branch_print(struct trace_iterator *iter, static struct trace_event trace_branch_event = { .type = TRACE_BRANCH, .trace = trace_branch_print, + .latency_trace = trace_branch_print, }; static struct tracer branch_trace __read_mostly = diff --git a/trunk/kernel/trace/trace_functions_graph.c b/trunk/kernel/trace/trace_functions_graph.c index c009553a8e81..e527f2f66c73 100644 --- a/trunk/kernel/trace/trace_functions_graph.c +++ b/trunk/kernel/trace/trace_functions_graph.c @@ -112,7 +112,7 @@ unsigned long ftrace_return_to_handler(void) unsigned long ret; ftrace_pop_return_trace(&trace, &ret); - trace.rettime = cpu_clock(raw_smp_processor_id()); + trace.rettime = trace_clock_local(); ftrace_graph_return(&trace); if (unlikely(!ret)) { diff --git a/trunk/kernel/trace/trace_irqsoff.c b/trunk/kernel/trace/trace_irqsoff.c index b923d13e2fad..9e5ebd844158 100644 --- a/trunk/kernel/trace/trace_irqsoff.c +++ b/trunk/kernel/trace/trace_irqsoff.c @@ -32,8 +32,6 @@ enum { static int trace_type __read_mostly; -static int save_lat_flag; - #ifdef CONFIG_PREEMPT_TRACER static inline int preempt_trace(void) @@ -372,9 +370,6 @@ static void stop_irqsoff_tracer(struct trace_array *tr) static void __irqsoff_tracer_init(struct trace_array *tr) { - save_lat_flag = trace_flags & TRACE_ITER_LATENCY_FMT; - trace_flags |= TRACE_ITER_LATENCY_FMT; - tracing_max_latency = 0; irqsoff_trace = tr; /* make sure that the tracer is visible */ @@ -385,9 +380,6 @@ static void __irqsoff_tracer_init(struct trace_array *tr) static void irqsoff_tracer_reset(struct trace_array *tr) { stop_irqsoff_tracer(tr); - - if (!save_lat_flag) - trace_flags &= ~TRACE_ITER_LATENCY_FMT; } static void irqsoff_tracer_start(struct trace_array *tr) diff --git a/trunk/kernel/trace/trace_output.c b/trunk/kernel/trace/trace_output.c index 306fef84c503..9fc815031b09 100644 --- a/trunk/kernel/trace/trace_output.c +++ b/trunk/kernel/trace/trace_output.c @@ -437,6 +437,8 @@ int register_ftrace_event(struct trace_event *event) if (event->trace == NULL) event->trace = trace_nop_print; + if (event->latency_trace == NULL) + event->latency_trace = trace_nop_print; if (event->raw == NULL) event->raw = trace_nop_print; if (event->hex == NULL) @@ -478,6 +480,29 @@ enum print_line_t trace_nop_print(struct trace_iterator *iter, int flags) } /* TRACE_FN */ +static enum print_line_t trace_fn_latency(struct trace_iterator *iter, + int flags) +{ + struct ftrace_entry *field; + struct trace_seq *s = &iter->seq; + + trace_assign_type(field, iter->ent); + + if (!seq_print_ip_sym(s, field->ip, flags)) + goto partial; + if (!trace_seq_puts(s, " (")) + goto partial; + if (!seq_print_ip_sym(s, field->parent_ip, flags)) + goto partial; + if (!trace_seq_puts(s, ")\n")) + goto partial; + + return TRACE_TYPE_HANDLED; + + partial: + return TRACE_TYPE_PARTIAL_LINE; +} + static enum print_line_t trace_fn_trace(struct trace_iterator *iter, int flags) { struct ftrace_entry *field; @@ -548,6 +573,7 @@ static enum print_line_t trace_fn_bin(struct trace_iterator *iter, int flags) static struct trace_event trace_fn_event = { .type = TRACE_FN, .trace = trace_fn_trace, + .latency_trace = trace_fn_latency, .raw = trace_fn_raw, .hex = trace_fn_hex, .binary = trace_fn_bin, @@ -679,6 +705,7 @@ static enum print_line_t trace_ctxwake_bin(struct trace_iterator *iter, static struct trace_event trace_ctx_event = { .type = TRACE_CTX, .trace = trace_ctx_print, + .latency_trace = trace_ctx_print, .raw = trace_ctx_raw, .hex = trace_ctx_hex, .binary = trace_ctxwake_bin, @@ -687,6 +714,7 @@ static struct trace_event trace_ctx_event = { static struct trace_event trace_wake_event = { .type = TRACE_WAKE, .trace = trace_wake_print, + .latency_trace = trace_wake_print, .raw = trace_wake_raw, .hex = trace_wake_hex, .binary = trace_ctxwake_bin, @@ -742,6 +770,7 @@ static enum print_line_t trace_special_bin(struct trace_iterator *iter, static struct trace_event trace_special_event = { .type = TRACE_SPECIAL, .trace = trace_special_print, + .latency_trace = trace_special_print, .raw = trace_special_print, .hex = trace_special_hex, .binary = trace_special_bin, @@ -779,6 +808,7 @@ static enum print_line_t trace_stack_print(struct trace_iterator *iter, static struct trace_event trace_stack_event = { .type = TRACE_STACK, .trace = trace_stack_print, + .latency_trace = trace_stack_print, .raw = trace_special_print, .hex = trace_special_hex, .binary = trace_special_bin, @@ -808,6 +838,7 @@ static enum print_line_t trace_user_stack_print(struct trace_iterator *iter, static struct trace_event trace_user_stack_event = { .type = TRACE_USER_STACK, .trace = trace_user_stack_print, + .latency_trace = trace_user_stack_print, .raw = trace_special_print, .hex = trace_special_hex, .binary = trace_special_bin, @@ -852,6 +883,7 @@ static enum print_line_t trace_print_raw(struct trace_iterator *iter, int flags) static struct trace_event trace_print_event = { .type = TRACE_PRINT, .trace = trace_print_print, + .latency_trace = trace_print_print, .raw = trace_print_raw, }; diff --git a/trunk/kernel/trace/trace_output.h b/trunk/kernel/trace/trace_output.h index 8a34d688ed63..551a25a72217 100644 --- a/trunk/kernel/trace/trace_output.h +++ b/trunk/kernel/trace/trace_output.h @@ -10,6 +10,7 @@ struct trace_event { struct hlist_node node; int type; trace_print_func trace; + trace_print_func latency_trace; trace_print_func raw; trace_print_func hex; trace_print_func binary; diff --git a/trunk/kernel/trace/trace_sched_wakeup.c b/trunk/kernel/trace/trace_sched_wakeup.c index 3c5ad6b2ec84..db55f7aaa640 100644 --- a/trunk/kernel/trace/trace_sched_wakeup.c +++ b/trunk/kernel/trace/trace_sched_wakeup.c @@ -32,8 +32,6 @@ static raw_spinlock_t wakeup_lock = static void __wakeup_reset(struct trace_array *tr); -static int save_lat_flag; - #ifdef CONFIG_FUNCTION_TRACER /* * irqsoff uses its own tracer function to keep the overhead down: @@ -326,9 +324,6 @@ static void stop_wakeup_tracer(struct trace_array *tr) static int __wakeup_tracer_init(struct trace_array *tr) { - save_lat_flag = trace_flags & TRACE_ITER_LATENCY_FMT; - trace_flags |= TRACE_ITER_LATENCY_FMT; - tracing_max_latency = 0; wakeup_trace = tr; start_wakeup_tracer(tr); @@ -352,9 +347,6 @@ static void wakeup_tracer_reset(struct trace_array *tr) stop_wakeup_tracer(tr); /* make sure we put back any tasks we are tracing */ wakeup_reset(tr); - - if (!save_lat_flag) - trace_flags &= ~TRACE_ITER_LATENCY_FMT; } static void wakeup_tracer_start(struct trace_array *tr)