From 67f8fed3e18bd99eabde20e46b93e5b876038016 Mon Sep 17 00:00:00 2001 From: Steven Rostedt Date: Thu, 5 Mar 2009 10:35:56 -0500 Subject: [PATCH] --- yaml --- r: 140868 b: refs/heads/master c: 2002c258faaa8f89543df284fdbaa9e4b171547f h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/arch/Kconfig | 1 - trunk/arch/x86/kernel/ftrace.c | 2 +- trunk/include/linux/ftrace.h | 13 +++++----- trunk/include/linux/kernel.h | 29 +++++++++++++++++++++- trunk/include/linux/ring_buffer.h | 15 ----------- trunk/kernel/trace/Kconfig | 29 ++++++++++------------ trunk/kernel/trace/trace_functions_graph.c | 2 +- 8 files changed, 50 insertions(+), 43 deletions(-) diff --git a/[refs] b/[refs] index dcd2d002916a..054621068705 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 16097439703bcd38e9fe5608c12add6dacb825ea +refs/heads/master: 2002c258faaa8f89543df284fdbaa9e4b171547f 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 a85da1764b1c..3925ec0184b1 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 = trace_clock_local(); + calltime = cpu_clock(raw_smp_processor_id()); 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 498769425eb2..5b64303ec9f2 100644 --- a/trunk/include/linux/ftrace.h +++ b/trunk/include/linux/ftrace.h @@ -1,16 +1,15 @@ #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 diff --git a/trunk/include/linux/kernel.h b/trunk/include/linux/kernel.h index 08bf5da86676..d4614a8a034b 100644 --- a/trunk/include/linux/kernel.h +++ b/trunk/include/linux/kernel.h @@ -369,8 +369,35 @@ static inline char *pack_hex_byte(char *buf, u8 byte) /* * General tracing related utility functions - trace_printk(), - * tracing_start()/tracing_stop: + * tracing_on/tracing_off and tracing_start()/tracing_stop + * + * Use tracing_on/tracing_off when you want to quickly turn on or off + * tracing. It simply enables or disables the recording of the trace events. + * This also corresponds to the user space debugfs/tracing/tracing_on + * file, which gives a means for the kernel and userspace to interact. + * Place a tracing_off() in the kernel where you want tracing to end. + * From user space, examine the trace, and then echo 1 > tracing_on + * to continue tracing. + * + * tracing_stop/tracing_start has slightly more overhead. It is used + * by things like suspend to ram where disabling the recording of the + * trace is not enough, but tracing must actually stop because things + * like calling smp_processor_id() may crash the system. + * + * Most likely, you want to use tracing_on/tracing_off. */ +#ifdef CONFIG_RING_BUFFER +void tracing_on(void); +void tracing_off(void); +/* trace_off_permanent stops recording with no way to bring it back */ +void tracing_off_permanent(void); +int tracing_is_on(void); +#else +static inline void tracing_on(void) { } +static inline void tracing_off(void) { } +static inline void tracing_off_permanent(void) { } +static inline int tracing_is_on(void) { return 0; } +#endif #ifdef CONFIG_TRACING extern void tracing_start(void); extern void tracing_stop(void); diff --git a/trunk/include/linux/ring_buffer.h b/trunk/include/linux/ring_buffer.h index 79fcbc4b09d6..b1a0068a5557 100644 --- a/trunk/include/linux/ring_buffer.h +++ b/trunk/include/linux/ring_buffer.h @@ -124,21 +124,6 @@ void ring_buffer_normalize_time_stamp(int cpu, u64 *ts); size_t ring_buffer_page_len(void *page); -/* - * The below functions are fine to use outside the tracing facility. - */ -#ifdef CONFIG_RING_BUFFER -void tracing_on(void); -void tracing_off(void); -void tracing_off_permanent(void); -int tracing_is_on(void); -#else -static inline void tracing_on(void) { } -static inline void tracing_off(void) { } -static inline void tracing_off_permanent(void) { } -static inline int tracing_is_on(void) { return 0; } -#endif - void *ring_buffer_alloc_read_page(struct ring_buffer *buffer); void ring_buffer_free_read_page(struct ring_buffer *buffer, void *data); int ring_buffer_read_page(struct ring_buffer *buffer, void **data_page, 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/trace_functions_graph.c b/trunk/kernel/trace/trace_functions_graph.c index e527f2f66c73..c009553a8e81 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 = trace_clock_local(); + trace.rettime = cpu_clock(raw_smp_processor_id()); ftrace_graph_return(&trace); if (unlikely(!ret)) {