diff options
-rw-r--r-- | kernel/trace/trace.c | 16 | ||||
-rw-r--r-- | kernel/trace/trace.h | 1 |
2 files changed, 16 insertions, 1 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 240423a9d1af..4a904623e05d 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
@@ -205,7 +205,8 @@ static DEFINE_MUTEX(trace_types_lock); | |||
205 | static DECLARE_WAIT_QUEUE_HEAD(trace_wait); | 205 | static DECLARE_WAIT_QUEUE_HEAD(trace_wait); |
206 | 206 | ||
207 | /* trace_flags holds trace_options default values */ | 207 | /* trace_flags holds trace_options default values */ |
208 | unsigned long trace_flags = TRACE_ITER_PRINT_PARENT | TRACE_ITER_PRINTK; | 208 | unsigned long trace_flags = TRACE_ITER_PRINT_PARENT | TRACE_ITER_PRINTK | |
209 | TRACE_ITER_ANNOTATE; | ||
209 | 210 | ||
210 | /** | 211 | /** |
211 | * trace_wake_up - wake up tasks waiting for trace input | 212 | * trace_wake_up - wake up tasks waiting for trace input |
@@ -261,6 +262,7 @@ static const char *trace_options[] = { | |||
261 | #ifdef CONFIG_BRANCH_TRACER | 262 | #ifdef CONFIG_BRANCH_TRACER |
262 | "branch", | 263 | "branch", |
263 | #endif | 264 | #endif |
265 | "annotate", | ||
264 | NULL | 266 | NULL |
265 | }; | 267 | }; |
266 | 268 | ||
@@ -1113,6 +1115,7 @@ void tracing_stop_function_trace(void) | |||
1113 | 1115 | ||
1114 | enum trace_file_type { | 1116 | enum trace_file_type { |
1115 | TRACE_FILE_LAT_FMT = 1, | 1117 | TRACE_FILE_LAT_FMT = 1, |
1118 | TRACE_FILE_ANNOTATE = 2, | ||
1116 | }; | 1119 | }; |
1117 | 1120 | ||
1118 | static void trace_iterator_increment(struct trace_iterator *iter, int cpu) | 1121 | static void trace_iterator_increment(struct trace_iterator *iter, int cpu) |
@@ -1532,6 +1535,12 @@ static void test_cpu_buff_start(struct trace_iterator *iter) | |||
1532 | { | 1535 | { |
1533 | struct trace_seq *s = &iter->seq; | 1536 | struct trace_seq *s = &iter->seq; |
1534 | 1537 | ||
1538 | if (!(trace_flags & TRACE_ITER_ANNOTATE)) | ||
1539 | return; | ||
1540 | |||
1541 | if (!(iter->iter_flags & TRACE_FILE_ANNOTATE)) | ||
1542 | return; | ||
1543 | |||
1535 | if (cpu_isset(iter->cpu, iter->started)) | 1544 | if (cpu_isset(iter->cpu, iter->started)) |
1536 | return; | 1545 | return; |
1537 | 1546 | ||
@@ -2132,6 +2141,11 @@ __tracing_open(struct inode *inode, struct file *file, int *ret) | |||
2132 | iter->trace = current_trace; | 2141 | iter->trace = current_trace; |
2133 | iter->pos = -1; | 2142 | iter->pos = -1; |
2134 | 2143 | ||
2144 | /* Annotate start of buffers if we had overruns */ | ||
2145 | if (ring_buffer_overruns(iter->tr->buffer)) | ||
2146 | iter->iter_flags |= TRACE_FILE_ANNOTATE; | ||
2147 | |||
2148 | |||
2135 | for_each_tracing_cpu(cpu) { | 2149 | for_each_tracing_cpu(cpu) { |
2136 | 2150 | ||
2137 | iter->buffer_iter[cpu] = | 2151 | iter->buffer_iter[cpu] = |
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h index 9e015f5bea1d..790ea8c0e1f3 100644 --- a/kernel/trace/trace.h +++ b/kernel/trace/trace.h | |||
@@ -473,6 +473,7 @@ enum trace_iterator_flags { | |||
473 | #ifdef CONFIG_BRANCH_TRACER | 473 | #ifdef CONFIG_BRANCH_TRACER |
474 | TRACE_ITER_BRANCH = 0x1000, | 474 | TRACE_ITER_BRANCH = 0x1000, |
475 | #endif | 475 | #endif |
476 | TRACE_ITER_ANNOTATE = 0x2000, | ||
476 | }; | 477 | }; |
477 | 478 | ||
478 | /* | 479 | /* |