diff options
author | Stefan Assmann <sassmann@redhat.com> | 2009-10-12 16:17:21 -0400 |
---|---|---|
committer | Frederic Weisbecker <fweisbec@gmail.com> | 2009-10-12 16:17:21 -0400 |
commit | 369bc18f9a6c4e2686204c1d7476ab684a720968 (patch) | |
tree | 84606ab4244907d10b60fb091f2d2e23024ebbae /kernel/trace/ftrace.c | |
parent | 3c355863fb32070a2800f41106519c5c3038623a (diff) |
ftrace: add kernel command line graph function filtering
Add a command line parameter to allow limiting the function graphs
that are traced on boot up from the given top-level callers , when
ftrace=function_graph is specified.
This patch adds the following command line option:
ftrace_graph_filter=function-list
Where function-list is a comma separated list of functions to filter.
[fweisbec@gmail.com: picked the documentation changes from the v2 patch]
Signed-off-by: Stefan Assmann <sassmann@redhat.com>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
LKML-Reference: <4AD2DEB9.2@redhat.com>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Diffstat (limited to 'kernel/trace/ftrace.c')
-rw-r--r-- | kernel/trace/ftrace.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index 9a72853a8f0a..91283d40821e 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c | |||
@@ -78,6 +78,10 @@ ftrace_func_t ftrace_trace_function __read_mostly = ftrace_stub; | |||
78 | ftrace_func_t __ftrace_trace_function __read_mostly = ftrace_stub; | 78 | ftrace_func_t __ftrace_trace_function __read_mostly = ftrace_stub; |
79 | ftrace_func_t ftrace_pid_function __read_mostly = ftrace_stub; | 79 | ftrace_func_t ftrace_pid_function __read_mostly = ftrace_stub; |
80 | 80 | ||
81 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER | ||
82 | static int ftrace_set_func(unsigned long *array, int *idx, char *buffer); | ||
83 | #endif | ||
84 | |||
81 | static void ftrace_list_func(unsigned long ip, unsigned long parent_ip) | 85 | static void ftrace_list_func(unsigned long ip, unsigned long parent_ip) |
82 | { | 86 | { |
83 | struct ftrace_ops *op = ftrace_list; | 87 | struct ftrace_ops *op = ftrace_list; |
@@ -2248,6 +2252,7 @@ void ftrace_set_notrace(unsigned char *buf, int len, int reset) | |||
2248 | #define FTRACE_FILTER_SIZE COMMAND_LINE_SIZE | 2252 | #define FTRACE_FILTER_SIZE COMMAND_LINE_SIZE |
2249 | static char ftrace_notrace_buf[FTRACE_FILTER_SIZE] __initdata; | 2253 | static char ftrace_notrace_buf[FTRACE_FILTER_SIZE] __initdata; |
2250 | static char ftrace_filter_buf[FTRACE_FILTER_SIZE] __initdata; | 2254 | static char ftrace_filter_buf[FTRACE_FILTER_SIZE] __initdata; |
2255 | static char ftrace_graph_buf[FTRACE_FILTER_SIZE] __initdata; | ||
2251 | 2256 | ||
2252 | static int __init set_ftrace_notrace(char *str) | 2257 | static int __init set_ftrace_notrace(char *str) |
2253 | { | 2258 | { |
@@ -2263,6 +2268,31 @@ static int __init set_ftrace_filter(char *str) | |||
2263 | } | 2268 | } |
2264 | __setup("ftrace_filter=", set_ftrace_filter); | 2269 | __setup("ftrace_filter=", set_ftrace_filter); |
2265 | 2270 | ||
2271 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER | ||
2272 | static int __init set_graph_function(char *str) | ||
2273 | { | ||
2274 | strncpy(ftrace_graph_buf, str, FTRACE_FILTER_SIZE); | ||
2275 | return 1; | ||
2276 | } | ||
2277 | __setup("ftrace_graph_filter=", set_graph_function); | ||
2278 | |||
2279 | static void __init set_ftrace_early_graph(char *buf) | ||
2280 | { | ||
2281 | int ret; | ||
2282 | char *func; | ||
2283 | |||
2284 | while (buf) { | ||
2285 | func = strsep(&buf, ","); | ||
2286 | /* we allow only one expression at a time */ | ||
2287 | ret = ftrace_set_func(ftrace_graph_funcs, &ftrace_graph_count, | ||
2288 | func); | ||
2289 | if (ret) | ||
2290 | printk(KERN_DEBUG "ftrace: function %s not " | ||
2291 | "traceable\n", func); | ||
2292 | } | ||
2293 | } | ||
2294 | #endif /* CONFIG_FUNCTION_GRAPH_TRACER */ | ||
2295 | |||
2266 | static void __init set_ftrace_early_filter(char *buf, int enable) | 2296 | static void __init set_ftrace_early_filter(char *buf, int enable) |
2267 | { | 2297 | { |
2268 | char *func; | 2298 | char *func; |
@@ -2279,6 +2309,10 @@ static void __init set_ftrace_early_filters(void) | |||
2279 | set_ftrace_early_filter(ftrace_filter_buf, 1); | 2309 | set_ftrace_early_filter(ftrace_filter_buf, 1); |
2280 | if (ftrace_notrace_buf[0]) | 2310 | if (ftrace_notrace_buf[0]) |
2281 | set_ftrace_early_filter(ftrace_notrace_buf, 0); | 2311 | set_ftrace_early_filter(ftrace_notrace_buf, 0); |
2312 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER | ||
2313 | if (ftrace_graph_buf[0]) | ||
2314 | set_ftrace_early_graph(ftrace_graph_buf); | ||
2315 | #endif /* CONFIG_FUNCTION_GRAPH_TRACER */ | ||
2282 | } | 2316 | } |
2283 | 2317 | ||
2284 | static int | 2318 | static int |