diff options
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/trace/trace.c | 1 | ||||
-rw-r--r-- | kernel/trace/trace.h | 1 | ||||
-rw-r--r-- | kernel/trace/trace_functions_return.c | 38 |
3 files changed, 34 insertions, 6 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 9531fddcfb8d..e97c29a6e7b0 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
@@ -853,6 +853,7 @@ static void __trace_function_return(struct trace_array *tr, | |||
853 | entry->parent_ip = trace->ret; | 853 | entry->parent_ip = trace->ret; |
854 | entry->rettime = trace->rettime; | 854 | entry->rettime = trace->rettime; |
855 | entry->calltime = trace->calltime; | 855 | entry->calltime = trace->calltime; |
856 | entry->overrun = trace->overrun; | ||
856 | ring_buffer_unlock_commit(global_trace.buffer, event, irq_flags); | 857 | ring_buffer_unlock_commit(global_trace.buffer, event, irq_flags); |
857 | } | 858 | } |
858 | #endif | 859 | #endif |
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h index 9d22618bf99f..2cb12fd98f6b 100644 --- a/kernel/trace/trace.h +++ b/kernel/trace/trace.h | |||
@@ -60,6 +60,7 @@ struct ftrace_ret_entry { | |||
60 | unsigned long parent_ip; | 60 | unsigned long parent_ip; |
61 | unsigned long long calltime; | 61 | unsigned long long calltime; |
62 | unsigned long long rettime; | 62 | unsigned long long rettime; |
63 | unsigned long overrun; | ||
63 | }; | 64 | }; |
64 | extern struct tracer boot_tracer; | 65 | extern struct tracer boot_tracer; |
65 | 66 | ||
diff --git a/kernel/trace/trace_functions_return.c b/kernel/trace/trace_functions_return.c index a68564af022b..e00d64509c9c 100644 --- a/kernel/trace/trace_functions_return.c +++ b/kernel/trace/trace_functions_return.c | |||
@@ -14,6 +14,19 @@ | |||
14 | #include "trace.h" | 14 | #include "trace.h" |
15 | 15 | ||
16 | 16 | ||
17 | #define TRACE_RETURN_PRINT_OVERRUN 0x1 | ||
18 | static struct tracer_opt trace_opts[] = { | ||
19 | /* Display overruns or not */ | ||
20 | { TRACER_OPT(overrun, TRACE_RETURN_PRINT_OVERRUN) }, | ||
21 | { } /* Empty entry */ | ||
22 | }; | ||
23 | |||
24 | static struct tracer_flags tracer_flags = { | ||
25 | .val = 0, /* Don't display overruns by default */ | ||
26 | .opts = trace_opts | ||
27 | }; | ||
28 | |||
29 | |||
17 | static int return_trace_init(struct trace_array *tr) | 30 | static int return_trace_init(struct trace_array *tr) |
18 | { | 31 | { |
19 | int cpu; | 32 | int cpu; |
@@ -42,26 +55,39 @@ print_return_function(struct trace_iterator *iter) | |||
42 | ret = trace_seq_printf(s, "%pF -> ", (void *)field->parent_ip); | 55 | ret = trace_seq_printf(s, "%pF -> ", (void *)field->parent_ip); |
43 | if (!ret) | 56 | if (!ret) |
44 | return TRACE_TYPE_PARTIAL_LINE; | 57 | return TRACE_TYPE_PARTIAL_LINE; |
58 | |||
45 | ret = seq_print_ip_sym(s, field->ip, | 59 | ret = seq_print_ip_sym(s, field->ip, |
46 | trace_flags & TRACE_ITER_SYM_MASK); | 60 | trace_flags & TRACE_ITER_SYM_MASK); |
47 | if (!ret) | 61 | if (!ret) |
48 | return TRACE_TYPE_PARTIAL_LINE; | 62 | return TRACE_TYPE_PARTIAL_LINE; |
49 | ret = trace_seq_printf(s, " (%llu ns)\n", | 63 | |
64 | ret = trace_seq_printf(s, " (%llu ns)", | ||
50 | field->rettime - field->calltime); | 65 | field->rettime - field->calltime); |
51 | if (!ret) | 66 | if (!ret) |
52 | return TRACE_TYPE_PARTIAL_LINE; | 67 | return TRACE_TYPE_PARTIAL_LINE; |
53 | else | 68 | |
54 | return TRACE_TYPE_HANDLED; | 69 | if (tracer_flags.val & TRACE_RETURN_PRINT_OVERRUN) { |
70 | ret = trace_seq_printf(s, " (Overruns: %lu)", | ||
71 | field->overrun); | ||
72 | if (!ret) | ||
73 | return TRACE_TYPE_PARTIAL_LINE; | ||
74 | } | ||
75 | |||
76 | ret = trace_seq_printf(s, "\n"); | ||
77 | if (!ret) | ||
78 | return TRACE_TYPE_PARTIAL_LINE; | ||
79 | |||
80 | return TRACE_TYPE_HANDLED; | ||
55 | } | 81 | } |
56 | return TRACE_TYPE_UNHANDLED; | 82 | return TRACE_TYPE_UNHANDLED; |
57 | } | 83 | } |
58 | 84 | ||
59 | static struct tracer return_trace __read_mostly = | 85 | static struct tracer return_trace __read_mostly = { |
60 | { | ||
61 | .name = "return", | 86 | .name = "return", |
62 | .init = return_trace_init, | 87 | .init = return_trace_init, |
63 | .reset = return_trace_reset, | 88 | .reset = return_trace_reset, |
64 | .print_line = print_return_function | 89 | .print_line = print_return_function, |
90 | .flags = &tracer_flags, | ||
65 | }; | 91 | }; |
66 | 92 | ||
67 | static __init int init_return_trace(void) | 93 | static __init int init_return_trace(void) |