diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-02-11 04:03:53 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-02-11 04:03:53 -0500 |
commit | 4040068dce64f75c9d414f41fc2fb314a44bad65 (patch) | |
tree | 10c4e51ddf9fb33112b773e56905d189909e35b0 | |
parent | d524e03207591a6de7e6b5069aabc778e3f0f5f8 (diff) | |
parent | c3706f005c3aaf570e71f0f083fdbb59a5a9fa2e (diff) |
Merge branch 'tip/tracing/ftrace' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace into tracing/ftrace
-rw-r--r-- | arch/x86/kernel/ftrace.c | 9 | ||||
-rw-r--r-- | include/linux/ring_buffer.h | 2 | ||||
-rw-r--r-- | kernel/trace/ring_buffer.c | 46 | ||||
-rw-r--r-- | kernel/trace/trace.c | 2 | ||||
-rw-r--r-- | kernel/trace/trace_branch.c | 4 | ||||
-rw-r--r-- | kernel/trace/trace_functions_graph.c | 14 | ||||
-rw-r--r-- | kernel/trace/trace_hw_branches.c | 2 | ||||
-rw-r--r-- | kernel/trace/trace_sysprof.c | 2 |
8 files changed, 42 insertions, 39 deletions
diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c index f20f49f7d244..2f9c0c8cb4c7 100644 --- a/arch/x86/kernel/ftrace.c +++ b/arch/x86/kernel/ftrace.c | |||
@@ -468,8 +468,8 @@ void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr) | |||
468 | * ignore such a protection. | 468 | * ignore such a protection. |
469 | */ | 469 | */ |
470 | asm volatile( | 470 | asm volatile( |
471 | "1: " _ASM_MOV " (%[parent_old]), %[old]\n" | 471 | "1: " _ASM_MOV " (%[parent]), %[old]\n" |
472 | "2: " _ASM_MOV " %[return_hooker], (%[parent_replaced])\n" | 472 | "2: " _ASM_MOV " %[return_hooker], (%[parent])\n" |
473 | " movl $0, %[faulted]\n" | 473 | " movl $0, %[faulted]\n" |
474 | "3:\n" | 474 | "3:\n" |
475 | 475 | ||
@@ -481,9 +481,8 @@ void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr) | |||
481 | _ASM_EXTABLE(1b, 4b) | 481 | _ASM_EXTABLE(1b, 4b) |
482 | _ASM_EXTABLE(2b, 4b) | 482 | _ASM_EXTABLE(2b, 4b) |
483 | 483 | ||
484 | : [parent_replaced] "=r" (parent), [old] "=r" (old), | 484 | : [old] "=r" (old), [faulted] "=r" (faulted) |
485 | [faulted] "=r" (faulted) | 485 | : [parent] "r" (parent), [return_hooker] "r" (return_hooker) |
486 | : [parent_old] "0" (parent), [return_hooker] "r" (return_hooker) | ||
487 | : "memory" | 486 | : "memory" |
488 | ); | 487 | ); |
489 | 488 | ||
diff --git a/include/linux/ring_buffer.h b/include/linux/ring_buffer.h index 3c103d636da3..8e6646a54acf 100644 --- a/include/linux/ring_buffer.h +++ b/include/linux/ring_buffer.h | |||
@@ -8,7 +8,7 @@ struct ring_buffer; | |||
8 | struct ring_buffer_iter; | 8 | struct ring_buffer_iter; |
9 | 9 | ||
10 | /* | 10 | /* |
11 | * Don't reference this struct directly, use functions below. | 11 | * Don't refer to this struct directly, use functions below. |
12 | */ | 12 | */ |
13 | struct ring_buffer_event { | 13 | struct ring_buffer_event { |
14 | u32 type:2, len:3, time_delta:27; | 14 | u32 type:2, len:3, time_delta:27; |
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c index 53ba3a6d16d0..fa64e1f003eb 100644 --- a/kernel/trace/ring_buffer.c +++ b/kernel/trace/ring_buffer.c | |||
@@ -91,7 +91,7 @@ EXPORT_SYMBOL_GPL(tracing_off); | |||
91 | * tracing_off_permanent - permanently disable ring buffers | 91 | * tracing_off_permanent - permanently disable ring buffers |
92 | * | 92 | * |
93 | * This function, once called, will disable all ring buffers | 93 | * This function, once called, will disable all ring buffers |
94 | * permanenty. | 94 | * permanently. |
95 | */ | 95 | */ |
96 | void tracing_off_permanent(void) | 96 | void tracing_off_permanent(void) |
97 | { | 97 | { |
@@ -210,7 +210,7 @@ EXPORT_SYMBOL_GPL(ring_buffer_event_data); | |||
210 | 210 | ||
211 | struct buffer_data_page { | 211 | struct buffer_data_page { |
212 | u64 time_stamp; /* page time stamp */ | 212 | u64 time_stamp; /* page time stamp */ |
213 | local_t commit; /* write commited index */ | 213 | local_t commit; /* write committed index */ |
214 | unsigned char data[]; /* data of buffer page */ | 214 | unsigned char data[]; /* data of buffer page */ |
215 | }; | 215 | }; |
216 | 216 | ||
@@ -260,7 +260,7 @@ struct ring_buffer_per_cpu { | |||
260 | struct list_head pages; | 260 | struct list_head pages; |
261 | struct buffer_page *head_page; /* read from head */ | 261 | struct buffer_page *head_page; /* read from head */ |
262 | struct buffer_page *tail_page; /* write to tail */ | 262 | struct buffer_page *tail_page; /* write to tail */ |
263 | struct buffer_page *commit_page; /* commited pages */ | 263 | struct buffer_page *commit_page; /* committed pages */ |
264 | struct buffer_page *reader_page; | 264 | struct buffer_page *reader_page; |
265 | unsigned long overrun; | 265 | unsigned long overrun; |
266 | unsigned long entries; | 266 | unsigned long entries; |
@@ -303,7 +303,7 @@ struct ring_buffer_iter { | |||
303 | * check_pages - integrity check of buffer pages | 303 | * check_pages - integrity check of buffer pages |
304 | * @cpu_buffer: CPU buffer with pages to test | 304 | * @cpu_buffer: CPU buffer with pages to test |
305 | * | 305 | * |
306 | * As a safty measure we check to make sure the data pages have not | 306 | * As a safety measure we check to make sure the data pages have not |
307 | * been corrupted. | 307 | * been corrupted. |
308 | */ | 308 | */ |
309 | static int rb_check_pages(struct ring_buffer_per_cpu *cpu_buffer) | 309 | static int rb_check_pages(struct ring_buffer_per_cpu *cpu_buffer) |
@@ -2332,13 +2332,14 @@ int ring_buffer_swap_cpu(struct ring_buffer *buffer_a, | |||
2332 | EXPORT_SYMBOL_GPL(ring_buffer_swap_cpu); | 2332 | EXPORT_SYMBOL_GPL(ring_buffer_swap_cpu); |
2333 | 2333 | ||
2334 | static void rb_remove_entries(struct ring_buffer_per_cpu *cpu_buffer, | 2334 | static void rb_remove_entries(struct ring_buffer_per_cpu *cpu_buffer, |
2335 | struct buffer_data_page *bpage) | 2335 | struct buffer_data_page *bpage, |
2336 | unsigned int offset) | ||
2336 | { | 2337 | { |
2337 | struct ring_buffer_event *event; | 2338 | struct ring_buffer_event *event; |
2338 | unsigned long head; | 2339 | unsigned long head; |
2339 | 2340 | ||
2340 | __raw_spin_lock(&cpu_buffer->lock); | 2341 | __raw_spin_lock(&cpu_buffer->lock); |
2341 | for (head = 0; head < local_read(&bpage->commit); | 2342 | for (head = offset; head < local_read(&bpage->commit); |
2342 | head += rb_event_length(event)) { | 2343 | head += rb_event_length(event)) { |
2343 | 2344 | ||
2344 | event = __rb_data_page_index(bpage, head); | 2345 | event = __rb_data_page_index(bpage, head); |
@@ -2406,12 +2407,12 @@ void ring_buffer_free_read_page(struct ring_buffer *buffer, void *data) | |||
2406 | * to swap with a page in the ring buffer. | 2407 | * to swap with a page in the ring buffer. |
2407 | * | 2408 | * |
2408 | * for example: | 2409 | * for example: |
2409 | * rpage = ring_buffer_alloc_page(buffer); | 2410 | * rpage = ring_buffer_alloc_read_page(buffer); |
2410 | * if (!rpage) | 2411 | * if (!rpage) |
2411 | * return error; | 2412 | * return error; |
2412 | * ret = ring_buffer_read_page(buffer, &rpage, cpu, 0); | 2413 | * ret = ring_buffer_read_page(buffer, &rpage, cpu, 0); |
2413 | * if (ret) | 2414 | * if (ret >= 0) |
2414 | * process_page(rpage); | 2415 | * process_page(rpage, ret); |
2415 | * | 2416 | * |
2416 | * When @full is set, the function will not return true unless | 2417 | * When @full is set, the function will not return true unless |
2417 | * the writer is off the reader page. | 2418 | * the writer is off the reader page. |
@@ -2422,8 +2423,8 @@ void ring_buffer_free_read_page(struct ring_buffer *buffer, void *data) | |||
2422 | * responsible for that. | 2423 | * responsible for that. |
2423 | * | 2424 | * |
2424 | * Returns: | 2425 | * Returns: |
2425 | * 1 if data has been transferred | 2426 | * >=0 if data has been transferred, returns the offset of consumed data. |
2426 | * 0 if no data has been transferred. | 2427 | * <0 if no data has been transferred. |
2427 | */ | 2428 | */ |
2428 | int ring_buffer_read_page(struct ring_buffer *buffer, | 2429 | int ring_buffer_read_page(struct ring_buffer *buffer, |
2429 | void **data_page, int cpu, int full) | 2430 | void **data_page, int cpu, int full) |
@@ -2432,7 +2433,8 @@ int ring_buffer_read_page(struct ring_buffer *buffer, | |||
2432 | struct ring_buffer_event *event; | 2433 | struct ring_buffer_event *event; |
2433 | struct buffer_data_page *bpage; | 2434 | struct buffer_data_page *bpage; |
2434 | unsigned long flags; | 2435 | unsigned long flags; |
2435 | int ret = 0; | 2436 | unsigned int read; |
2437 | int ret = -1; | ||
2436 | 2438 | ||
2437 | if (!data_page) | 2439 | if (!data_page) |
2438 | return 0; | 2440 | return 0; |
@@ -2454,25 +2456,29 @@ int ring_buffer_read_page(struct ring_buffer *buffer, | |||
2454 | /* check for data */ | 2456 | /* check for data */ |
2455 | if (!local_read(&cpu_buffer->reader_page->page->commit)) | 2457 | if (!local_read(&cpu_buffer->reader_page->page->commit)) |
2456 | goto out; | 2458 | goto out; |
2459 | |||
2460 | read = cpu_buffer->reader_page->read; | ||
2457 | /* | 2461 | /* |
2458 | * If the writer is already off of the read page, then simply | 2462 | * If the writer is already off of the read page, then simply |
2459 | * switch the read page with the given page. Otherwise | 2463 | * switch the read page with the given page. Otherwise |
2460 | * we need to copy the data from the reader to the writer. | 2464 | * we need to copy the data from the reader to the writer. |
2461 | */ | 2465 | */ |
2462 | if (cpu_buffer->reader_page == cpu_buffer->commit_page) { | 2466 | if (cpu_buffer->reader_page == cpu_buffer->commit_page) { |
2463 | unsigned int read = cpu_buffer->reader_page->read; | 2467 | unsigned int commit = rb_page_commit(cpu_buffer->reader_page); |
2468 | struct buffer_data_page *rpage = cpu_buffer->reader_page->page; | ||
2464 | 2469 | ||
2465 | if (full) | 2470 | if (full) |
2466 | goto out; | 2471 | goto out; |
2467 | /* The writer is still on the reader page, we must copy */ | 2472 | /* The writer is still on the reader page, we must copy */ |
2468 | bpage = cpu_buffer->reader_page->page; | 2473 | memcpy(bpage->data + read, rpage->data + read, commit - read); |
2469 | memcpy(bpage->data, | ||
2470 | cpu_buffer->reader_page->page->data + read, | ||
2471 | local_read(&bpage->commit) - read); | ||
2472 | 2474 | ||
2473 | /* consume what was read */ | 2475 | /* consume what was read */ |
2474 | cpu_buffer->reader_page += read; | 2476 | cpu_buffer->reader_page->read = commit; |
2475 | 2477 | ||
2478 | /* update bpage */ | ||
2479 | local_set(&bpage->commit, commit); | ||
2480 | if (!read) | ||
2481 | bpage->time_stamp = rpage->time_stamp; | ||
2476 | } else { | 2482 | } else { |
2477 | /* swap the pages */ | 2483 | /* swap the pages */ |
2478 | rb_init_page(bpage); | 2484 | rb_init_page(bpage); |
@@ -2481,10 +2487,10 @@ int ring_buffer_read_page(struct ring_buffer *buffer, | |||
2481 | cpu_buffer->reader_page->read = 0; | 2487 | cpu_buffer->reader_page->read = 0; |
2482 | *data_page = bpage; | 2488 | *data_page = bpage; |
2483 | } | 2489 | } |
2484 | ret = 1; | 2490 | ret = read; |
2485 | 2491 | ||
2486 | /* update the entry counter */ | 2492 | /* update the entry counter */ |
2487 | rb_remove_entries(cpu_buffer, bpage); | 2493 | rb_remove_entries(cpu_buffer, bpage, read); |
2488 | out: | 2494 | out: |
2489 | spin_unlock_irqrestore(&cpu_buffer->reader_lock, flags); | 2495 | spin_unlock_irqrestore(&cpu_buffer->reader_lock, flags); |
2490 | 2496 | ||
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index d89821283b47..d7c175a442df 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
@@ -1963,7 +1963,7 @@ tracing_trace_options_read(struct file *filp, char __user *ubuf, | |||
1963 | struct tracer_opt *trace_opts = current_trace->flags->opts; | 1963 | struct tracer_opt *trace_opts = current_trace->flags->opts; |
1964 | 1964 | ||
1965 | 1965 | ||
1966 | /* calulate max size */ | 1966 | /* calculate max size */ |
1967 | for (i = 0; trace_options[i]; i++) { | 1967 | for (i = 0; trace_options[i]; i++) { |
1968 | len += strlen(trace_options[i]); | 1968 | len += strlen(trace_options[i]); |
1969 | len += 3; /* "no" and space */ | 1969 | len += 3; /* "no" and space */ |
diff --git a/kernel/trace/trace_branch.c b/kernel/trace/trace_branch.c index f8ae2c50e01d..c2e68d440c4d 100644 --- a/kernel/trace/trace_branch.c +++ b/kernel/trace/trace_branch.c | |||
@@ -91,8 +91,6 @@ void trace_likely_condition(struct ftrace_branch_data *f, int val, int expect) | |||
91 | 91 | ||
92 | int enable_branch_tracing(struct trace_array *tr) | 92 | int enable_branch_tracing(struct trace_array *tr) |
93 | { | 93 | { |
94 | int ret = 0; | ||
95 | |||
96 | mutex_lock(&branch_tracing_mutex); | 94 | mutex_lock(&branch_tracing_mutex); |
97 | branch_tracer = tr; | 95 | branch_tracer = tr; |
98 | /* | 96 | /* |
@@ -103,7 +101,7 @@ int enable_branch_tracing(struct trace_array *tr) | |||
103 | branch_tracing_enabled++; | 101 | branch_tracing_enabled++; |
104 | mutex_unlock(&branch_tracing_mutex); | 102 | mutex_unlock(&branch_tracing_mutex); |
105 | 103 | ||
106 | return ret; | 104 | return 0; |
107 | } | 105 | } |
108 | 106 | ||
109 | void disable_branch_tracing(void) | 107 | void disable_branch_tracing(void) |
diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c index 782ec0fdf453..519a0cab1530 100644 --- a/kernel/trace/trace_functions_graph.c +++ b/kernel/trace/trace_functions_graph.c | |||
@@ -186,30 +186,30 @@ verif_pid(struct trace_seq *s, pid_t pid, int cpu, pid_t *last_pids_cpu) | |||
186 | ret = trace_seq_printf(s, | 186 | ret = trace_seq_printf(s, |
187 | " ------------------------------------------\n"); | 187 | " ------------------------------------------\n"); |
188 | if (!ret) | 188 | if (!ret) |
189 | TRACE_TYPE_PARTIAL_LINE; | 189 | return TRACE_TYPE_PARTIAL_LINE; |
190 | 190 | ||
191 | ret = print_graph_cpu(s, cpu); | 191 | ret = print_graph_cpu(s, cpu); |
192 | if (ret == TRACE_TYPE_PARTIAL_LINE) | 192 | if (ret == TRACE_TYPE_PARTIAL_LINE) |
193 | TRACE_TYPE_PARTIAL_LINE; | 193 | return TRACE_TYPE_PARTIAL_LINE; |
194 | 194 | ||
195 | ret = print_graph_proc(s, prev_pid); | 195 | ret = print_graph_proc(s, prev_pid); |
196 | if (ret == TRACE_TYPE_PARTIAL_LINE) | 196 | if (ret == TRACE_TYPE_PARTIAL_LINE) |
197 | TRACE_TYPE_PARTIAL_LINE; | 197 | return TRACE_TYPE_PARTIAL_LINE; |
198 | 198 | ||
199 | ret = trace_seq_printf(s, " => "); | 199 | ret = trace_seq_printf(s, " => "); |
200 | if (!ret) | 200 | if (!ret) |
201 | TRACE_TYPE_PARTIAL_LINE; | 201 | return TRACE_TYPE_PARTIAL_LINE; |
202 | 202 | ||
203 | ret = print_graph_proc(s, pid); | 203 | ret = print_graph_proc(s, pid); |
204 | if (ret == TRACE_TYPE_PARTIAL_LINE) | 204 | if (ret == TRACE_TYPE_PARTIAL_LINE) |
205 | TRACE_TYPE_PARTIAL_LINE; | 205 | return TRACE_TYPE_PARTIAL_LINE; |
206 | 206 | ||
207 | ret = trace_seq_printf(s, | 207 | ret = trace_seq_printf(s, |
208 | "\n ------------------------------------------\n\n"); | 208 | "\n ------------------------------------------\n\n"); |
209 | if (!ret) | 209 | if (!ret) |
210 | TRACE_TYPE_PARTIAL_LINE; | 210 | return TRACE_TYPE_PARTIAL_LINE; |
211 | 211 | ||
212 | return ret; | 212 | return TRACE_TYPE_HANDLED; |
213 | } | 213 | } |
214 | 214 | ||
215 | static struct ftrace_graph_ret_entry * | 215 | static struct ftrace_graph_ret_entry * |
diff --git a/kernel/trace/trace_hw_branches.c b/kernel/trace/trace_hw_branches.c index e3e7db61c067..0794dd33f27b 100644 --- a/kernel/trace/trace_hw_branches.c +++ b/kernel/trace/trace_hw_branches.c | |||
@@ -75,7 +75,7 @@ static void bts_trace_start(struct trace_array *tr) | |||
75 | } | 75 | } |
76 | 76 | ||
77 | /* | 77 | /* |
78 | * Start tracing on the current cpu. | 78 | * Stop tracing on the current cpu. |
79 | * The argument is ignored. | 79 | * The argument is ignored. |
80 | * | 80 | * |
81 | * pre: bts_tracer_mutex must be locked. | 81 | * pre: bts_tracer_mutex must be locked. |
diff --git a/kernel/trace/trace_sysprof.c b/kernel/trace/trace_sysprof.c index 84ca9d81e74d..4e2de4de1d65 100644 --- a/kernel/trace/trace_sysprof.c +++ b/kernel/trace/trace_sysprof.c | |||
@@ -88,7 +88,7 @@ static void backtrace_address(void *data, unsigned long addr, int reliable) | |||
88 | } | 88 | } |
89 | } | 89 | } |
90 | 90 | ||
91 | const static struct stacktrace_ops backtrace_ops = { | 91 | static const struct stacktrace_ops backtrace_ops = { |
92 | .warning = backtrace_warning, | 92 | .warning = backtrace_warning, |
93 | .warning_symbol = backtrace_warning_symbol, | 93 | .warning_symbol = backtrace_warning_symbol, |
94 | .stack = backtrace_stack, | 94 | .stack = backtrace_stack, |