diff options
-rw-r--r-- | include/linux/ftrace_event.h | 9 | ||||
-rw-r--r-- | include/trace/ftrace.h | 31 | ||||
-rw-r--r-- | kernel/trace/trace_events.c | 11 | ||||
-rw-r--r-- | kernel/trace/trace_events_filter.c | 6 | ||||
-rw-r--r-- | kernel/trace/trace_export.c | 8 | ||||
-rw-r--r-- | kernel/trace/trace_syscalls.c | 6 |
6 files changed, 49 insertions, 22 deletions
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h index df5b085c4150..0440bea8f6bb 100644 --- a/include/linux/ftrace_event.h +++ b/include/linux/ftrace_event.h | |||
@@ -140,9 +140,16 @@ extern int filter_current_check_discard(struct ftrace_event_call *call, | |||
140 | void *rec, | 140 | void *rec, |
141 | struct ring_buffer_event *event); | 141 | struct ring_buffer_event *event); |
142 | 142 | ||
143 | enum { | ||
144 | FILTER_OTHER = 0, | ||
145 | FILTER_STATIC_STRING, | ||
146 | FILTER_DYN_STRING, | ||
147 | }; | ||
148 | |||
143 | extern int trace_define_field(struct ftrace_event_call *call, | 149 | extern int trace_define_field(struct ftrace_event_call *call, |
144 | const char *type, const char *name, | 150 | const char *type, const char *name, |
145 | int offset, int size, int is_signed); | 151 | int offset, int size, int is_signed, |
152 | int filter_type); | ||
146 | extern int trace_define_common_fields(struct ftrace_event_call *call); | 153 | extern int trace_define_common_fields(struct ftrace_event_call *call); |
147 | 154 | ||
148 | #define is_signed_type(type) (((type)(-1)) < 0) | 155 | #define is_signed_type(type) (((type)(-1)) < 0) |
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h index 127400255e4c..1b1f742a6045 100644 --- a/include/trace/ftrace.h +++ b/include/trace/ftrace.h | |||
@@ -21,6 +21,9 @@ | |||
21 | #undef __field | 21 | #undef __field |
22 | #define __field(type, item) type item; | 22 | #define __field(type, item) type item; |
23 | 23 | ||
24 | #undef __field_ext | ||
25 | #define __field_ext(type, item, filter_type) type item; | ||
26 | |||
24 | #undef __array | 27 | #undef __array |
25 | #define __array(type, item, len) type item[len]; | 28 | #define __array(type, item, len) type item[len]; |
26 | 29 | ||
@@ -62,7 +65,10 @@ | |||
62 | */ | 65 | */ |
63 | 66 | ||
64 | #undef __field | 67 | #undef __field |
65 | #define __field(type, item); | 68 | #define __field(type, item) |
69 | |||
70 | #undef __field_ext | ||
71 | #define __field_ext(type, item, filter_type) | ||
66 | 72 | ||
67 | #undef __array | 73 | #undef __array |
68 | #define __array(type, item, len) | 74 | #define __array(type, item, len) |
@@ -110,6 +116,9 @@ | |||
110 | if (!ret) \ | 116 | if (!ret) \ |
111 | return 0; | 117 | return 0; |
112 | 118 | ||
119 | #undef __field_ext | ||
120 | #define __field_ext(type, item, filter_type) __field(type, item) | ||
121 | |||
113 | #undef __array | 122 | #undef __array |
114 | #define __array(type, item, len) \ | 123 | #define __array(type, item, len) \ |
115 | ret = trace_seq_printf(s, "\tfield:" #type " " #item "[" #len "];\t" \ | 124 | ret = trace_seq_printf(s, "\tfield:" #type " " #item "[" #len "];\t" \ |
@@ -265,28 +274,33 @@ ftrace_raw_output_##call(struct trace_iterator *iter, int flags) \ | |||
265 | 274 | ||
266 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) | 275 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) |
267 | 276 | ||
268 | #undef __field | 277 | #undef __field_ext |
269 | #define __field(type, item) \ | 278 | #define __field_ext(type, item, filter_type) \ |
270 | ret = trace_define_field(event_call, #type, #item, \ | 279 | ret = trace_define_field(event_call, #type, #item, \ |
271 | offsetof(typeof(field), item), \ | 280 | offsetof(typeof(field), item), \ |
272 | sizeof(field.item), is_signed_type(type)); \ | 281 | sizeof(field.item), \ |
282 | is_signed_type(type), filter_type); \ | ||
273 | if (ret) \ | 283 | if (ret) \ |
274 | return ret; | 284 | return ret; |
275 | 285 | ||
286 | #undef __field | ||
287 | #define __field(type, item) __field_ext(type, item, FILTER_OTHER) | ||
288 | |||
276 | #undef __array | 289 | #undef __array |
277 | #define __array(type, item, len) \ | 290 | #define __array(type, item, len) \ |
278 | BUILD_BUG_ON(len > MAX_FILTER_STR_VAL); \ | 291 | BUILD_BUG_ON(len > MAX_FILTER_STR_VAL); \ |
279 | ret = trace_define_field(event_call, #type "[" #len "]", #item, \ | 292 | ret = trace_define_field(event_call, #type "[" #len "]", #item, \ |
280 | offsetof(typeof(field), item), \ | 293 | offsetof(typeof(field), item), \ |
281 | sizeof(field.item), 0); \ | 294 | sizeof(field.item), 0, FILTER_OTHER); \ |
282 | if (ret) \ | 295 | if (ret) \ |
283 | return ret; | 296 | return ret; |
284 | 297 | ||
285 | #undef __dynamic_array | 298 | #undef __dynamic_array |
286 | #define __dynamic_array(type, item, len) \ | 299 | #define __dynamic_array(type, item, len) \ |
287 | ret = trace_define_field(event_call, "__data_loc " #type "[]", #item, \ | 300 | ret = trace_define_field(event_call, "__data_loc " #type "[]", #item, \ |
288 | offsetof(typeof(field), __data_loc_##item), \ | 301 | offsetof(typeof(field), __data_loc_##item), \ |
289 | sizeof(field.__data_loc_##item), 0); | 302 | sizeof(field.__data_loc_##item), 0, \ |
303 | FILTER_OTHER); | ||
290 | 304 | ||
291 | #undef __string | 305 | #undef __string |
292 | #define __string(item, src) __dynamic_array(char, item, -1) | 306 | #define __string(item, src) __dynamic_array(char, item, -1) |
@@ -320,6 +334,9 @@ ftrace_define_fields_##call(struct ftrace_event_call *event_call) \ | |||
320 | #undef __field | 334 | #undef __field |
321 | #define __field(type, item) | 335 | #define __field(type, item) |
322 | 336 | ||
337 | #undef __field_ext | ||
338 | #define __field_ext(type, item, filter_type) | ||
339 | |||
323 | #undef __array | 340 | #undef __array |
324 | #define __array(type, item, len) | 341 | #define __array(type, item, len) |
325 | 342 | ||
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c index 5740e90f4ca1..d33bcdeffe69 100644 --- a/kernel/trace/trace_events.c +++ b/kernel/trace/trace_events.c | |||
@@ -28,7 +28,8 @@ DEFINE_MUTEX(event_mutex); | |||
28 | LIST_HEAD(ftrace_events); | 28 | LIST_HEAD(ftrace_events); |
29 | 29 | ||
30 | int trace_define_field(struct ftrace_event_call *call, const char *type, | 30 | int trace_define_field(struct ftrace_event_call *call, const char *type, |
31 | const char *name, int offset, int size, int is_signed) | 31 | const char *name, int offset, int size, int is_signed, |
32 | int filter_type) | ||
32 | { | 33 | { |
33 | struct ftrace_event_field *field; | 34 | struct ftrace_event_field *field; |
34 | 35 | ||
@@ -44,7 +45,11 @@ int trace_define_field(struct ftrace_event_call *call, const char *type, | |||
44 | if (!field->type) | 45 | if (!field->type) |
45 | goto err; | 46 | goto err; |
46 | 47 | ||
47 | field->filter_type = filter_assign_type(type); | 48 | if (filter_type == FILTER_OTHER) |
49 | field->filter_type = filter_assign_type(type); | ||
50 | else | ||
51 | field->filter_type = filter_type; | ||
52 | |||
48 | field->offset = offset; | 53 | field->offset = offset; |
49 | field->size = size; | 54 | field->size = size; |
50 | field->is_signed = is_signed; | 55 | field->is_signed = is_signed; |
@@ -68,7 +73,7 @@ EXPORT_SYMBOL_GPL(trace_define_field); | |||
68 | ret = trace_define_field(call, #type, "common_" #item, \ | 73 | ret = trace_define_field(call, #type, "common_" #item, \ |
69 | offsetof(typeof(ent), item), \ | 74 | offsetof(typeof(ent), item), \ |
70 | sizeof(ent.item), \ | 75 | sizeof(ent.item), \ |
71 | is_signed_type(type)); \ | 76 | is_signed_type(type), FILTER_OTHER); \ |
72 | if (ret) \ | 77 | if (ret) \ |
73 | return ret; | 78 | return ret; |
74 | 79 | ||
diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c index 22e6d822bbaa..8a8e576733fc 100644 --- a/kernel/trace/trace_events_filter.c +++ b/kernel/trace/trace_events_filter.c | |||
@@ -475,12 +475,6 @@ static int filter_add_pred_fn(struct filter_parse_state *ps, | |||
475 | return 0; | 475 | return 0; |
476 | } | 476 | } |
477 | 477 | ||
478 | enum { | ||
479 | FILTER_OTHER = 0, | ||
480 | FILTER_STATIC_STRING, | ||
481 | FILTER_DYN_STRING, | ||
482 | }; | ||
483 | |||
484 | int filter_assign_type(const char *type) | 478 | int filter_assign_type(const char *type) |
485 | { | 479 | { |
486 | if (strstr(type, "__data_loc") && strstr(type, "char")) | 480 | if (strstr(type, "__data_loc") && strstr(type, "char")) |
diff --git a/kernel/trace/trace_export.c b/kernel/trace/trace_export.c index 70875303ae46..029a91f42287 100644 --- a/kernel/trace/trace_export.c +++ b/kernel/trace/trace_export.c | |||
@@ -158,7 +158,8 @@ __attribute__((section("_ftrace_events"))) event_##call = { \ | |||
158 | #define TRACE_FIELD(type, item, assign) \ | 158 | #define TRACE_FIELD(type, item, assign) \ |
159 | ret = trace_define_field(event_call, #type, #item, \ | 159 | ret = trace_define_field(event_call, #type, #item, \ |
160 | offsetof(typeof(field), item), \ | 160 | offsetof(typeof(field), item), \ |
161 | sizeof(field.item), is_signed_type(type)); \ | 161 | sizeof(field.item), \ |
162 | is_signed_type(type), FILTER_OTHER); \ | ||
162 | if (ret) \ | 163 | if (ret) \ |
163 | return ret; | 164 | return ret; |
164 | 165 | ||
@@ -166,7 +167,7 @@ __attribute__((section("_ftrace_events"))) event_##call = { \ | |||
166 | #define TRACE_FIELD_SPECIAL(type, item, len, cmd) \ | 167 | #define TRACE_FIELD_SPECIAL(type, item, len, cmd) \ |
167 | ret = trace_define_field(event_call, #type "[" #len "]", #item, \ | 168 | ret = trace_define_field(event_call, #type "[" #len "]", #item, \ |
168 | offsetof(typeof(field), item), \ | 169 | offsetof(typeof(field), item), \ |
169 | sizeof(field.item), 0); \ | 170 | sizeof(field.item), 0, FILTER_OTHER); \ |
170 | if (ret) \ | 171 | if (ret) \ |
171 | return ret; | 172 | return ret; |
172 | 173 | ||
@@ -174,7 +175,8 @@ __attribute__((section("_ftrace_events"))) event_##call = { \ | |||
174 | #define TRACE_FIELD_SIGN(type, item, assign, is_signed) \ | 175 | #define TRACE_FIELD_SIGN(type, item, assign, is_signed) \ |
175 | ret = trace_define_field(event_call, #type, #item, \ | 176 | ret = trace_define_field(event_call, #type, #item, \ |
176 | offsetof(typeof(field), item), \ | 177 | offsetof(typeof(field), item), \ |
177 | sizeof(field.item), is_signed); \ | 178 | sizeof(field.item), is_signed, \ |
179 | FILTER_OTHER); \ | ||
178 | if (ret) \ | 180 | if (ret) \ |
179 | return ret; | 181 | return ret; |
180 | 182 | ||
diff --git a/kernel/trace/trace_syscalls.c b/kernel/trace/trace_syscalls.c index 46c1b977a2cb..97a2454760b0 100644 --- a/kernel/trace/trace_syscalls.c +++ b/kernel/trace/trace_syscalls.c | |||
@@ -194,7 +194,8 @@ int syscall_enter_define_fields(struct ftrace_event_call *call) | |||
194 | for (i = 0; i < meta->nb_args; i++) { | 194 | for (i = 0; i < meta->nb_args; i++) { |
195 | ret = trace_define_field(call, meta->types[i], | 195 | ret = trace_define_field(call, meta->types[i], |
196 | meta->args[i], offset, | 196 | meta->args[i], offset, |
197 | sizeof(unsigned long), 0); | 197 | sizeof(unsigned long), 0, |
198 | FILTER_OTHER); | ||
198 | offset += sizeof(unsigned long); | 199 | offset += sizeof(unsigned long); |
199 | } | 200 | } |
200 | 201 | ||
@@ -210,7 +211,8 @@ int syscall_exit_define_fields(struct ftrace_event_call *call) | |||
210 | if (ret) | 211 | if (ret) |
211 | return ret; | 212 | return ret; |
212 | 213 | ||
213 | ret = trace_define_field(call, SYSCALL_FIELD(unsigned long, ret), 0); | 214 | ret = trace_define_field(call, SYSCALL_FIELD(unsigned long, ret), 0, |
215 | FILTER_OTHER); | ||
214 | 216 | ||
215 | return ret; | 217 | return ret; |
216 | } | 218 | } |