diff options
Diffstat (limited to 'kernel/trace/trace.h')
-rw-r--r-- | kernel/trace/trace.h | 81 |
1 files changed, 42 insertions, 39 deletions
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h index f6965f775b43..e541a6b7e312 100644 --- a/kernel/trace/trace.h +++ b/kernel/trace/trace.h | |||
@@ -27,9 +27,24 @@ enum trace_type { | |||
27 | }; | 27 | }; |
28 | 28 | ||
29 | /* | 29 | /* |
30 | * The trace entry - the most basic unit of tracing. This is what | ||
31 | * is printed in the end as a single line in the trace output, such as: | ||
32 | * | ||
33 | * bash-15816 [01] 235.197585: idle_cpu <- irq_enter | ||
34 | */ | ||
35 | struct trace_entry { | ||
36 | unsigned char type; | ||
37 | unsigned char cpu; | ||
38 | unsigned char flags; | ||
39 | unsigned char preempt_count; | ||
40 | int pid; | ||
41 | }; | ||
42 | |||
43 | /* | ||
30 | * Function trace entry - function address and parent function addres: | 44 | * Function trace entry - function address and parent function addres: |
31 | */ | 45 | */ |
32 | struct ftrace_entry { | 46 | struct ftrace_entry { |
47 | struct trace_entry ent; | ||
33 | unsigned long ip; | 48 | unsigned long ip; |
34 | unsigned long parent_ip; | 49 | unsigned long parent_ip; |
35 | }; | 50 | }; |
@@ -39,6 +54,7 @@ extern struct tracer boot_tracer; | |||
39 | * Context switch trace entry - which task (and prio) we switched from/to: | 54 | * Context switch trace entry - which task (and prio) we switched from/to: |
40 | */ | 55 | */ |
41 | struct ctx_switch_entry { | 56 | struct ctx_switch_entry { |
57 | struct trace_entry ent; | ||
42 | unsigned int prev_pid; | 58 | unsigned int prev_pid; |
43 | unsigned char prev_prio; | 59 | unsigned char prev_prio; |
44 | unsigned char prev_state; | 60 | unsigned char prev_state; |
@@ -52,6 +68,7 @@ struct ctx_switch_entry { | |||
52 | * Special (free-form) trace entry: | 68 | * Special (free-form) trace entry: |
53 | */ | 69 | */ |
54 | struct special_entry { | 70 | struct special_entry { |
71 | struct trace_entry ent; | ||
55 | unsigned long arg1; | 72 | unsigned long arg1; |
56 | unsigned long arg2; | 73 | unsigned long arg2; |
57 | unsigned long arg3; | 74 | unsigned long arg3; |
@@ -64,6 +81,7 @@ struct special_entry { | |||
64 | #define FTRACE_STACK_ENTRIES 8 | 81 | #define FTRACE_STACK_ENTRIES 8 |
65 | 82 | ||
66 | struct stack_entry { | 83 | struct stack_entry { |
84 | struct trace_entry ent; | ||
67 | unsigned long caller[FTRACE_STACK_ENTRIES]; | 85 | unsigned long caller[FTRACE_STACK_ENTRIES]; |
68 | }; | 86 | }; |
69 | 87 | ||
@@ -71,10 +89,34 @@ struct stack_entry { | |||
71 | * ftrace_printk entry: | 89 | * ftrace_printk entry: |
72 | */ | 90 | */ |
73 | struct print_entry { | 91 | struct print_entry { |
92 | struct trace_entry ent; | ||
74 | unsigned long ip; | 93 | unsigned long ip; |
75 | char buf[]; | 94 | char buf[]; |
76 | }; | 95 | }; |
77 | 96 | ||
97 | #define TRACE_OLD_SIZE 88 | ||
98 | |||
99 | struct trace_field_cont { | ||
100 | unsigned char type; | ||
101 | /* Temporary till we get rid of this completely */ | ||
102 | char buf[TRACE_OLD_SIZE - 1]; | ||
103 | }; | ||
104 | |||
105 | struct trace_mmiotrace_rw { | ||
106 | struct trace_entry ent; | ||
107 | struct mmiotrace_rw rw; | ||
108 | }; | ||
109 | |||
110 | struct trace_mmiotrace_map { | ||
111 | struct trace_entry ent; | ||
112 | struct mmiotrace_map map; | ||
113 | }; | ||
114 | |||
115 | struct trace_boot { | ||
116 | struct trace_entry ent; | ||
117 | struct boot_trace initcall; | ||
118 | }; | ||
119 | |||
78 | /* | 120 | /* |
79 | * trace_flag_type is an enumeration that holds different | 121 | * trace_flag_type is an enumeration that holds different |
80 | * states when a trace occurs. These are: | 122 | * states when a trace occurs. These are: |
@@ -92,46 +134,7 @@ enum trace_flag_type { | |||
92 | TRACE_FLAG_CONT = 0x10, | 134 | TRACE_FLAG_CONT = 0x10, |
93 | }; | 135 | }; |
94 | 136 | ||
95 | /* | ||
96 | * The trace field - the most basic unit of tracing. This is what | ||
97 | * is printed in the end as a single line in the trace output, such as: | ||
98 | * | ||
99 | * bash-15816 [01] 235.197585: idle_cpu <- irq_enter | ||
100 | */ | ||
101 | struct trace_field { | ||
102 | char cpu; | ||
103 | char flags; | ||
104 | char preempt_count; | ||
105 | int pid; | ||
106 | union { | ||
107 | struct ftrace_entry fn; | ||
108 | struct ctx_switch_entry ctx; | ||
109 | struct special_entry special; | ||
110 | struct stack_entry stack; | ||
111 | struct print_entry print; | ||
112 | struct mmiotrace_rw mmiorw; | ||
113 | struct mmiotrace_map mmiomap; | ||
114 | struct boot_trace initcall; | ||
115 | }; | ||
116 | }; | ||
117 | |||
118 | struct trace_field_cont { | ||
119 | char buf[sizeof(struct trace_field)]; | ||
120 | }; | ||
121 | |||
122 | struct trace_entry { | ||
123 | char type; | ||
124 | union { | ||
125 | struct trace_field field; | ||
126 | struct trace_field_cont cont; | ||
127 | }; | ||
128 | }; | ||
129 | |||
130 | #define TRACE_ENTRY_SIZE sizeof(struct trace_entry) | ||
131 | #define TRACE_BUF_SIZE 1024 | 137 | #define TRACE_BUF_SIZE 1024 |
132 | #define TRACE_PRINT_BUF_SIZE \ | ||
133 | (sizeof(struct trace_field) - offsetof(struct trace_field, print.buf)) | ||
134 | #define TRACE_CONT_BUF_SIZE sizeof(struct trace_field) | ||
135 | 138 | ||
136 | /* | 139 | /* |
137 | * The CPU trace array - it consists of thousands of trace entries | 140 | * The CPU trace array - it consists of thousands of trace entries |