diff options
-rw-r--r-- | Documentation/kernel-parameters.txt | 8 | ||||
-rw-r--r-- | kernel/trace/trace.c | 58 |
2 files changed, 46 insertions, 20 deletions
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index 1bbcaa8982b6..4862284d3119 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt | |||
@@ -765,6 +765,14 @@ and is between 256 and 4096 characters. It is defined in the file | |||
765 | parameter will force ia64_sal_cache_flush to call | 765 | parameter will force ia64_sal_cache_flush to call |
766 | ia64_pal_cache_flush instead of SAL_CACHE_FLUSH. | 766 | ia64_pal_cache_flush instead of SAL_CACHE_FLUSH. |
767 | 767 | ||
768 | ftrace=[tracer] | ||
769 | [ftrace] will set and start the specified tracer | ||
770 | as early as possible in order to facilitate early | ||
771 | boot debugging. | ||
772 | |||
773 | ftrace_dump_on_oops | ||
774 | [ftrace] will dump the trace buffers on oops. | ||
775 | |||
768 | gamecon.map[2|3]= | 776 | gamecon.map[2|3]= |
769 | [HW,JOY] Multisystem joystick and NES/SNES/PSX pad | 777 | [HW,JOY] Multisystem joystick and NES/SNES/PSX pad |
770 | support via parallel port (up to 5 devices per port) | 778 | support via parallel port (up to 5 devices per port) |
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 | ||