diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-10-06 09:02:30 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-10-06 09:02:34 -0400 |
commit | d9b2002c406011164f245de7a81304625989f1c9 (patch) | |
tree | a2bb74773cd1409acbec5eb2fbba2ae9889d55e8 /kernel/trace | |
parent | c3b32fcbc7f4fd9a9b84718b991b175b0fd53f8c (diff) | |
parent | 906010b2134e14a2e377decbadd357b3d0ab9c6a (diff) |
Merge branch 'perf/urgent' into perf/core
Merge reason: Upcoming patch is dependent on a fix in perf/urgent.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/trace')
-rw-r--r-- | kernel/trace/Kconfig | 2 | ||||
-rw-r--r-- | kernel/trace/ftrace.c | 31 | ||||
-rw-r--r-- | kernel/trace/trace.c | 13 | ||||
-rw-r--r-- | kernel/trace/trace_events.c | 7 | ||||
-rw-r--r-- | kernel/trace/trace_hw_branches.c | 2 | ||||
-rw-r--r-- | kernel/trace/trace_stack.c | 4 | ||||
-rw-r--r-- | kernel/trace/trace_syscalls.c | 4 |
7 files changed, 31 insertions, 32 deletions
diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig index e71634604400..b416512ad17f 100644 --- a/kernel/trace/Kconfig +++ b/kernel/trace/Kconfig | |||
@@ -83,7 +83,7 @@ config RING_BUFFER_ALLOW_SWAP | |||
83 | # This allows those options to appear when no other tracer is selected. But the | 83 | # This allows those options to appear when no other tracer is selected. But the |
84 | # options do not appear when something else selects it. We need the two options | 84 | # options do not appear when something else selects it. We need the two options |
85 | # GENERIC_TRACER and TRACING to avoid circular dependencies to accomplish the | 85 | # GENERIC_TRACER and TRACING to avoid circular dependencies to accomplish the |
86 | # hidding of the automatic options options. | 86 | # hidding of the automatic options. |
87 | 87 | ||
88 | config TRACING | 88 | config TRACING |
89 | bool | 89 | bool |
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index c71e91bf7372..46592feab5a6 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c | |||
@@ -1520,7 +1520,7 @@ static int t_show(struct seq_file *m, void *v) | |||
1520 | return 0; | 1520 | return 0; |
1521 | } | 1521 | } |
1522 | 1522 | ||
1523 | static struct seq_operations show_ftrace_seq_ops = { | 1523 | static const struct seq_operations show_ftrace_seq_ops = { |
1524 | .start = t_start, | 1524 | .start = t_start, |
1525 | .next = t_next, | 1525 | .next = t_next, |
1526 | .stop = t_stop, | 1526 | .stop = t_stop, |
@@ -1621,8 +1621,10 @@ ftrace_regex_open(struct inode *inode, struct file *file, int enable) | |||
1621 | if (!ret) { | 1621 | if (!ret) { |
1622 | struct seq_file *m = file->private_data; | 1622 | struct seq_file *m = file->private_data; |
1623 | m->private = iter; | 1623 | m->private = iter; |
1624 | } else | 1624 | } else { |
1625 | trace_parser_put(&iter->parser); | ||
1625 | kfree(iter); | 1626 | kfree(iter); |
1627 | } | ||
1626 | } else | 1628 | } else |
1627 | file->private_data = iter; | 1629 | file->private_data = iter; |
1628 | mutex_unlock(&ftrace_regex_lock); | 1630 | mutex_unlock(&ftrace_regex_lock); |
@@ -2202,7 +2204,7 @@ ftrace_regex_write(struct file *file, const char __user *ubuf, | |||
2202 | struct trace_parser *parser; | 2204 | struct trace_parser *parser; |
2203 | ssize_t ret, read; | 2205 | ssize_t ret, read; |
2204 | 2206 | ||
2205 | if (!cnt || cnt < 0) | 2207 | if (!cnt) |
2206 | return 0; | 2208 | return 0; |
2207 | 2209 | ||
2208 | mutex_lock(&ftrace_regex_lock); | 2210 | mutex_lock(&ftrace_regex_lock); |
@@ -2216,7 +2218,7 @@ ftrace_regex_write(struct file *file, const char __user *ubuf, | |||
2216 | parser = &iter->parser; | 2218 | parser = &iter->parser; |
2217 | read = trace_get_user(parser, ubuf, cnt, ppos); | 2219 | read = trace_get_user(parser, ubuf, cnt, ppos); |
2218 | 2220 | ||
2219 | if (trace_parser_loaded(parser) && | 2221 | if (read >= 0 && trace_parser_loaded(parser) && |
2220 | !trace_parser_cont(parser)) { | 2222 | !trace_parser_cont(parser)) { |
2221 | ret = ftrace_process_regex(parser->buffer, | 2223 | ret = ftrace_process_regex(parser->buffer, |
2222 | parser->idx, enable); | 2224 | parser->idx, enable); |
@@ -2459,7 +2461,7 @@ static int g_show(struct seq_file *m, void *v) | |||
2459 | return 0; | 2461 | return 0; |
2460 | } | 2462 | } |
2461 | 2463 | ||
2462 | static struct seq_operations ftrace_graph_seq_ops = { | 2464 | static const struct seq_operations ftrace_graph_seq_ops = { |
2463 | .start = g_start, | 2465 | .start = g_start, |
2464 | .next = g_next, | 2466 | .next = g_next, |
2465 | .stop = g_stop, | 2467 | .stop = g_stop, |
@@ -2552,8 +2554,7 @@ ftrace_graph_write(struct file *file, const char __user *ubuf, | |||
2552 | size_t cnt, loff_t *ppos) | 2554 | size_t cnt, loff_t *ppos) |
2553 | { | 2555 | { |
2554 | struct trace_parser parser; | 2556 | struct trace_parser parser; |
2555 | size_t read = 0; | 2557 | ssize_t read, ret; |
2556 | ssize_t ret; | ||
2557 | 2558 | ||
2558 | if (!cnt || cnt < 0) | 2559 | if (!cnt || cnt < 0) |
2559 | return 0; | 2560 | return 0; |
@@ -2562,29 +2563,31 @@ ftrace_graph_write(struct file *file, const char __user *ubuf, | |||
2562 | 2563 | ||
2563 | if (ftrace_graph_count >= FTRACE_GRAPH_MAX_FUNCS) { | 2564 | if (ftrace_graph_count >= FTRACE_GRAPH_MAX_FUNCS) { |
2564 | ret = -EBUSY; | 2565 | ret = -EBUSY; |
2565 | goto out; | 2566 | goto out_unlock; |
2566 | } | 2567 | } |
2567 | 2568 | ||
2568 | if (trace_parser_get_init(&parser, FTRACE_BUFF_MAX)) { | 2569 | if (trace_parser_get_init(&parser, FTRACE_BUFF_MAX)) { |
2569 | ret = -ENOMEM; | 2570 | ret = -ENOMEM; |
2570 | goto out; | 2571 | goto out_unlock; |
2571 | } | 2572 | } |
2572 | 2573 | ||
2573 | read = trace_get_user(&parser, ubuf, cnt, ppos); | 2574 | read = trace_get_user(&parser, ubuf, cnt, ppos); |
2574 | 2575 | ||
2575 | if (trace_parser_loaded((&parser))) { | 2576 | if (read >= 0 && trace_parser_loaded((&parser))) { |
2576 | parser.buffer[parser.idx] = 0; | 2577 | parser.buffer[parser.idx] = 0; |
2577 | 2578 | ||
2578 | /* we allow only one expression at a time */ | 2579 | /* we allow only one expression at a time */ |
2579 | ret = ftrace_set_func(ftrace_graph_funcs, &ftrace_graph_count, | 2580 | ret = ftrace_set_func(ftrace_graph_funcs, &ftrace_graph_count, |
2580 | parser.buffer); | 2581 | parser.buffer); |
2581 | if (ret) | 2582 | if (ret) |
2582 | goto out; | 2583 | goto out_free; |
2583 | } | 2584 | } |
2584 | 2585 | ||
2585 | ret = read; | 2586 | ret = read; |
2586 | out: | 2587 | |
2588 | out_free: | ||
2587 | trace_parser_put(&parser); | 2589 | trace_parser_put(&parser); |
2590 | out_unlock: | ||
2588 | mutex_unlock(&graph_lock); | 2591 | mutex_unlock(&graph_lock); |
2589 | 2592 | ||
2590 | return ret; | 2593 | return ret; |
@@ -3015,7 +3018,7 @@ int unregister_ftrace_function(struct ftrace_ops *ops) | |||
3015 | 3018 | ||
3016 | int | 3019 | int |
3017 | ftrace_enable_sysctl(struct ctl_table *table, int write, | 3020 | ftrace_enable_sysctl(struct ctl_table *table, int write, |
3018 | struct file *file, void __user *buffer, size_t *lenp, | 3021 | void __user *buffer, size_t *lenp, |
3019 | loff_t *ppos) | 3022 | loff_t *ppos) |
3020 | { | 3023 | { |
3021 | int ret; | 3024 | int ret; |
@@ -3025,7 +3028,7 @@ ftrace_enable_sysctl(struct ctl_table *table, int write, | |||
3025 | 3028 | ||
3026 | mutex_lock(&ftrace_lock); | 3029 | mutex_lock(&ftrace_lock); |
3027 | 3030 | ||
3028 | ret = proc_dointvec(table, write, file, buffer, lenp, ppos); | 3031 | ret = proc_dointvec(table, write, buffer, lenp, ppos); |
3029 | 3032 | ||
3030 | if (ret || !write || (last_ftrace_enabled == !!ftrace_enabled)) | 3033 | if (ret || !write || (last_ftrace_enabled == !!ftrace_enabled)) |
3031 | goto out; | 3034 | goto out; |
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index a35925d222ba..45068269ebb1 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
@@ -415,7 +415,7 @@ int trace_get_user(struct trace_parser *parser, const char __user *ubuf, | |||
415 | 415 | ||
416 | /* read the non-space input */ | 416 | /* read the non-space input */ |
417 | while (cnt && !isspace(ch)) { | 417 | while (cnt && !isspace(ch)) { |
418 | if (parser->idx < parser->size) | 418 | if (parser->idx < parser->size - 1) |
419 | parser->buffer[parser->idx++] = ch; | 419 | parser->buffer[parser->idx++] = ch; |
420 | else { | 420 | else { |
421 | ret = -EINVAL; | 421 | ret = -EINVAL; |
@@ -1949,7 +1949,7 @@ static int s_show(struct seq_file *m, void *v) | |||
1949 | return 0; | 1949 | return 0; |
1950 | } | 1950 | } |
1951 | 1951 | ||
1952 | static struct seq_operations tracer_seq_ops = { | 1952 | static const struct seq_operations tracer_seq_ops = { |
1953 | .start = s_start, | 1953 | .start = s_start, |
1954 | .next = s_next, | 1954 | .next = s_next, |
1955 | .stop = s_stop, | 1955 | .stop = s_stop, |
@@ -1984,11 +1984,9 @@ __tracing_open(struct inode *inode, struct file *file) | |||
1984 | if (current_trace) | 1984 | if (current_trace) |
1985 | *iter->trace = *current_trace; | 1985 | *iter->trace = *current_trace; |
1986 | 1986 | ||
1987 | if (!alloc_cpumask_var(&iter->started, GFP_KERNEL)) | 1987 | if (!zalloc_cpumask_var(&iter->started, GFP_KERNEL)) |
1988 | goto fail; | 1988 | goto fail; |
1989 | 1989 | ||
1990 | cpumask_clear(iter->started); | ||
1991 | |||
1992 | if (current_trace && current_trace->print_max) | 1990 | if (current_trace && current_trace->print_max) |
1993 | iter->tr = &max_tr; | 1991 | iter->tr = &max_tr; |
1994 | else | 1992 | else |
@@ -2163,7 +2161,7 @@ static int t_show(struct seq_file *m, void *v) | |||
2163 | return 0; | 2161 | return 0; |
2164 | } | 2162 | } |
2165 | 2163 | ||
2166 | static struct seq_operations show_traces_seq_ops = { | 2164 | static const struct seq_operations show_traces_seq_ops = { |
2167 | .start = t_start, | 2165 | .start = t_start, |
2168 | .next = t_next, | 2166 | .next = t_next, |
2169 | .stop = t_stop, | 2167 | .stop = t_stop, |
@@ -4389,7 +4387,7 @@ __init static int tracer_alloc_buffers(void) | |||
4389 | if (!alloc_cpumask_var(&tracing_cpumask, GFP_KERNEL)) | 4387 | if (!alloc_cpumask_var(&tracing_cpumask, GFP_KERNEL)) |
4390 | goto out_free_buffer_mask; | 4388 | goto out_free_buffer_mask; |
4391 | 4389 | ||
4392 | if (!alloc_cpumask_var(&tracing_reader_cpumask, GFP_KERNEL)) | 4390 | if (!zalloc_cpumask_var(&tracing_reader_cpumask, GFP_KERNEL)) |
4393 | goto out_free_tracing_cpumask; | 4391 | goto out_free_tracing_cpumask; |
4394 | 4392 | ||
4395 | /* To save memory, keep the ring buffer size to its minimum */ | 4393 | /* To save memory, keep the ring buffer size to its minimum */ |
@@ -4400,7 +4398,6 @@ __init static int tracer_alloc_buffers(void) | |||
4400 | 4398 | ||
4401 | cpumask_copy(tracing_buffer_mask, cpu_possible_mask); | 4399 | cpumask_copy(tracing_buffer_mask, cpu_possible_mask); |
4402 | cpumask_copy(tracing_cpumask, cpu_all_mask); | 4400 | cpumask_copy(tracing_cpumask, cpu_all_mask); |
4403 | cpumask_clear(tracing_reader_cpumask); | ||
4404 | 4401 | ||
4405 | /* TODO: make the number of buffers hot pluggable with CPUS */ | 4402 | /* TODO: make the number of buffers hot pluggable with CPUS */ |
4406 | global_trace.buffer = ring_buffer_alloc(ring_buf_size, | 4403 | global_trace.buffer = ring_buffer_alloc(ring_buf_size, |
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c index 6f03c8a1105e..d128f65778e6 100644 --- a/kernel/trace/trace_events.c +++ b/kernel/trace/trace_events.c | |||
@@ -232,10 +232,9 @@ ftrace_event_write(struct file *file, const char __user *ubuf, | |||
232 | size_t cnt, loff_t *ppos) | 232 | size_t cnt, loff_t *ppos) |
233 | { | 233 | { |
234 | struct trace_parser parser; | 234 | struct trace_parser parser; |
235 | size_t read = 0; | 235 | ssize_t read, ret; |
236 | ssize_t ret; | ||
237 | 236 | ||
238 | if (!cnt || cnt < 0) | 237 | if (!cnt) |
239 | return 0; | 238 | return 0; |
240 | 239 | ||
241 | ret = tracing_update_buffers(); | 240 | ret = tracing_update_buffers(); |
@@ -247,7 +246,7 @@ ftrace_event_write(struct file *file, const char __user *ubuf, | |||
247 | 246 | ||
248 | read = trace_get_user(&parser, ubuf, cnt, ppos); | 247 | read = trace_get_user(&parser, ubuf, cnt, ppos); |
249 | 248 | ||
250 | if (trace_parser_loaded((&parser))) { | 249 | if (read >= 0 && trace_parser_loaded((&parser))) { |
251 | int set = 1; | 250 | int set = 1; |
252 | 251 | ||
253 | if (*parser.buffer == '!') | 252 | if (*parser.buffer == '!') |
diff --git a/kernel/trace/trace_hw_branches.c b/kernel/trace/trace_hw_branches.c index ca7d7c4d0c2a..23b63859130e 100644 --- a/kernel/trace/trace_hw_branches.c +++ b/kernel/trace/trace_hw_branches.c | |||
@@ -155,7 +155,7 @@ static enum print_line_t bts_trace_print_line(struct trace_iterator *iter) | |||
155 | seq_print_ip_sym(seq, it->from, symflags) && | 155 | seq_print_ip_sym(seq, it->from, symflags) && |
156 | trace_seq_printf(seq, "\n")) | 156 | trace_seq_printf(seq, "\n")) |
157 | return TRACE_TYPE_HANDLED; | 157 | return TRACE_TYPE_HANDLED; |
158 | return TRACE_TYPE_PARTIAL_LINE;; | 158 | return TRACE_TYPE_PARTIAL_LINE; |
159 | } | 159 | } |
160 | return TRACE_TYPE_UNHANDLED; | 160 | return TRACE_TYPE_UNHANDLED; |
161 | } | 161 | } |
diff --git a/kernel/trace/trace_stack.c b/kernel/trace/trace_stack.c index 0f6facb050a1..8504ac71e4e8 100644 --- a/kernel/trace/trace_stack.c +++ b/kernel/trace/trace_stack.c | |||
@@ -296,14 +296,14 @@ static const struct file_operations stack_trace_fops = { | |||
296 | 296 | ||
297 | int | 297 | int |
298 | stack_trace_sysctl(struct ctl_table *table, int write, | 298 | stack_trace_sysctl(struct ctl_table *table, int write, |
299 | struct file *file, void __user *buffer, size_t *lenp, | 299 | void __user *buffer, size_t *lenp, |
300 | loff_t *ppos) | 300 | loff_t *ppos) |
301 | { | 301 | { |
302 | int ret; | 302 | int ret; |
303 | 303 | ||
304 | mutex_lock(&stack_sysctl_mutex); | 304 | mutex_lock(&stack_sysctl_mutex); |
305 | 305 | ||
306 | ret = proc_dointvec(table, write, file, buffer, lenp, ppos); | 306 | ret = proc_dointvec(table, write, buffer, lenp, ppos); |
307 | 307 | ||
308 | if (ret || !write || | 308 | if (ret || !write || |
309 | (last_stack_tracer_enabled == !!stack_tracer_enabled)) | 309 | (last_stack_tracer_enabled == !!stack_tracer_enabled)) |
diff --git a/kernel/trace/trace_syscalls.c b/kernel/trace/trace_syscalls.c index 9fbce6c9d2e1..527e17eae575 100644 --- a/kernel/trace/trace_syscalls.c +++ b/kernel/trace/trace_syscalls.c | |||
@@ -166,7 +166,7 @@ int syscall_exit_format(struct ftrace_event_call *call, struct trace_seq *s) | |||
166 | "\tfield:%s %s;\toffset:%zu;\tsize:%zu;\n" | 166 | "\tfield:%s %s;\toffset:%zu;\tsize:%zu;\n" |
167 | "\tfield:%s %s;\toffset:%zu;\tsize:%zu;\n", | 167 | "\tfield:%s %s;\toffset:%zu;\tsize:%zu;\n", |
168 | SYSCALL_FIELD(int, nr), | 168 | SYSCALL_FIELD(int, nr), |
169 | SYSCALL_FIELD(unsigned long, ret)); | 169 | SYSCALL_FIELD(long, ret)); |
170 | if (!ret) | 170 | if (!ret) |
171 | return 0; | 171 | return 0; |
172 | 172 | ||
@@ -212,7 +212,7 @@ int syscall_exit_define_fields(struct ftrace_event_call *call) | |||
212 | if (ret) | 212 | if (ret) |
213 | return ret; | 213 | return ret; |
214 | 214 | ||
215 | ret = trace_define_field(call, SYSCALL_FIELD(unsigned long, ret), 0, | 215 | ret = trace_define_field(call, SYSCALL_FIELD(long, ret), 0, |
216 | FILTER_OTHER); | 216 | FILTER_OTHER); |
217 | 217 | ||
218 | return ret; | 218 | return ret; |