aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2011-12-19 22:01:00 -0500
committerSteven Rostedt <rostedt@goodmis.org>2011-12-21 07:26:49 -0500
commit762e1207889b3451c50d365b741af6f9ce958886 (patch)
treedcb1f4eacbddfa342181a29a97eb9b994922b009
parent2a85a37f168d2b4d74d493b578af4dc9032be92e (diff)
tracing: Have stack tracing set filtered functions at boot
Add stacktrace_filter= to the kernel command line that lets the user pick specific functions to check the stack on. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r--Documentation/kernel-parameters.txt8
-rw-r--r--kernel/trace/trace_stack.c11
2 files changed, 19 insertions, 0 deletions
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index fd5c913c33c1..fde2ae06539a 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -2435,6 +2435,14 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
2435 stacktrace [FTRACE] 2435 stacktrace [FTRACE]
2436 Enabled the stack tracer on boot up. 2436 Enabled the stack tracer on boot up.
2437 2437
2438 stacktrace_filter=[function-list]
2439 [FTRACE] Limit the functions that the stack tracer
2440 will trace at boot up. function-list is a comma separated
2441 list of functions. This list can be changed at run
2442 time by the stack_trace_filter file in the debugfs
2443 tracing directory. Note, this enables stack tracing
2444 and the stacktrace above is not needed.
2445
2438 sti= [PARISC,HW] 2446 sti= [PARISC,HW]
2439 Format: <num> 2447 Format: <num>
2440 Set the STI (builtin display/keyboard on the HP-PARISC 2448 Set the STI (builtin display/keyboard on the HP-PARISC
diff --git a/kernel/trace/trace_stack.c b/kernel/trace/trace_stack.c
index 0398b7c7afd6..d4545f49242e 100644
--- a/kernel/trace/trace_stack.c
+++ b/kernel/trace/trace_stack.c
@@ -13,6 +13,9 @@
13#include <linux/sysctl.h> 13#include <linux/sysctl.h>
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/fs.h> 15#include <linux/fs.h>
16
17#include <asm/setup.h>
18
16#include "trace.h" 19#include "trace.h"
17 20
18#define STACK_TRACE_ENTRIES 500 21#define STACK_TRACE_ENTRIES 500
@@ -352,8 +355,13 @@ stack_trace_sysctl(struct ctl_table *table, int write,
352 return ret; 355 return ret;
353} 356}
354 357
358static char stack_trace_filter_buf[COMMAND_LINE_SIZE+1] __initdata;
359
355static __init int enable_stacktrace(char *str) 360static __init int enable_stacktrace(char *str)
356{ 361{
362 if (strncmp(str, "_filter=", 8) == 0)
363 strncpy(stack_trace_filter_buf, str+8, COMMAND_LINE_SIZE);
364
357 stack_tracer_enabled = 1; 365 stack_tracer_enabled = 1;
358 last_stack_tracer_enabled = 1; 366 last_stack_tracer_enabled = 1;
359 return 1; 367 return 1;
@@ -375,6 +383,9 @@ static __init int stack_trace_init(void)
375 trace_create_file("stack_trace_filter", 0444, d_tracer, 383 trace_create_file("stack_trace_filter", 0444, d_tracer,
376 NULL, &stack_trace_filter_fops); 384 NULL, &stack_trace_filter_fops);
377 385
386 if (stack_trace_filter_buf[0])
387 ftrace_set_early_filter(&trace_ops, stack_trace_filter_buf, 1);
388
378 if (stack_tracer_enabled) 389 if (stack_tracer_enabled)
379 register_ftrace_function(&trace_ops); 390 register_ftrace_function(&trace_ops);
380 391