diff options
-rw-r--r-- | Documentation/trace/ftrace.txt | 5 | ||||
-rw-r--r-- | arch/x86/kernel/ftrace.c | 15 | ||||
-rw-r--r-- | arch/x86/kvm/trace.h | 8 | ||||
-rw-r--r-- | include/linux/ftrace_event.h | 1 | ||||
-rw-r--r-- | include/linux/ring_buffer.h | 2 | ||||
-rw-r--r-- | include/trace/events/mce.h | 8 | ||||
-rw-r--r-- | include/trace/events/module.h | 5 | ||||
-rw-r--r-- | include/trace/events/skb.h | 4 | ||||
-rw-r--r-- | kernel/trace/ring_buffer.c | 24 | ||||
-rw-r--r-- | kernel/trace/trace.c | 34 | ||||
-rw-r--r-- | kernel/trace/trace.h | 3 | ||||
-rw-r--r-- | kernel/trace/trace_entries.h | 6 | ||||
-rw-r--r-- | kernel/trace/trace_events.c | 2 | ||||
-rw-r--r-- | kernel/trace/trace_output.c | 36 | ||||
-rw-r--r-- | scripts/recordmcount.c | 3 | ||||
-rwxr-xr-x | scripts/recordmcount.pl | 1 |
16 files changed, 100 insertions, 57 deletions
diff --git a/Documentation/trace/ftrace.txt b/Documentation/trace/ftrace.txt index 67f1cc47325..1ebc24cf9a5 100644 --- a/Documentation/trace/ftrace.txt +++ b/Documentation/trace/ftrace.txt | |||
@@ -454,6 +454,11 @@ x494] <- /root/a.out[+0x4a8] <- /lib/libc-2.7.so[+0x1e1a6] | |||
454 | latencies, as described in "Latency | 454 | latencies, as described in "Latency |
455 | trace format". | 455 | trace format". |
456 | 456 | ||
457 | overwrite - This controls what happens when the trace buffer is | ||
458 | full. If "1" (default), the oldest events are | ||
459 | discarded and overwritten. If "0", then the newest | ||
460 | events are discarded. | ||
461 | |||
457 | ftrace_enabled | 462 | ftrace_enabled |
458 | -------------- | 463 | -------------- |
459 | 464 | ||
diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c index 382eb2936d4..a93742a5746 100644 --- a/arch/x86/kernel/ftrace.c +++ b/arch/x86/kernel/ftrace.c | |||
@@ -437,18 +437,19 @@ void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr, | |||
437 | return; | 437 | return; |
438 | } | 438 | } |
439 | 439 | ||
440 | if (ftrace_push_return_trace(old, self_addr, &trace.depth, | ||
441 | frame_pointer) == -EBUSY) { | ||
442 | *parent = old; | ||
443 | return; | ||
444 | } | ||
445 | |||
446 | trace.func = self_addr; | 440 | trace.func = self_addr; |
441 | trace.depth = current->curr_ret_stack + 1; | ||
447 | 442 | ||
448 | /* Only trace if the calling function expects to */ | 443 | /* Only trace if the calling function expects to */ |
449 | if (!ftrace_graph_entry(&trace)) { | 444 | if (!ftrace_graph_entry(&trace)) { |
450 | current->curr_ret_stack--; | ||
451 | *parent = old; | 445 | *parent = old; |
446 | return; | ||
447 | } | ||
448 | |||
449 | if (ftrace_push_return_trace(old, self_addr, &trace.depth, | ||
450 | frame_pointer) == -EBUSY) { | ||
451 | *parent = old; | ||
452 | return; | ||
452 | } | 453 | } |
453 | } | 454 | } |
454 | #endif /* CONFIG_FUNCTION_GRAPH_TRACER */ | 455 | #endif /* CONFIG_FUNCTION_GRAPH_TRACER */ |
diff --git a/arch/x86/kvm/trace.h b/arch/x86/kvm/trace.h index 1357d7cf4ec..db932760ea8 100644 --- a/arch/x86/kvm/trace.h +++ b/arch/x86/kvm/trace.h | |||
@@ -62,21 +62,21 @@ TRACE_EVENT(kvm_hv_hypercall, | |||
62 | TP_ARGS(code, fast, rep_cnt, rep_idx, ingpa, outgpa), | 62 | TP_ARGS(code, fast, rep_cnt, rep_idx, ingpa, outgpa), |
63 | 63 | ||
64 | TP_STRUCT__entry( | 64 | TP_STRUCT__entry( |
65 | __field( __u16, code ) | ||
66 | __field( bool, fast ) | ||
67 | __field( __u16, rep_cnt ) | 65 | __field( __u16, rep_cnt ) |
68 | __field( __u16, rep_idx ) | 66 | __field( __u16, rep_idx ) |
69 | __field( __u64, ingpa ) | 67 | __field( __u64, ingpa ) |
70 | __field( __u64, outgpa ) | 68 | __field( __u64, outgpa ) |
69 | __field( __u16, code ) | ||
70 | __field( bool, fast ) | ||
71 | ), | 71 | ), |
72 | 72 | ||
73 | TP_fast_assign( | 73 | TP_fast_assign( |
74 | __entry->code = code; | ||
75 | __entry->fast = fast; | ||
76 | __entry->rep_cnt = rep_cnt; | 74 | __entry->rep_cnt = rep_cnt; |
77 | __entry->rep_idx = rep_idx; | 75 | __entry->rep_idx = rep_idx; |
78 | __entry->ingpa = ingpa; | 76 | __entry->ingpa = ingpa; |
79 | __entry->outgpa = outgpa; | 77 | __entry->outgpa = outgpa; |
78 | __entry->code = code; | ||
79 | __entry->fast = fast; | ||
80 | ), | 80 | ), |
81 | 81 | ||
82 | TP_printk("code 0x%x %s cnt 0x%x idx 0x%x in 0x%llx out 0x%llx", | 82 | TP_printk("code 0x%x %s cnt 0x%x idx 0x%x in 0x%llx out 0x%llx", |
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h index 1a99e7939c2..22b32af1b5e 100644 --- a/include/linux/ftrace_event.h +++ b/include/linux/ftrace_event.h | |||
@@ -37,7 +37,6 @@ struct trace_entry { | |||
37 | unsigned char flags; | 37 | unsigned char flags; |
38 | unsigned char preempt_count; | 38 | unsigned char preempt_count; |
39 | int pid; | 39 | int pid; |
40 | int lock_depth; | ||
41 | }; | 40 | }; |
42 | 41 | ||
43 | #define FTRACE_MAX_EVENT \ | 42 | #define FTRACE_MAX_EVENT \ |
diff --git a/include/linux/ring_buffer.h b/include/linux/ring_buffer.h index 8d3a2486544..ab38ac80b0f 100644 --- a/include/linux/ring_buffer.h +++ b/include/linux/ring_buffer.h | |||
@@ -100,6 +100,8 @@ void ring_buffer_free(struct ring_buffer *buffer); | |||
100 | 100 | ||
101 | int ring_buffer_resize(struct ring_buffer *buffer, unsigned long size); | 101 | int ring_buffer_resize(struct ring_buffer *buffer, unsigned long size); |
102 | 102 | ||
103 | void ring_buffer_change_overwrite(struct ring_buffer *buffer, int val); | ||
104 | |||
103 | struct ring_buffer_event *ring_buffer_lock_reserve(struct ring_buffer *buffer, | 105 | struct ring_buffer_event *ring_buffer_lock_reserve(struct ring_buffer *buffer, |
104 | unsigned long length); | 106 | unsigned long length); |
105 | int ring_buffer_unlock_commit(struct ring_buffer *buffer, | 107 | int ring_buffer_unlock_commit(struct ring_buffer *buffer, |
diff --git a/include/trace/events/mce.h b/include/trace/events/mce.h index 7eee77895cb..4cbbcef6baa 100644 --- a/include/trace/events/mce.h +++ b/include/trace/events/mce.h | |||
@@ -17,36 +17,36 @@ TRACE_EVENT(mce_record, | |||
17 | TP_STRUCT__entry( | 17 | TP_STRUCT__entry( |
18 | __field( u64, mcgcap ) | 18 | __field( u64, mcgcap ) |
19 | __field( u64, mcgstatus ) | 19 | __field( u64, mcgstatus ) |
20 | __field( u8, bank ) | ||
21 | __field( u64, status ) | 20 | __field( u64, status ) |
22 | __field( u64, addr ) | 21 | __field( u64, addr ) |
23 | __field( u64, misc ) | 22 | __field( u64, misc ) |
24 | __field( u64, ip ) | 23 | __field( u64, ip ) |
25 | __field( u8, cs ) | ||
26 | __field( u64, tsc ) | 24 | __field( u64, tsc ) |
27 | __field( u64, walltime ) | 25 | __field( u64, walltime ) |
28 | __field( u32, cpu ) | 26 | __field( u32, cpu ) |
29 | __field( u32, cpuid ) | 27 | __field( u32, cpuid ) |
30 | __field( u32, apicid ) | 28 | __field( u32, apicid ) |
31 | __field( u32, socketid ) | 29 | __field( u32, socketid ) |
30 | __field( u8, cs ) | ||
31 | __field( u8, bank ) | ||
32 | __field( u8, cpuvendor ) | 32 | __field( u8, cpuvendor ) |
33 | ), | 33 | ), |
34 | 34 | ||
35 | TP_fast_assign( | 35 | TP_fast_assign( |
36 | __entry->mcgcap = m->mcgcap; | 36 | __entry->mcgcap = m->mcgcap; |
37 | __entry->mcgstatus = m->mcgstatus; | 37 | __entry->mcgstatus = m->mcgstatus; |
38 | __entry->bank = m->bank; | ||
39 | __entry->status = m->status; | 38 | __entry->status = m->status; |
40 | __entry->addr = m->addr; | 39 | __entry->addr = m->addr; |
41 | __entry->misc = m->misc; | 40 | __entry->misc = m->misc; |
42 | __entry->ip = m->ip; | 41 | __entry->ip = m->ip; |
43 | __entry->cs = m->cs; | ||
44 | __entry->tsc = m->tsc; | 42 | __entry->tsc = m->tsc; |
45 | __entry->walltime = m->time; | 43 | __entry->walltime = m->time; |
46 | __entry->cpu = m->extcpu; | 44 | __entry->cpu = m->extcpu; |
47 | __entry->cpuid = m->cpuid; | 45 | __entry->cpuid = m->cpuid; |
48 | __entry->apicid = m->apicid; | 46 | __entry->apicid = m->apicid; |
49 | __entry->socketid = m->socketid; | 47 | __entry->socketid = m->socketid; |
48 | __entry->cs = m->cs; | ||
49 | __entry->bank = m->bank; | ||
50 | __entry->cpuvendor = m->cpuvendor; | 50 | __entry->cpuvendor = m->cpuvendor; |
51 | ), | 51 | ), |
52 | 52 | ||
diff --git a/include/trace/events/module.h b/include/trace/events/module.h index c6bae36547e..21a546d27c0 100644 --- a/include/trace/events/module.h +++ b/include/trace/events/module.h | |||
@@ -108,14 +108,14 @@ TRACE_EVENT(module_request, | |||
108 | TP_ARGS(name, wait, ip), | 108 | TP_ARGS(name, wait, ip), |
109 | 109 | ||
110 | TP_STRUCT__entry( | 110 | TP_STRUCT__entry( |
111 | __field( bool, wait ) | ||
112 | __field( unsigned long, ip ) | 111 | __field( unsigned long, ip ) |
112 | __field( bool, wait ) | ||
113 | __string( name, name ) | 113 | __string( name, name ) |
114 | ), | 114 | ), |
115 | 115 | ||
116 | TP_fast_assign( | 116 | TP_fast_assign( |
117 | __entry->wait = wait; | ||
118 | __entry->ip = ip; | 117 | __entry->ip = ip; |
118 | __entry->wait = wait; | ||
119 | __assign_str(name, name); | 119 | __assign_str(name, name); |
120 | ), | 120 | ), |
121 | 121 | ||
@@ -129,4 +129,3 @@ TRACE_EVENT(module_request, | |||
129 | 129 | ||
130 | /* This part must be outside protection */ | 130 | /* This part must be outside protection */ |
131 | #include <trace/define_trace.h> | 131 | #include <trace/define_trace.h> |
132 | |||
diff --git a/include/trace/events/skb.h b/include/trace/events/skb.h index f10293c41b1..0c68ae22da2 100644 --- a/include/trace/events/skb.h +++ b/include/trace/events/skb.h | |||
@@ -19,14 +19,14 @@ TRACE_EVENT(kfree_skb, | |||
19 | 19 | ||
20 | TP_STRUCT__entry( | 20 | TP_STRUCT__entry( |
21 | __field( void *, skbaddr ) | 21 | __field( void *, skbaddr ) |
22 | __field( unsigned short, protocol ) | ||
23 | __field( void *, location ) | 22 | __field( void *, location ) |
23 | __field( unsigned short, protocol ) | ||
24 | ), | 24 | ), |
25 | 25 | ||
26 | TP_fast_assign( | 26 | TP_fast_assign( |
27 | __entry->skbaddr = skb; | 27 | __entry->skbaddr = skb; |
28 | __entry->protocol = ntohs(skb->protocol); | ||
29 | __entry->location = location; | 28 | __entry->location = location; |
29 | __entry->protocol = ntohs(skb->protocol); | ||
30 | ), | 30 | ), |
31 | 31 | ||
32 | TP_printk("skbaddr=%p protocol=%u location=%p", | 32 | TP_printk("skbaddr=%p protocol=%u location=%p", |
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c index bd1c35a4fbc..db7b439d23e 100644 --- a/kernel/trace/ring_buffer.c +++ b/kernel/trace/ring_buffer.c | |||
@@ -5,7 +5,6 @@ | |||
5 | */ | 5 | */ |
6 | #include <linux/ring_buffer.h> | 6 | #include <linux/ring_buffer.h> |
7 | #include <linux/trace_clock.h> | 7 | #include <linux/trace_clock.h> |
8 | #include <linux/ftrace_irq.h> | ||
9 | #include <linux/spinlock.h> | 8 | #include <linux/spinlock.h> |
10 | #include <linux/debugfs.h> | 9 | #include <linux/debugfs.h> |
11 | #include <linux/uaccess.h> | 10 | #include <linux/uaccess.h> |
@@ -1429,6 +1428,17 @@ int ring_buffer_resize(struct ring_buffer *buffer, unsigned long size) | |||
1429 | } | 1428 | } |
1430 | EXPORT_SYMBOL_GPL(ring_buffer_resize); | 1429 | EXPORT_SYMBOL_GPL(ring_buffer_resize); |
1431 | 1430 | ||
1431 | void ring_buffer_change_overwrite(struct ring_buffer *buffer, int val) | ||
1432 | { | ||
1433 | mutex_lock(&buffer->mutex); | ||
1434 | if (val) | ||
1435 | buffer->flags |= RB_FL_OVERWRITE; | ||
1436 | else | ||
1437 | buffer->flags &= ~RB_FL_OVERWRITE; | ||
1438 | mutex_unlock(&buffer->mutex); | ||
1439 | } | ||
1440 | EXPORT_SYMBOL_GPL(ring_buffer_change_overwrite); | ||
1441 | |||
1432 | static inline void * | 1442 | static inline void * |
1433 | __rb_data_page_index(struct buffer_data_page *bpage, unsigned index) | 1443 | __rb_data_page_index(struct buffer_data_page *bpage, unsigned index) |
1434 | { | 1444 | { |
@@ -2162,11 +2172,19 @@ rb_reserve_next_event(struct ring_buffer *buffer, | |||
2162 | if (likely(ts >= cpu_buffer->write_stamp)) { | 2172 | if (likely(ts >= cpu_buffer->write_stamp)) { |
2163 | delta = diff; | 2173 | delta = diff; |
2164 | if (unlikely(test_time_stamp(delta))) { | 2174 | if (unlikely(test_time_stamp(delta))) { |
2175 | int local_clock_stable = 1; | ||
2176 | #ifdef CONFIG_HAVE_UNSTABLE_SCHED_CLOCK | ||
2177 | local_clock_stable = sched_clock_stable; | ||
2178 | #endif | ||
2165 | WARN_ONCE(delta > (1ULL << 59), | 2179 | WARN_ONCE(delta > (1ULL << 59), |
2166 | KERN_WARNING "Delta way too big! %llu ts=%llu write stamp = %llu\n", | 2180 | KERN_WARNING "Delta way too big! %llu ts=%llu write stamp = %llu\n%s", |
2167 | (unsigned long long)delta, | 2181 | (unsigned long long)delta, |
2168 | (unsigned long long)ts, | 2182 | (unsigned long long)ts, |
2169 | (unsigned long long)cpu_buffer->write_stamp); | 2183 | (unsigned long long)cpu_buffer->write_stamp, |
2184 | local_clock_stable ? "" : | ||
2185 | "If you just came from a suspend/resume,\n" | ||
2186 | "please switch to the trace global clock:\n" | ||
2187 | " echo global > /sys/kernel/debug/tracing/trace_clock\n"); | ||
2170 | add_timestamp = 1; | 2188 | add_timestamp = 1; |
2171 | } | 2189 | } |
2172 | } | 2190 | } |
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 8dc8da6733f..9541c27c1cf 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
@@ -41,8 +41,6 @@ | |||
41 | #include "trace.h" | 41 | #include "trace.h" |
42 | #include "trace_output.h" | 42 | #include "trace_output.h" |
43 | 43 | ||
44 | #define TRACE_BUFFER_FLAGS (RB_FL_OVERWRITE) | ||
45 | |||
46 | /* | 44 | /* |
47 | * On boot up, the ring buffer is set to the minimum size, so that | 45 | * On boot up, the ring buffer is set to the minimum size, so that |
48 | * we do not waste memory on systems that are not using tracing. | 46 | * we do not waste memory on systems that are not using tracing. |
@@ -340,7 +338,7 @@ static DECLARE_WAIT_QUEUE_HEAD(trace_wait); | |||
340 | /* trace_flags holds trace_options default values */ | 338 | /* trace_flags holds trace_options default values */ |
341 | unsigned long trace_flags = TRACE_ITER_PRINT_PARENT | TRACE_ITER_PRINTK | | 339 | unsigned long trace_flags = TRACE_ITER_PRINT_PARENT | TRACE_ITER_PRINTK | |
342 | TRACE_ITER_ANNOTATE | TRACE_ITER_CONTEXT_INFO | TRACE_ITER_SLEEP_TIME | | 340 | TRACE_ITER_ANNOTATE | TRACE_ITER_CONTEXT_INFO | TRACE_ITER_SLEEP_TIME | |
343 | TRACE_ITER_GRAPH_TIME | TRACE_ITER_RECORD_CMD; | 341 | TRACE_ITER_GRAPH_TIME | TRACE_ITER_RECORD_CMD | TRACE_ITER_OVERWRITE; |
344 | 342 | ||
345 | static int trace_stop_count; | 343 | static int trace_stop_count; |
346 | static DEFINE_SPINLOCK(tracing_start_lock); | 344 | static DEFINE_SPINLOCK(tracing_start_lock); |
@@ -425,6 +423,7 @@ static const char *trace_options[] = { | |||
425 | "sleep-time", | 423 | "sleep-time", |
426 | "graph-time", | 424 | "graph-time", |
427 | "record-cmd", | 425 | "record-cmd", |
426 | "overwrite", | ||
428 | NULL | 427 | NULL |
429 | }; | 428 | }; |
430 | 429 | ||
@@ -780,6 +779,11 @@ __acquires(kernel_lock) | |||
780 | tracing_reset_online_cpus(tr); | 779 | tracing_reset_online_cpus(tr); |
781 | 780 | ||
782 | current_trace = type; | 781 | current_trace = type; |
782 | |||
783 | /* If we expanded the buffers, make sure the max is expanded too */ | ||
784 | if (ring_buffer_expanded && type->use_max_tr) | ||
785 | ring_buffer_resize(max_tr.buffer, trace_buf_size); | ||
786 | |||
783 | /* the test is responsible for initializing and enabling */ | 787 | /* the test is responsible for initializing and enabling */ |
784 | pr_info("Testing tracer %s: ", type->name); | 788 | pr_info("Testing tracer %s: ", type->name); |
785 | ret = type->selftest(type, tr); | 789 | ret = type->selftest(type, tr); |
@@ -792,6 +796,10 @@ __acquires(kernel_lock) | |||
792 | /* Only reset on passing, to avoid touching corrupted buffers */ | 796 | /* Only reset on passing, to avoid touching corrupted buffers */ |
793 | tracing_reset_online_cpus(tr); | 797 | tracing_reset_online_cpus(tr); |
794 | 798 | ||
799 | /* Shrink the max buffer again */ | ||
800 | if (ring_buffer_expanded && type->use_max_tr) | ||
801 | ring_buffer_resize(max_tr.buffer, 1); | ||
802 | |||
795 | printk(KERN_CONT "PASSED\n"); | 803 | printk(KERN_CONT "PASSED\n"); |
796 | } | 804 | } |
797 | #endif | 805 | #endif |
@@ -1102,7 +1110,6 @@ tracing_generic_entry_update(struct trace_entry *entry, unsigned long flags, | |||
1102 | 1110 | ||
1103 | entry->preempt_count = pc & 0xff; | 1111 | entry->preempt_count = pc & 0xff; |
1104 | entry->pid = (tsk) ? tsk->pid : 0; | 1112 | entry->pid = (tsk) ? tsk->pid : 0; |
1105 | entry->lock_depth = (tsk) ? tsk->lock_depth : 0; | ||
1106 | entry->flags = | 1113 | entry->flags = |
1107 | #ifdef CONFIG_TRACE_IRQFLAGS_SUPPORT | 1114 | #ifdef CONFIG_TRACE_IRQFLAGS_SUPPORT |
1108 | (irqs_disabled_flags(flags) ? TRACE_FLAG_IRQS_OFF : 0) | | 1115 | (irqs_disabled_flags(flags) ? TRACE_FLAG_IRQS_OFF : 0) | |
@@ -1749,10 +1756,9 @@ static void print_lat_help_header(struct seq_file *m) | |||
1749 | seq_puts(m, "# | / _----=> need-resched \n"); | 1756 | seq_puts(m, "# | / _----=> need-resched \n"); |
1750 | seq_puts(m, "# || / _---=> hardirq/softirq \n"); | 1757 | seq_puts(m, "# || / _---=> hardirq/softirq \n"); |
1751 | seq_puts(m, "# ||| / _--=> preempt-depth \n"); | 1758 | seq_puts(m, "# ||| / _--=> preempt-depth \n"); |
1752 | seq_puts(m, "# |||| /_--=> lock-depth \n"); | 1759 | seq_puts(m, "# |||| / delay \n"); |
1753 | seq_puts(m, "# |||||/ delay \n"); | 1760 | seq_puts(m, "# cmd pid ||||| time | caller \n"); |
1754 | seq_puts(m, "# cmd pid |||||| time | caller \n"); | 1761 | seq_puts(m, "# \\ / ||||| \\ | / \n"); |
1755 | seq_puts(m, "# \\ / |||||| \\ | / \n"); | ||
1756 | } | 1762 | } |
1757 | 1763 | ||
1758 | static void print_func_help_header(struct seq_file *m) | 1764 | static void print_func_help_header(struct seq_file *m) |
@@ -2529,6 +2535,9 @@ static void set_tracer_flags(unsigned int mask, int enabled) | |||
2529 | 2535 | ||
2530 | if (mask == TRACE_ITER_RECORD_CMD) | 2536 | if (mask == TRACE_ITER_RECORD_CMD) |
2531 | trace_event_enable_cmd_record(enabled); | 2537 | trace_event_enable_cmd_record(enabled); |
2538 | |||
2539 | if (mask == TRACE_ITER_OVERWRITE) | ||
2540 | ring_buffer_change_overwrite(global_trace.buffer, enabled); | ||
2532 | } | 2541 | } |
2533 | 2542 | ||
2534 | static ssize_t | 2543 | static ssize_t |
@@ -4555,9 +4564,11 @@ void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) | |||
4555 | __init static int tracer_alloc_buffers(void) | 4564 | __init static int tracer_alloc_buffers(void) |
4556 | { | 4565 | { |
4557 | int ring_buf_size; | 4566 | int ring_buf_size; |
4567 | enum ring_buffer_flags rb_flags; | ||
4558 | int i; | 4568 | int i; |
4559 | int ret = -ENOMEM; | 4569 | int ret = -ENOMEM; |
4560 | 4570 | ||
4571 | |||
4561 | if (!alloc_cpumask_var(&tracing_buffer_mask, GFP_KERNEL)) | 4572 | if (!alloc_cpumask_var(&tracing_buffer_mask, GFP_KERNEL)) |
4562 | goto out; | 4573 | goto out; |
4563 | 4574 | ||
@@ -4570,12 +4581,13 @@ __init static int tracer_alloc_buffers(void) | |||
4570 | else | 4581 | else |
4571 | ring_buf_size = 1; | 4582 | ring_buf_size = 1; |
4572 | 4583 | ||
4584 | rb_flags = trace_flags & TRACE_ITER_OVERWRITE ? RB_FL_OVERWRITE : 0; | ||
4585 | |||
4573 | cpumask_copy(tracing_buffer_mask, cpu_possible_mask); | 4586 | cpumask_copy(tracing_buffer_mask, cpu_possible_mask); |
4574 | cpumask_copy(tracing_cpumask, cpu_all_mask); | 4587 | cpumask_copy(tracing_cpumask, cpu_all_mask); |
4575 | 4588 | ||
4576 | /* TODO: make the number of buffers hot pluggable with CPUS */ | 4589 | /* TODO: make the number of buffers hot pluggable with CPUS */ |
4577 | global_trace.buffer = ring_buffer_alloc(ring_buf_size, | 4590 | global_trace.buffer = ring_buffer_alloc(ring_buf_size, rb_flags); |
4578 | TRACE_BUFFER_FLAGS); | ||
4579 | if (!global_trace.buffer) { | 4591 | if (!global_trace.buffer) { |
4580 | printk(KERN_ERR "tracer: failed to allocate ring buffer!\n"); | 4592 | printk(KERN_ERR "tracer: failed to allocate ring buffer!\n"); |
4581 | WARN_ON(1); | 4593 | WARN_ON(1); |
@@ -4585,7 +4597,7 @@ __init static int tracer_alloc_buffers(void) | |||
4585 | 4597 | ||
4586 | 4598 | ||
4587 | #ifdef CONFIG_TRACER_MAX_TRACE | 4599 | #ifdef CONFIG_TRACER_MAX_TRACE |
4588 | max_tr.buffer = ring_buffer_alloc(1, TRACE_BUFFER_FLAGS); | 4600 | max_tr.buffer = ring_buffer_alloc(1, rb_flags); |
4589 | if (!max_tr.buffer) { | 4601 | if (!max_tr.buffer) { |
4590 | printk(KERN_ERR "tracer: failed to allocate max ring buffer!\n"); | 4602 | printk(KERN_ERR "tracer: failed to allocate max ring buffer!\n"); |
4591 | WARN_ON(1); | 4603 | WARN_ON(1); |
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h index 856e73cc1d3..5e9dfc6286d 100644 --- a/kernel/trace/trace.h +++ b/kernel/trace/trace.h | |||
@@ -272,8 +272,8 @@ struct tracer { | |||
272 | /* If you handled the flag setting, return 0 */ | 272 | /* If you handled the flag setting, return 0 */ |
273 | int (*set_flag)(u32 old_flags, u32 bit, int set); | 273 | int (*set_flag)(u32 old_flags, u32 bit, int set); |
274 | struct tracer *next; | 274 | struct tracer *next; |
275 | int print_max; | ||
276 | struct tracer_flags *flags; | 275 | struct tracer_flags *flags; |
276 | int print_max; | ||
277 | int use_max_tr; | 277 | int use_max_tr; |
278 | }; | 278 | }; |
279 | 279 | ||
@@ -606,6 +606,7 @@ enum trace_iterator_flags { | |||
606 | TRACE_ITER_SLEEP_TIME = 0x40000, | 606 | TRACE_ITER_SLEEP_TIME = 0x40000, |
607 | TRACE_ITER_GRAPH_TIME = 0x80000, | 607 | TRACE_ITER_GRAPH_TIME = 0x80000, |
608 | TRACE_ITER_RECORD_CMD = 0x100000, | 608 | TRACE_ITER_RECORD_CMD = 0x100000, |
609 | TRACE_ITER_OVERWRITE = 0x200000, | ||
609 | }; | 610 | }; |
610 | 611 | ||
611 | /* | 612 | /* |
diff --git a/kernel/trace/trace_entries.h b/kernel/trace/trace_entries.h index 6cf223764be..1516cb3ec54 100644 --- a/kernel/trace/trace_entries.h +++ b/kernel/trace/trace_entries.h | |||
@@ -109,12 +109,12 @@ FTRACE_ENTRY(funcgraph_exit, ftrace_graph_ret_entry, | |||
109 | */ | 109 | */ |
110 | #define FTRACE_CTX_FIELDS \ | 110 | #define FTRACE_CTX_FIELDS \ |
111 | __field( unsigned int, prev_pid ) \ | 111 | __field( unsigned int, prev_pid ) \ |
112 | __field( unsigned int, next_pid ) \ | ||
113 | __field( unsigned int, next_cpu ) \ | ||
112 | __field( unsigned char, prev_prio ) \ | 114 | __field( unsigned char, prev_prio ) \ |
113 | __field( unsigned char, prev_state ) \ | 115 | __field( unsigned char, prev_state ) \ |
114 | __field( unsigned int, next_pid ) \ | ||
115 | __field( unsigned char, next_prio ) \ | 116 | __field( unsigned char, next_prio ) \ |
116 | __field( unsigned char, next_state ) \ | 117 | __field( unsigned char, next_state ) |
117 | __field( unsigned int, next_cpu ) | ||
118 | 118 | ||
119 | FTRACE_ENTRY(context_switch, ctx_switch_entry, | 119 | FTRACE_ENTRY(context_switch, ctx_switch_entry, |
120 | 120 | ||
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c index 5f499e0438a..e88f74fe1d4 100644 --- a/kernel/trace/trace_events.c +++ b/kernel/trace/trace_events.c | |||
@@ -116,7 +116,6 @@ static int trace_define_common_fields(void) | |||
116 | __common_field(unsigned char, flags); | 116 | __common_field(unsigned char, flags); |
117 | __common_field(unsigned char, preempt_count); | 117 | __common_field(unsigned char, preempt_count); |
118 | __common_field(int, pid); | 118 | __common_field(int, pid); |
119 | __common_field(int, lock_depth); | ||
120 | 119 | ||
121 | return ret; | 120 | return ret; |
122 | } | 121 | } |
@@ -326,6 +325,7 @@ int trace_set_clr_event(const char *system, const char *event, int set) | |||
326 | { | 325 | { |
327 | return __ftrace_set_clr_event(NULL, system, event, set); | 326 | return __ftrace_set_clr_event(NULL, system, event, set); |
328 | } | 327 | } |
328 | EXPORT_SYMBOL_GPL(trace_set_clr_event); | ||
329 | 329 | ||
330 | /* 128 should be much more than enough */ | 330 | /* 128 should be much more than enough */ |
331 | #define EVENT_BUF_SIZE 127 | 331 | #define EVENT_BUF_SIZE 127 |
diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c index 02272baa220..456be9063c2 100644 --- a/kernel/trace/trace_output.c +++ b/kernel/trace/trace_output.c | |||
@@ -529,24 +529,34 @@ seq_print_ip_sym(struct trace_seq *s, unsigned long ip, unsigned long sym_flags) | |||
529 | * @entry: The trace entry field from the ring buffer | 529 | * @entry: The trace entry field from the ring buffer |
530 | * | 530 | * |
531 | * Prints the generic fields of irqs off, in hard or softirq, preempt | 531 | * Prints the generic fields of irqs off, in hard or softirq, preempt |
532 | * count and lock depth. | 532 | * count. |
533 | */ | 533 | */ |
534 | int trace_print_lat_fmt(struct trace_seq *s, struct trace_entry *entry) | 534 | int trace_print_lat_fmt(struct trace_seq *s, struct trace_entry *entry) |
535 | { | 535 | { |
536 | int hardirq, softirq; | 536 | char hardsoft_irq; |
537 | char need_resched; | ||
538 | char irqs_off; | ||
539 | int hardirq; | ||
540 | int softirq; | ||
537 | int ret; | 541 | int ret; |
538 | 542 | ||
539 | hardirq = entry->flags & TRACE_FLAG_HARDIRQ; | 543 | hardirq = entry->flags & TRACE_FLAG_HARDIRQ; |
540 | softirq = entry->flags & TRACE_FLAG_SOFTIRQ; | 544 | softirq = entry->flags & TRACE_FLAG_SOFTIRQ; |
541 | 545 | ||
546 | irqs_off = | ||
547 | (entry->flags & TRACE_FLAG_IRQS_OFF) ? 'd' : | ||
548 | (entry->flags & TRACE_FLAG_IRQS_NOSUPPORT) ? 'X' : | ||
549 | '.'; | ||
550 | need_resched = | ||
551 | (entry->flags & TRACE_FLAG_NEED_RESCHED) ? 'N' : '.'; | ||
552 | hardsoft_irq = | ||
553 | (hardirq && softirq) ? 'H' : | ||
554 | hardirq ? 'h' : | ||
555 | softirq ? 's' : | ||
556 | '.'; | ||
557 | |||
542 | if (!trace_seq_printf(s, "%c%c%c", | 558 | if (!trace_seq_printf(s, "%c%c%c", |
543 | (entry->flags & TRACE_FLAG_IRQS_OFF) ? 'd' : | 559 | irqs_off, need_resched, hardsoft_irq)) |
544 | (entry->flags & TRACE_FLAG_IRQS_NOSUPPORT) ? | ||
545 | 'X' : '.', | ||
546 | (entry->flags & TRACE_FLAG_NEED_RESCHED) ? | ||
547 | 'N' : '.', | ||
548 | (hardirq && softirq) ? 'H' : | ||
549 | hardirq ? 'h' : softirq ? 's' : '.')) | ||
550 | return 0; | 560 | return 0; |
551 | 561 | ||
552 | if (entry->preempt_count) | 562 | if (entry->preempt_count) |
@@ -554,13 +564,7 @@ int trace_print_lat_fmt(struct trace_seq *s, struct trace_entry *entry) | |||
554 | else | 564 | else |
555 | ret = trace_seq_putc(s, '.'); | 565 | ret = trace_seq_putc(s, '.'); |
556 | 566 | ||
557 | if (!ret) | 567 | return ret; |
558 | return 0; | ||
559 | |||
560 | if (entry->lock_depth < 0) | ||
561 | return trace_seq_putc(s, '.'); | ||
562 | |||
563 | return trace_seq_printf(s, "%d", entry->lock_depth); | ||
564 | } | 568 | } |
565 | 569 | ||
566 | static int | 570 | static int |
diff --git a/scripts/recordmcount.c b/scripts/recordmcount.c index 038b3d1e298..f9f6f52db77 100644 --- a/scripts/recordmcount.c +++ b/scripts/recordmcount.c | |||
@@ -206,7 +206,8 @@ static uint32_t (*w2)(uint16_t); | |||
206 | static int | 206 | static int |
207 | is_mcounted_section_name(char const *const txtname) | 207 | is_mcounted_section_name(char const *const txtname) |
208 | { | 208 | { |
209 | return 0 == strcmp(".text", txtname) || | 209 | return 0 == strcmp(".text", txtname) || |
210 | 0 == strcmp(".ref.text", txtname) || | ||
210 | 0 == strcmp(".sched.text", txtname) || | 211 | 0 == strcmp(".sched.text", txtname) || |
211 | 0 == strcmp(".spinlock.text", txtname) || | 212 | 0 == strcmp(".spinlock.text", txtname) || |
212 | 0 == strcmp(".irqentry.text", txtname) || | 213 | 0 == strcmp(".irqentry.text", txtname) || |
diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl index 1d7963f4ee7..4be0deea71c 100755 --- a/scripts/recordmcount.pl +++ b/scripts/recordmcount.pl | |||
@@ -130,6 +130,7 @@ if ($inputfile =~ m,kernel/trace/ftrace\.o$,) { | |||
130 | # Acceptable sections to record. | 130 | # Acceptable sections to record. |
131 | my %text_sections = ( | 131 | my %text_sections = ( |
132 | ".text" => 1, | 132 | ".text" => 1, |
133 | ".ref.text" => 1, | ||
133 | ".sched.text" => 1, | 134 | ".sched.text" => 1, |
134 | ".spinlock.text" => 1, | 135 | ".spinlock.text" => 1, |
135 | ".irqentry.text" => 1, | 136 | ".irqentry.text" => 1, |