diff options
Diffstat (limited to 'kernel/trace/trace.h')
-rw-r--r-- | kernel/trace/trace.h | 160 |
1 files changed, 27 insertions, 133 deletions
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h index 4ad4e1ddcb9b..d308195d40aa 100644 --- a/kernel/trace/trace.h +++ b/kernel/trace/trace.h | |||
@@ -42,150 +42,45 @@ enum trace_type { | |||
42 | __TRACE_LAST_TYPE, | 42 | __TRACE_LAST_TYPE, |
43 | }; | 43 | }; |
44 | 44 | ||
45 | /* | 45 | enum kmemtrace_type_id { |
46 | * Function trace entry - function address and parent function addres: | 46 | KMEMTRACE_TYPE_KMALLOC = 0, /* kmalloc() or kfree(). */ |
47 | */ | 47 | KMEMTRACE_TYPE_CACHE, /* kmem_cache_*(). */ |
48 | struct ftrace_entry { | 48 | KMEMTRACE_TYPE_PAGES, /* __get_free_pages() and friends. */ |
49 | struct trace_entry ent; | ||
50 | unsigned long ip; | ||
51 | unsigned long parent_ip; | ||
52 | }; | ||
53 | |||
54 | /* Function call entry */ | ||
55 | struct ftrace_graph_ent_entry { | ||
56 | struct trace_entry ent; | ||
57 | struct ftrace_graph_ent graph_ent; | ||
58 | }; | 49 | }; |
59 | 50 | ||
60 | /* Function return entry */ | ||
61 | struct ftrace_graph_ret_entry { | ||
62 | struct trace_entry ent; | ||
63 | struct ftrace_graph_ret ret; | ||
64 | }; | ||
65 | extern struct tracer boot_tracer; | 51 | extern struct tracer boot_tracer; |
66 | 52 | ||
67 | /* | 53 | #undef __field |
68 | * Context switch trace entry - which task (and prio) we switched from/to: | 54 | #define __field(type, item) type item; |
69 | */ | ||
70 | struct ctx_switch_entry { | ||
71 | struct trace_entry ent; | ||
72 | unsigned int prev_pid; | ||
73 | unsigned char prev_prio; | ||
74 | unsigned char prev_state; | ||
75 | unsigned int next_pid; | ||
76 | unsigned char next_prio; | ||
77 | unsigned char next_state; | ||
78 | unsigned int next_cpu; | ||
79 | }; | ||
80 | |||
81 | /* | ||
82 | * Special (free-form) trace entry: | ||
83 | */ | ||
84 | struct special_entry { | ||
85 | struct trace_entry ent; | ||
86 | unsigned long arg1; | ||
87 | unsigned long arg2; | ||
88 | unsigned long arg3; | ||
89 | }; | ||
90 | |||
91 | /* | ||
92 | * Stack-trace entry: | ||
93 | */ | ||
94 | 55 | ||
95 | #define FTRACE_STACK_ENTRIES 8 | 56 | #undef __array |
57 | #define __array(type, item, size) type item[size]; | ||
96 | 58 | ||
97 | struct stack_entry { | 59 | #undef __dynamic_array |
98 | struct trace_entry ent; | 60 | #define __dynamic_array(type, item) type item[]; |
99 | unsigned long caller[FTRACE_STACK_ENTRIES]; | ||
100 | }; | ||
101 | 61 | ||
102 | struct userstack_entry { | 62 | #undef F_STRUCT |
103 | struct trace_entry ent; | 63 | #define F_STRUCT(args...) args |
104 | unsigned int tgid; | ||
105 | unsigned long caller[FTRACE_STACK_ENTRIES]; | ||
106 | }; | ||
107 | |||
108 | /* | ||
109 | * trace_printk entry: | ||
110 | */ | ||
111 | struct bprint_entry { | ||
112 | struct trace_entry ent; | ||
113 | unsigned long ip; | ||
114 | const char *fmt; | ||
115 | u32 buf[]; | ||
116 | }; | ||
117 | |||
118 | struct print_entry { | ||
119 | struct trace_entry ent; | ||
120 | unsigned long ip; | ||
121 | char buf[]; | ||
122 | }; | ||
123 | 64 | ||
124 | struct trace_mmiotrace_rw { | 65 | #undef FTRACE_ENTRY |
125 | struct trace_entry ent; | 66 | #define FTRACE_ENTRY(name, struct_name, id, tstruct, print) \ |
126 | struct mmiotrace_rw rw; | 67 | struct struct_name { \ |
127 | }; | 68 | struct trace_entry ent; \ |
128 | 69 | tstruct \ | |
129 | struct trace_mmiotrace_map { | 70 | } |
130 | struct trace_entry ent; | ||
131 | struct mmiotrace_map map; | ||
132 | }; | ||
133 | |||
134 | struct trace_boot_call { | ||
135 | struct trace_entry ent; | ||
136 | struct boot_trace_call boot_call; | ||
137 | }; | ||
138 | |||
139 | struct trace_boot_ret { | ||
140 | struct trace_entry ent; | ||
141 | struct boot_trace_ret boot_ret; | ||
142 | }; | ||
143 | |||
144 | #define TRACE_FUNC_SIZE 30 | ||
145 | #define TRACE_FILE_SIZE 20 | ||
146 | struct trace_branch { | ||
147 | struct trace_entry ent; | ||
148 | unsigned line; | ||
149 | char func[TRACE_FUNC_SIZE+1]; | ||
150 | char file[TRACE_FILE_SIZE+1]; | ||
151 | char correct; | ||
152 | }; | ||
153 | |||
154 | struct hw_branch_entry { | ||
155 | struct trace_entry ent; | ||
156 | u64 from; | ||
157 | u64 to; | ||
158 | }; | ||
159 | |||
160 | struct trace_power { | ||
161 | struct trace_entry ent; | ||
162 | struct power_trace state_data; | ||
163 | }; | ||
164 | 71 | ||
165 | enum kmemtrace_type_id { | 72 | #undef TP_ARGS |
166 | KMEMTRACE_TYPE_KMALLOC = 0, /* kmalloc() or kfree(). */ | 73 | #define TP_ARGS(args...) args |
167 | KMEMTRACE_TYPE_CACHE, /* kmem_cache_*(). */ | ||
168 | KMEMTRACE_TYPE_PAGES, /* __get_free_pages() and friends. */ | ||
169 | }; | ||
170 | 74 | ||
171 | struct kmemtrace_alloc_entry { | 75 | #undef FTRACE_ENTRY_DUP |
172 | struct trace_entry ent; | 76 | #define FTRACE_ENTRY_DUP(name, name_struct, id, tstruct, printk) |
173 | enum kmemtrace_type_id type_id; | ||
174 | unsigned long call_site; | ||
175 | const void *ptr; | ||
176 | size_t bytes_req; | ||
177 | size_t bytes_alloc; | ||
178 | gfp_t gfp_flags; | ||
179 | int node; | ||
180 | }; | ||
181 | 77 | ||
182 | struct kmemtrace_free_entry { | 78 | #include "trace_entries.h" |
183 | struct trace_entry ent; | ||
184 | enum kmemtrace_type_id type_id; | ||
185 | unsigned long call_site; | ||
186 | const void *ptr; | ||
187 | }; | ||
188 | 79 | ||
80 | /* | ||
81 | * syscalls are special, and need special handling, this is why | ||
82 | * they are not included in trace_entries.h | ||
83 | */ | ||
189 | struct syscall_trace_enter { | 84 | struct syscall_trace_enter { |
190 | struct trace_entry ent; | 85 | struct trace_entry ent; |
191 | int nr; | 86 | int nr; |
@@ -198,7 +93,6 @@ struct syscall_trace_exit { | |||
198 | unsigned long ret; | 93 | unsigned long ret; |
199 | }; | 94 | }; |
200 | 95 | ||
201 | |||
202 | /* | 96 | /* |
203 | * trace_flag_type is an enumeration that holds different | 97 | * trace_flag_type is an enumeration that holds different |
204 | * states when a trace occurs. These are: | 98 | * states when a trace occurs. These are: |