diff options
author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2008-11-01 14:57:37 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-11-03 03:12:39 -0500 |
commit | d9e540762f5cdd89f24e518ad1fd31142d0b9726 (patch) | |
tree | 74f433c159183241020fed5e35eb7f3b4bb2edf3 /kernel/trace | |
parent | 36609469c8278554b046aa4cc9a5fa9ccea35306 (diff) |
ftrace: ftrace_dump_on_oops=[tracer]
Impact: add new (optional) debug boot option
In order to facilitate early boot trouble, allow one to specify a tracer
on the kernel boot line.
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/trace')
-rw-r--r-- | kernel/trace/trace.c | 58 |
1 files changed, 38 insertions, 20 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index bdb1df00fb10..482583eb8001 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
@@ -79,6 +79,15 @@ static int tracing_disabled = 1; | |||
79 | */ | 79 | */ |
80 | int ftrace_dump_on_oops; | 80 | int ftrace_dump_on_oops; |
81 | 81 | ||
82 | static int tracing_set_tracer(char *buf); | ||
83 | |||
84 | static int __init set_ftrace(char *str) | ||
85 | { | ||
86 | tracing_set_tracer(str); | ||
87 | return 1; | ||
88 | } | ||
89 | __setup("ftrace", set_ftrace); | ||
90 | |||
82 | static int __init set_ftrace_dump_on_oops(char *str) | 91 | static int __init set_ftrace_dump_on_oops(char *str) |
83 | { | 92 | { |
84 | ftrace_dump_on_oops = 1; | 93 | ftrace_dump_on_oops = 1; |
@@ -2394,29 +2403,11 @@ tracing_set_trace_read(struct file *filp, char __user *ubuf, | |||
2394 | return simple_read_from_buffer(ubuf, cnt, ppos, buf, r); | 2403 | return simple_read_from_buffer(ubuf, cnt, ppos, buf, r); |
2395 | } | 2404 | } |
2396 | 2405 | ||
2397 | static ssize_t | 2406 | static int tracing_set_tracer(char *buf) |
2398 | tracing_set_trace_write(struct file *filp, const char __user *ubuf, | ||
2399 | size_t cnt, loff_t *ppos) | ||
2400 | { | 2407 | { |
2401 | struct trace_array *tr = &global_trace; | 2408 | struct trace_array *tr = &global_trace; |
2402 | struct tracer *t; | 2409 | struct tracer *t; |
2403 | char buf[max_tracer_type_len+1]; | 2410 | int ret = 0; |
2404 | int i; | ||
2405 | size_t ret; | ||
2406 | |||
2407 | ret = cnt; | ||
2408 | |||
2409 | if (cnt > max_tracer_type_len) | ||
2410 | cnt = max_tracer_type_len; | ||
2411 | |||
2412 | if (copy_from_user(&buf, ubuf, cnt)) | ||
2413 | return -EFAULT; | ||
2414 | |||
2415 | buf[cnt] = 0; | ||
2416 | |||
2417 | /* strip ending whitespace. */ | ||
2418 | for (i = cnt - 1; i > 0 && isspace(buf[i]); i--) | ||
2419 | buf[i] = 0; | ||
2420 | 2411 | ||
2421 | mutex_lock(&trace_types_lock); | 2412 | mutex_lock(&trace_types_lock); |
2422 | for (t = trace_types; t; t = t->next) { | 2413 | for (t = trace_types; t; t = t->next) { |
@@ -2440,6 +2431,33 @@ tracing_set_trace_write(struct file *filp, const char __user *ubuf, | |||
2440 | out: | 2431 | out: |
2441 | mutex_unlock(&trace_types_lock); | 2432 | mutex_unlock(&trace_types_lock); |
2442 | 2433 | ||
2434 | return ret; | ||
2435 | } | ||
2436 | |||
2437 | static ssize_t | ||
2438 | tracing_set_trace_write(struct file *filp, const char __user *ubuf, | ||
2439 | size_t cnt, loff_t *ppos) | ||
2440 | { | ||
2441 | char buf[max_tracer_type_len+1]; | ||
2442 | int i; | ||
2443 | size_t ret; | ||
2444 | |||
2445 | if (cnt > max_tracer_type_len) | ||
2446 | cnt = max_tracer_type_len; | ||
2447 | |||
2448 | if (copy_from_user(&buf, ubuf, cnt)) | ||
2449 | return -EFAULT; | ||
2450 | |||
2451 | buf[cnt] = 0; | ||
2452 | |||
2453 | /* strip ending whitespace. */ | ||
2454 | for (i = cnt - 1; i > 0 && isspace(buf[i]); i--) | ||
2455 | buf[i] = 0; | ||
2456 | |||
2457 | ret = tracing_set_tracer(buf); | ||
2458 | if (!ret) | ||
2459 | ret = cnt; | ||
2460 | |||
2443 | if (ret > 0) | 2461 | if (ret > 0) |
2444 | filp->f_pos += ret; | 2462 | filp->f_pos += ret; |
2445 | 2463 | ||