aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-06-04 07:59:26 -0400
committerIngo Molnar <mingo@elte.hu>2009-06-04 07:59:40 -0400
commit64edbc562034f2ec3fce382cb208fab40586d005 (patch)
tree7fbfaaea9467d14a1a6ac5667ce01be5ccb9b635 /kernel
parent43bd1236234cacbc18d1476a9b57e7a306efddf5 (diff)
parent0f6ce3de4ef6ff940308087c49760d068851c1a7 (diff)
Merge branch 'tracing/ftrace' into tracing/core
Merge reason: this mini-topic had outstanding problems that delayed its merge, so it does not fast-forward. Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/trace/Kconfig60
-rw-r--r--kernel/trace/ftrace.c50
-rw-r--r--kernel/trace/trace.c3
-rw-r--r--kernel/trace/trace_events_filter.c6
-rw-r--r--kernel/trace/trace_output.c3
5 files changed, 87 insertions, 35 deletions
diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig
index a508b9d2adb8..4a13e5a01ce3 100644
--- a/kernel/trace/Kconfig
+++ b/kernel/trace/Kconfig
@@ -56,6 +56,13 @@ config CONTEXT_SWITCH_TRACER
56 select MARKERS 56 select MARKERS
57 bool 57 bool
58 58
59# All tracer options should select GENERIC_TRACER. For those options that are
60# enabled by all tracers (context switch and event tracer) they select TRACING.
61# This allows those options to appear when no other tracer is selected. But the
62# options do not appear when something else selects it. We need the two options
63# GENERIC_TRACER and TRACING to avoid circular dependencies to accomplish the
64# hidding of the automatic options options.
65
59config TRACING 66config TRACING
60 bool 67 bool
61 select DEBUG_FS 68 select DEBUG_FS
@@ -66,6 +73,10 @@ config TRACING
66 select BINARY_PRINTF 73 select BINARY_PRINTF
67 select EVENT_TRACING 74 select EVENT_TRACING
68 75
76config GENERIC_TRACER
77 bool
78 select TRACING
79
69# 80#
70# Minimum requirements an architecture has to meet for us to 81# Minimum requirements an architecture has to meet for us to
71# be able to offer generic tracing facilities: 82# be able to offer generic tracing facilities:
@@ -95,7 +106,7 @@ config FUNCTION_TRACER
95 depends on HAVE_FUNCTION_TRACER 106 depends on HAVE_FUNCTION_TRACER
96 select FRAME_POINTER 107 select FRAME_POINTER
97 select KALLSYMS 108 select KALLSYMS
98 select TRACING 109 select GENERIC_TRACER
99 select CONTEXT_SWITCH_TRACER 110 select CONTEXT_SWITCH_TRACER
100 help 111 help
101 Enable the kernel to trace every kernel function. This is done 112 Enable the kernel to trace every kernel function. This is done
@@ -126,7 +137,7 @@ config IRQSOFF_TRACER
126 depends on TRACE_IRQFLAGS_SUPPORT 137 depends on TRACE_IRQFLAGS_SUPPORT
127 depends on GENERIC_TIME 138 depends on GENERIC_TIME
128 select TRACE_IRQFLAGS 139 select TRACE_IRQFLAGS
129 select TRACING 140 select GENERIC_TRACER
130 select TRACER_MAX_TRACE 141 select TRACER_MAX_TRACE
131 help 142 help
132 This option measures the time spent in irqs-off critical 143 This option measures the time spent in irqs-off critical
@@ -147,7 +158,7 @@ config PREEMPT_TRACER
147 default n 158 default n
148 depends on GENERIC_TIME 159 depends on GENERIC_TIME
149 depends on PREEMPT 160 depends on PREEMPT
150 select TRACING 161 select GENERIC_TRACER
151 select TRACER_MAX_TRACE 162 select TRACER_MAX_TRACE
152 help 163 help
153 This option measures the time spent in preemption off critical 164 This option measures the time spent in preemption off critical
@@ -166,7 +177,7 @@ config PREEMPT_TRACER
166config SYSPROF_TRACER 177config SYSPROF_TRACER
167 bool "Sysprof Tracer" 178 bool "Sysprof Tracer"
168 depends on X86 179 depends on X86
169 select TRACING 180 select GENERIC_TRACER
170 select CONTEXT_SWITCH_TRACER 181 select CONTEXT_SWITCH_TRACER
171 help 182 help
172 This tracer provides the trace needed by the 'Sysprof' userspace 183 This tracer provides the trace needed by the 'Sysprof' userspace
@@ -174,44 +185,33 @@ config SYSPROF_TRACER
174 185
175config SCHED_TRACER 186config SCHED_TRACER
176 bool "Scheduling Latency Tracer" 187 bool "Scheduling Latency Tracer"
177 select TRACING 188 select GENERIC_TRACER
178 select CONTEXT_SWITCH_TRACER 189 select CONTEXT_SWITCH_TRACER
179 select TRACER_MAX_TRACE 190 select TRACER_MAX_TRACE
180 help 191 help
181 This tracer tracks the latency of the highest priority task 192 This tracer tracks the latency of the highest priority task
182 to be scheduled in, starting from the point it has woken up. 193 to be scheduled in, starting from the point it has woken up.
183 194
184config ENABLE_CONTEXT_SWITCH_TRACER 195config ENABLE_DEFAULT_TRACERS
185 bool "Trace process context switches" 196 bool "Trace process context switches and events"
186 select TRACING 197 depends on !GENERIC_TRACER
187 select CONTEXT_SWITCH_TRACER
188 help
189 This tracer gets called from the context switch and records
190 all switching of tasks.
191
192config ENABLE_EVENT_TRACING
193 bool "Trace various events in the kernel"
194 select TRACING 198 select TRACING
195 help 199 help
196 This tracer hooks to various trace points in the kernel 200 This tracer hooks to various trace points in the kernel
197 allowing the user to pick and choose which trace point they 201 allowing the user to pick and choose which trace point they
198 want to trace. 202 want to trace. It also includes the sched_switch tracer plugin.
199
200 Note, all tracers enable event tracing. This option is
201 only a convenience to enable event tracing when no other
202 tracers are selected.
203 203
204config FTRACE_SYSCALLS 204config FTRACE_SYSCALLS
205 bool "Trace syscalls" 205 bool "Trace syscalls"
206 depends on HAVE_FTRACE_SYSCALLS 206 depends on HAVE_FTRACE_SYSCALLS
207 select TRACING 207 select GENERIC_TRACER
208 select KALLSYMS 208 select KALLSYMS
209 help 209 help
210 Basic tracer to catch the syscall entry and exit events. 210 Basic tracer to catch the syscall entry and exit events.
211 211
212config BOOT_TRACER 212config BOOT_TRACER
213 bool "Trace boot initcalls" 213 bool "Trace boot initcalls"
214 select TRACING 214 select GENERIC_TRACER
215 select CONTEXT_SWITCH_TRACER 215 select CONTEXT_SWITCH_TRACER
216 help 216 help
217 This tracer helps developers to optimize boot times: it records 217 This tracer helps developers to optimize boot times: it records
@@ -228,7 +228,7 @@ config BOOT_TRACER
228 228
229config TRACE_BRANCH_PROFILING 229config TRACE_BRANCH_PROFILING
230 bool 230 bool
231 select TRACING 231 select GENERIC_TRACER
232 232
233choice 233choice
234 prompt "Branch Profiling" 234 prompt "Branch Profiling"
@@ -308,7 +308,7 @@ config BRANCH_TRACER
308config POWER_TRACER 308config POWER_TRACER
309 bool "Trace power consumption behavior" 309 bool "Trace power consumption behavior"
310 depends on X86 310 depends on X86
311 select TRACING 311 select GENERIC_TRACER
312 help 312 help
313 This tracer helps developers to analyze and optimize the kernels 313 This tracer helps developers to analyze and optimize the kernels
314 power management decisions, specifically the C-state and P-state 314 power management decisions, specifically the C-state and P-state
@@ -342,14 +342,14 @@ config STACK_TRACER
342config HW_BRANCH_TRACER 342config HW_BRANCH_TRACER
343 depends on HAVE_HW_BRANCH_TRACER 343 depends on HAVE_HW_BRANCH_TRACER
344 bool "Trace hw branches" 344 bool "Trace hw branches"
345 select TRACING 345 select GENERIC_TRACER
346 help 346 help
347 This tracer records all branches on the system in a circular 347 This tracer records all branches on the system in a circular
348 buffer giving access to the last N branches for each cpu. 348 buffer giving access to the last N branches for each cpu.
349 349
350config KMEMTRACE 350config KMEMTRACE
351 bool "Trace SLAB allocations" 351 bool "Trace SLAB allocations"
352 select TRACING 352 select GENERIC_TRACER
353 help 353 help
354 kmemtrace provides tracing for slab allocator functions, such as 354 kmemtrace provides tracing for slab allocator functions, such as
355 kmalloc, kfree, kmem_cache_alloc, kmem_cache_free etc.. Collected 355 kmalloc, kfree, kmem_cache_alloc, kmem_cache_free etc.. Collected
@@ -369,7 +369,7 @@ config KMEMTRACE
369 369
370config WORKQUEUE_TRACER 370config WORKQUEUE_TRACER
371 bool "Trace workqueues" 371 bool "Trace workqueues"
372 select TRACING 372 select GENERIC_TRACER
373 help 373 help
374 The workqueue tracer provides some statistical informations 374 The workqueue tracer provides some statistical informations
375 about each cpu workqueue thread such as the number of the 375 about each cpu workqueue thread such as the number of the
@@ -385,7 +385,7 @@ config BLK_DEV_IO_TRACE
385 select RELAY 385 select RELAY
386 select DEBUG_FS 386 select DEBUG_FS
387 select TRACEPOINTS 387 select TRACEPOINTS
388 select TRACING 388 select GENERIC_TRACER
389 select STACKTRACE 389 select STACKTRACE
390 help 390 help
391 Say Y here if you want to be able to trace the block layer actions 391 Say Y here if you want to be able to trace the block layer actions
@@ -446,7 +446,7 @@ config FTRACE_SELFTEST
446 446
447config FTRACE_STARTUP_TEST 447config FTRACE_STARTUP_TEST
448 bool "Perform a startup test on ftrace" 448 bool "Perform a startup test on ftrace"
449 depends on TRACING 449 depends on GENERIC_TRACER
450 select FTRACE_SELFTEST 450 select FTRACE_SELFTEST
451 help 451 help
452 This option performs a series of startup tests on ftrace. On bootup 452 This option performs a series of startup tests on ftrace. On bootup
@@ -457,7 +457,7 @@ config FTRACE_STARTUP_TEST
457config MMIOTRACE 457config MMIOTRACE
458 bool "Memory mapped IO tracing" 458 bool "Memory mapped IO tracing"
459 depends on HAVE_MMIOTRACE_SUPPORT && PCI 459 depends on HAVE_MMIOTRACE_SUPPORT && PCI
460 select TRACING 460 select GENERIC_TRACER
461 help 461 help
462 Mmiotrace traces Memory Mapped I/O access and is meant for 462 Mmiotrace traces Memory Mapped I/O access and is meant for
463 debugging and reverse engineering. It is called from the ioremap 463 debugging and reverse engineering. It is called from the ioremap
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 140699a9a8a7..d6973dfadb36 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -32,6 +32,7 @@
32#include <trace/events/sched.h> 32#include <trace/events/sched.h>
33 33
34#include <asm/ftrace.h> 34#include <asm/ftrace.h>
35#include <asm/setup.h>
35 36
36#include "trace_output.h" 37#include "trace_output.h"
37#include "trace_stat.h" 38#include "trace_stat.h"
@@ -598,7 +599,7 @@ function_profile_call(unsigned long ip, unsigned long parent_ip)
598 local_irq_save(flags); 599 local_irq_save(flags);
599 600
600 stat = &__get_cpu_var(ftrace_profile_stats); 601 stat = &__get_cpu_var(ftrace_profile_stats);
601 if (!stat->hash) 602 if (!stat->hash || !ftrace_profile_enabled)
602 goto out; 603 goto out;
603 604
604 rec = ftrace_find_profiled_func(stat, ip); 605 rec = ftrace_find_profiled_func(stat, ip);
@@ -629,7 +630,7 @@ static void profile_graph_return(struct ftrace_graph_ret *trace)
629 630
630 local_irq_save(flags); 631 local_irq_save(flags);
631 stat = &__get_cpu_var(ftrace_profile_stats); 632 stat = &__get_cpu_var(ftrace_profile_stats);
632 if (!stat->hash) 633 if (!stat->hash || !ftrace_profile_enabled)
633 goto out; 634 goto out;
634 635
635 calltime = trace->rettime - trace->calltime; 636 calltime = trace->rettime - trace->calltime;
@@ -723,6 +724,10 @@ ftrace_profile_write(struct file *filp, const char __user *ubuf,
723 ftrace_profile_enabled = 1; 724 ftrace_profile_enabled = 1;
724 } else { 725 } else {
725 ftrace_profile_enabled = 0; 726 ftrace_profile_enabled = 0;
727 /*
728 * unregister_ftrace_profiler calls stop_machine
729 * so this acts like an synchronize_sched.
730 */
726 unregister_ftrace_profiler(); 731 unregister_ftrace_profiler();
727 } 732 }
728 } 733 }
@@ -2369,6 +2374,45 @@ void ftrace_set_notrace(unsigned char *buf, int len, int reset)
2369 ftrace_set_regex(buf, len, reset, 0); 2374 ftrace_set_regex(buf, len, reset, 0);
2370} 2375}
2371 2376
2377/*
2378 * command line interface to allow users to set filters on boot up.
2379 */
2380#define FTRACE_FILTER_SIZE COMMAND_LINE_SIZE
2381static char ftrace_notrace_buf[FTRACE_FILTER_SIZE] __initdata;
2382static char ftrace_filter_buf[FTRACE_FILTER_SIZE] __initdata;
2383
2384static int __init set_ftrace_notrace(char *str)
2385{
2386 strncpy(ftrace_notrace_buf, str, FTRACE_FILTER_SIZE);
2387 return 1;
2388}
2389__setup("ftrace_notrace=", set_ftrace_notrace);
2390
2391static int __init set_ftrace_filter(char *str)
2392{
2393 strncpy(ftrace_filter_buf, str, FTRACE_FILTER_SIZE);
2394 return 1;
2395}
2396__setup("ftrace_filter=", set_ftrace_filter);
2397
2398static void __init set_ftrace_early_filter(char *buf, int enable)
2399{
2400 char *func;
2401
2402 while (buf) {
2403 func = strsep(&buf, ",");
2404 ftrace_set_regex(func, strlen(func), 0, enable);
2405 }
2406}
2407
2408static void __init set_ftrace_early_filters(void)
2409{
2410 if (ftrace_filter_buf[0])
2411 set_ftrace_early_filter(ftrace_filter_buf, 1);
2412 if (ftrace_notrace_buf[0])
2413 set_ftrace_early_filter(ftrace_notrace_buf, 0);
2414}
2415
2372static int 2416static int
2373ftrace_regex_release(struct inode *inode, struct file *file, int enable) 2417ftrace_regex_release(struct inode *inode, struct file *file, int enable)
2374{ 2418{
@@ -2829,6 +2873,8 @@ void __init ftrace_init(void)
2829 if (ret) 2873 if (ret)
2830 pr_warning("Failed to register trace ftrace module notifier\n"); 2874 pr_warning("Failed to register trace ftrace module notifier\n");
2831 2875
2876 set_ftrace_early_filters();
2877
2832 return; 2878 return;
2833 failed: 2879 failed:
2834 ftrace_disabled = 1; 2880 ftrace_disabled = 1;
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index a3a8a87d7e91..cae34c69752f 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -2826,6 +2826,9 @@ static int tracing_open_pipe(struct inode *inode, struct file *filp)
2826 /* trace pipe does not show start of buffer */ 2826 /* trace pipe does not show start of buffer */
2827 cpumask_setall(iter->started); 2827 cpumask_setall(iter->started);
2828 2828
2829 if (trace_flags & TRACE_ITER_LATENCY_FMT)
2830 iter->iter_flags |= TRACE_FILE_LAT_FMT;
2831
2829 iter->cpu_file = cpu_file; 2832 iter->cpu_file = cpu_file;
2830 iter->tr = &global_trace; 2833 iter->tr = &global_trace;
2831 mutex_init(&iter->mutex); 2834 mutex_init(&iter->mutex);
diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c
index a7430b16d243..db6e54bdb596 100644
--- a/kernel/trace/trace_events_filter.c
+++ b/kernel/trace/trace_events_filter.c
@@ -478,12 +478,12 @@ enum {
478 478
479static int is_string_field(const char *type) 479static int is_string_field(const char *type)
480{ 480{
481 if (strstr(type, "__data_loc") && strstr(type, "char"))
482 return FILTER_DYN_STRING;
483
481 if (strchr(type, '[') && strstr(type, "char")) 484 if (strchr(type, '[') && strstr(type, "char"))
482 return FILTER_STATIC_STRING; 485 return FILTER_STATIC_STRING;
483 486
484 if (!strcmp(type, "__str_loc"))
485 return FILTER_DYN_STRING;
486
487 return 0; 487 return 0;
488} 488}
489 489
diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c
index c12d95db2f56..0fe3b223f7ed 100644
--- a/kernel/trace/trace_output.c
+++ b/kernel/trace/trace_output.c
@@ -17,6 +17,7 @@
17static DECLARE_RWSEM(trace_event_mutex); 17static DECLARE_RWSEM(trace_event_mutex);
18 18
19DEFINE_PER_CPU(struct trace_seq, ftrace_event_seq); 19DEFINE_PER_CPU(struct trace_seq, ftrace_event_seq);
20EXPORT_PER_CPU_SYMBOL(ftrace_event_seq);
20 21
21static struct hlist_head event_hash[EVENT_HASHSIZE] __read_mostly; 22static struct hlist_head event_hash[EVENT_HASHSIZE] __read_mostly;
22 23
@@ -250,6 +251,7 @@ ftrace_print_flags_seq(struct trace_seq *p, const char *delim,
250 251
251 return p->buffer; 252 return p->buffer;
252} 253}
254EXPORT_SYMBOL(ftrace_print_flags_seq);
253 255
254const char * 256const char *
255ftrace_print_symbols_seq(struct trace_seq *p, unsigned long val, 257ftrace_print_symbols_seq(struct trace_seq *p, unsigned long val,
@@ -275,6 +277,7 @@ ftrace_print_symbols_seq(struct trace_seq *p, unsigned long val,
275 277
276 return p->buffer; 278 return p->buffer;
277} 279}
280EXPORT_SYMBOL(ftrace_print_symbols_seq);
278 281
279#ifdef CONFIG_KRETPROBES 282#ifdef CONFIG_KRETPROBES
280static inline const char *kretprobed(const char *name) 283static inline const char *kretprobed(const char *name)