diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-10-01 05:20:33 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-10-01 05:20:48 -0400 |
commit | 0aa73ba1c4e1ad1d51a29e0df95ccd9f746918b6 (patch) | |
tree | f0714ddcd02812b4fbe3b5405df9e4068f5587e2 /kernel/trace/ftrace.c | |
parent | 925936ebf35a95c290e010b784c962164e6728f3 (diff) | |
parent | 33974093c024f08caadd2fc71a83bd811ed1831d (diff) |
Merge branch 'tracing/urgent' into tracing/core
Merge reason: Pick up latest fixes and update to latest upstream.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/trace/ftrace.c')
-rw-r--r-- | kernel/trace/ftrace.c | 58 |
1 files changed, 25 insertions, 33 deletions
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index ddf23a225b52..9a72853a8f0a 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c | |||
@@ -225,7 +225,11 @@ static void ftrace_update_pid_func(void) | |||
225 | if (ftrace_trace_function == ftrace_stub) | 225 | if (ftrace_trace_function == ftrace_stub) |
226 | return; | 226 | return; |
227 | 227 | ||
228 | #ifdef CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST | ||
228 | func = ftrace_trace_function; | 229 | func = ftrace_trace_function; |
230 | #else | ||
231 | func = __ftrace_trace_function; | ||
232 | #endif | ||
229 | 233 | ||
230 | if (ftrace_pid_trace) { | 234 | if (ftrace_pid_trace) { |
231 | set_ftrace_pid_function(func); | 235 | set_ftrace_pid_function(func); |
@@ -1520,7 +1524,7 @@ static int t_show(struct seq_file *m, void *v) | |||
1520 | return 0; | 1524 | return 0; |
1521 | } | 1525 | } |
1522 | 1526 | ||
1523 | static struct seq_operations show_ftrace_seq_ops = { | 1527 | static const struct seq_operations show_ftrace_seq_ops = { |
1524 | .start = t_start, | 1528 | .start = t_start, |
1525 | .next = t_next, | 1529 | .next = t_next, |
1526 | .stop = t_stop, | 1530 | .stop = t_stop, |
@@ -1621,8 +1625,10 @@ ftrace_regex_open(struct inode *inode, struct file *file, int enable) | |||
1621 | if (!ret) { | 1625 | if (!ret) { |
1622 | struct seq_file *m = file->private_data; | 1626 | struct seq_file *m = file->private_data; |
1623 | m->private = iter; | 1627 | m->private = iter; |
1624 | } else | 1628 | } else { |
1629 | trace_parser_put(&iter->parser); | ||
1625 | kfree(iter); | 1630 | kfree(iter); |
1631 | } | ||
1626 | } else | 1632 | } else |
1627 | file->private_data = iter; | 1633 | file->private_data = iter; |
1628 | mutex_unlock(&ftrace_regex_lock); | 1634 | mutex_unlock(&ftrace_regex_lock); |
@@ -2148,7 +2154,7 @@ ftrace_regex_write(struct file *file, const char __user *ubuf, | |||
2148 | struct trace_parser *parser; | 2154 | struct trace_parser *parser; |
2149 | ssize_t ret, read; | 2155 | ssize_t ret, read; |
2150 | 2156 | ||
2151 | if (!cnt || cnt < 0) | 2157 | if (!cnt) |
2152 | return 0; | 2158 | return 0; |
2153 | 2159 | ||
2154 | mutex_lock(&ftrace_regex_lock); | 2160 | mutex_lock(&ftrace_regex_lock); |
@@ -2162,7 +2168,7 @@ ftrace_regex_write(struct file *file, const char __user *ubuf, | |||
2162 | parser = &iter->parser; | 2168 | parser = &iter->parser; |
2163 | read = trace_get_user(parser, ubuf, cnt, ppos); | 2169 | read = trace_get_user(parser, ubuf, cnt, ppos); |
2164 | 2170 | ||
2165 | if (trace_parser_loaded(parser) && | 2171 | if (read >= 0 && trace_parser_loaded(parser) && |
2166 | !trace_parser_cont(parser)) { | 2172 | !trace_parser_cont(parser)) { |
2167 | ret = ftrace_process_regex(parser->buffer, | 2173 | ret = ftrace_process_regex(parser->buffer, |
2168 | parser->idx, enable); | 2174 | parser->idx, enable); |
@@ -2360,11 +2366,9 @@ unsigned long ftrace_graph_funcs[FTRACE_GRAPH_MAX_FUNCS] __read_mostly; | |||
2360 | static void * | 2366 | static void * |
2361 | __g_next(struct seq_file *m, loff_t *pos) | 2367 | __g_next(struct seq_file *m, loff_t *pos) |
2362 | { | 2368 | { |
2363 | unsigned long *array = m->private; | ||
2364 | |||
2365 | if (*pos >= ftrace_graph_count) | 2369 | if (*pos >= ftrace_graph_count) |
2366 | return NULL; | 2370 | return NULL; |
2367 | return &array[*pos]; | 2371 | return &ftrace_graph_funcs[*pos]; |
2368 | } | 2372 | } |
2369 | 2373 | ||
2370 | static void * | 2374 | static void * |
@@ -2407,7 +2411,7 @@ static int g_show(struct seq_file *m, void *v) | |||
2407 | return 0; | 2411 | return 0; |
2408 | } | 2412 | } |
2409 | 2413 | ||
2410 | static struct seq_operations ftrace_graph_seq_ops = { | 2414 | static const struct seq_operations ftrace_graph_seq_ops = { |
2411 | .start = g_start, | 2415 | .start = g_start, |
2412 | .next = g_next, | 2416 | .next = g_next, |
2413 | .stop = g_stop, | 2417 | .stop = g_stop, |
@@ -2428,16 +2432,10 @@ ftrace_graph_open(struct inode *inode, struct file *file) | |||
2428 | ftrace_graph_count = 0; | 2432 | ftrace_graph_count = 0; |
2429 | memset(ftrace_graph_funcs, 0, sizeof(ftrace_graph_funcs)); | 2433 | memset(ftrace_graph_funcs, 0, sizeof(ftrace_graph_funcs)); |
2430 | } | 2434 | } |
2435 | mutex_unlock(&graph_lock); | ||
2431 | 2436 | ||
2432 | if (file->f_mode & FMODE_READ) { | 2437 | if (file->f_mode & FMODE_READ) |
2433 | ret = seq_open(file, &ftrace_graph_seq_ops); | 2438 | ret = seq_open(file, &ftrace_graph_seq_ops); |
2434 | if (!ret) { | ||
2435 | struct seq_file *m = file->private_data; | ||
2436 | m->private = ftrace_graph_funcs; | ||
2437 | } | ||
2438 | } else | ||
2439 | file->private_data = ftrace_graph_funcs; | ||
2440 | mutex_unlock(&graph_lock); | ||
2441 | 2439 | ||
2442 | return ret; | 2440 | return ret; |
2443 | } | 2441 | } |
@@ -2506,9 +2504,7 @@ ftrace_graph_write(struct file *file, const char __user *ubuf, | |||
2506 | size_t cnt, loff_t *ppos) | 2504 | size_t cnt, loff_t *ppos) |
2507 | { | 2505 | { |
2508 | struct trace_parser parser; | 2506 | struct trace_parser parser; |
2509 | unsigned long *array; | 2507 | ssize_t read, ret; |
2510 | size_t read = 0; | ||
2511 | ssize_t ret; | ||
2512 | 2508 | ||
2513 | if (!cnt || cnt < 0) | 2509 | if (!cnt || cnt < 0) |
2514 | return 0; | 2510 | return 0; |
@@ -2517,35 +2513,31 @@ ftrace_graph_write(struct file *file, const char __user *ubuf, | |||
2517 | 2513 | ||
2518 | if (ftrace_graph_count >= FTRACE_GRAPH_MAX_FUNCS) { | 2514 | if (ftrace_graph_count >= FTRACE_GRAPH_MAX_FUNCS) { |
2519 | ret = -EBUSY; | 2515 | ret = -EBUSY; |
2520 | goto out; | 2516 | goto out_unlock; |
2521 | } | 2517 | } |
2522 | 2518 | ||
2523 | if (file->f_mode & FMODE_READ) { | ||
2524 | struct seq_file *m = file->private_data; | ||
2525 | array = m->private; | ||
2526 | } else | ||
2527 | array = file->private_data; | ||
2528 | |||
2529 | if (trace_parser_get_init(&parser, FTRACE_BUFF_MAX)) { | 2519 | if (trace_parser_get_init(&parser, FTRACE_BUFF_MAX)) { |
2530 | ret = -ENOMEM; | 2520 | ret = -ENOMEM; |
2531 | goto out; | 2521 | goto out_unlock; |
2532 | } | 2522 | } |
2533 | 2523 | ||
2534 | read = trace_get_user(&parser, ubuf, cnt, ppos); | 2524 | read = trace_get_user(&parser, ubuf, cnt, ppos); |
2535 | 2525 | ||
2536 | if (trace_parser_loaded((&parser))) { | 2526 | if (read >= 0 && trace_parser_loaded((&parser))) { |
2537 | parser.buffer[parser.idx] = 0; | 2527 | parser.buffer[parser.idx] = 0; |
2538 | 2528 | ||
2539 | /* we allow only one expression at a time */ | 2529 | /* we allow only one expression at a time */ |
2540 | ret = ftrace_set_func(array, &ftrace_graph_count, | 2530 | ret = ftrace_set_func(ftrace_graph_funcs, &ftrace_graph_count, |
2541 | parser.buffer); | 2531 | parser.buffer); |
2542 | if (ret) | 2532 | if (ret) |
2543 | goto out; | 2533 | goto out_free; |
2544 | } | 2534 | } |
2545 | 2535 | ||
2546 | ret = read; | 2536 | ret = read; |
2547 | out: | 2537 | |
2538 | out_free: | ||
2548 | trace_parser_put(&parser); | 2539 | trace_parser_put(&parser); |
2540 | out_unlock: | ||
2549 | mutex_unlock(&graph_lock); | 2541 | mutex_unlock(&graph_lock); |
2550 | 2542 | ||
2551 | return ret; | 2543 | return ret; |
@@ -2976,7 +2968,7 @@ int unregister_ftrace_function(struct ftrace_ops *ops) | |||
2976 | 2968 | ||
2977 | int | 2969 | int |
2978 | ftrace_enable_sysctl(struct ctl_table *table, int write, | 2970 | ftrace_enable_sysctl(struct ctl_table *table, int write, |
2979 | struct file *file, void __user *buffer, size_t *lenp, | 2971 | void __user *buffer, size_t *lenp, |
2980 | loff_t *ppos) | 2972 | loff_t *ppos) |
2981 | { | 2973 | { |
2982 | int ret; | 2974 | int ret; |
@@ -2986,7 +2978,7 @@ ftrace_enable_sysctl(struct ctl_table *table, int write, | |||
2986 | 2978 | ||
2987 | mutex_lock(&ftrace_lock); | 2979 | mutex_lock(&ftrace_lock); |
2988 | 2980 | ||
2989 | ret = proc_dointvec(table, write, file, buffer, lenp, ppos); | 2981 | ret = proc_dointvec(table, write, buffer, lenp, ppos); |
2990 | 2982 | ||
2991 | if (ret || !write || (last_ftrace_enabled == !!ftrace_enabled)) | 2983 | if (ret || !write || (last_ftrace_enabled == !!ftrace_enabled)) |
2992 | goto out; | 2984 | goto out; |