diff options
Diffstat (limited to 'kernel/trace/trace_export.c')
| -rw-r--r-- | kernel/trace/trace_export.c | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/kernel/trace/trace_export.c b/kernel/trace/trace_export.c index 9753fcc61bc5..dff8c84ddf17 100644 --- a/kernel/trace/trace_export.c +++ b/kernel/trace/trace_export.c | |||
| @@ -48,11 +48,11 @@ | |||
| 48 | struct ____ftrace_##name { \ | 48 | struct ____ftrace_##name { \ |
| 49 | tstruct \ | 49 | tstruct \ |
| 50 | }; \ | 50 | }; \ |
| 51 | static void __used ____ftrace_check_##name(void) \ | 51 | static void __always_unused ____ftrace_check_##name(void) \ |
| 52 | { \ | 52 | { \ |
| 53 | struct ____ftrace_##name *__entry = NULL; \ | 53 | struct ____ftrace_##name *__entry = NULL; \ |
| 54 | \ | 54 | \ |
| 55 | /* force cmpile-time check on F_printk() */ \ | 55 | /* force compile-time check on F_printk() */ \ |
| 56 | printk(print); \ | 56 | printk(print); \ |
| 57 | } | 57 | } |
| 58 | 58 | ||
| @@ -66,44 +66,47 @@ static void __used ____ftrace_check_##name(void) \ | |||
| 66 | #undef __field | 66 | #undef __field |
| 67 | #define __field(type, item) \ | 67 | #define __field(type, item) \ |
| 68 | ret = trace_seq_printf(s, "\tfield:" #type " " #item ";\t" \ | 68 | ret = trace_seq_printf(s, "\tfield:" #type " " #item ";\t" \ |
| 69 | "offset:%zu;\tsize:%zu;\n", \ | 69 | "offset:%zu;\tsize:%zu;\tsigned:%u;\n", \ |
| 70 | offsetof(typeof(field), item), \ | 70 | offsetof(typeof(field), item), \ |
| 71 | sizeof(field.item)); \ | 71 | sizeof(field.item), is_signed_type(type)); \ |
| 72 | if (!ret) \ | 72 | if (!ret) \ |
| 73 | return 0; | 73 | return 0; |
| 74 | 74 | ||
| 75 | #undef __field_desc | 75 | #undef __field_desc |
| 76 | #define __field_desc(type, container, item) \ | 76 | #define __field_desc(type, container, item) \ |
| 77 | ret = trace_seq_printf(s, "\tfield:" #type " " #item ";\t" \ | 77 | ret = trace_seq_printf(s, "\tfield:" #type " " #item ";\t" \ |
| 78 | "offset:%zu;\tsize:%zu;\n", \ | 78 | "offset:%zu;\tsize:%zu;\tsigned:%u;\n", \ |
| 79 | offsetof(typeof(field), container.item), \ | 79 | offsetof(typeof(field), container.item), \ |
| 80 | sizeof(field.container.item)); \ | 80 | sizeof(field.container.item), \ |
| 81 | is_signed_type(type)); \ | ||
| 81 | if (!ret) \ | 82 | if (!ret) \ |
| 82 | return 0; | 83 | return 0; |
| 83 | 84 | ||
| 84 | #undef __array | 85 | #undef __array |
| 85 | #define __array(type, item, len) \ | 86 | #define __array(type, item, len) \ |
| 86 | ret = trace_seq_printf(s, "\tfield:" #type " " #item "[" #len "];\t" \ | 87 | ret = trace_seq_printf(s, "\tfield:" #type " " #item "[" #len "];\t" \ |
| 87 | "offset:%zu;\tsize:%zu;\n", \ | 88 | "offset:%zu;\tsize:%zu;\tsigned:%u;\n", \ |
| 88 | offsetof(typeof(field), item), \ | 89 | offsetof(typeof(field), item), \ |
| 89 | sizeof(field.item)); \ | 90 | sizeof(field.item), is_signed_type(type)); \ |
| 90 | if (!ret) \ | 91 | if (!ret) \ |
| 91 | return 0; | 92 | return 0; |
| 92 | 93 | ||
| 93 | #undef __array_desc | 94 | #undef __array_desc |
| 94 | #define __array_desc(type, container, item, len) \ | 95 | #define __array_desc(type, container, item, len) \ |
| 95 | ret = trace_seq_printf(s, "\tfield:" #type " " #item "[" #len "];\t" \ | 96 | ret = trace_seq_printf(s, "\tfield:" #type " " #item "[" #len "];\t" \ |
| 96 | "offset:%zu;\tsize:%zu;\n", \ | 97 | "offset:%zu;\tsize:%zu;\tsigned:%u;\n", \ |
| 97 | offsetof(typeof(field), container.item), \ | 98 | offsetof(typeof(field), container.item), \ |
| 98 | sizeof(field.container.item)); \ | 99 | sizeof(field.container.item), \ |
| 100 | is_signed_type(type)); \ | ||
| 99 | if (!ret) \ | 101 | if (!ret) \ |
| 100 | return 0; | 102 | return 0; |
| 101 | 103 | ||
| 102 | #undef __dynamic_array | 104 | #undef __dynamic_array |
| 103 | #define __dynamic_array(type, item) \ | 105 | #define __dynamic_array(type, item) \ |
| 104 | ret = trace_seq_printf(s, "\tfield:" #type " " #item ";\t" \ | 106 | ret = trace_seq_printf(s, "\tfield:" #type " " #item ";\t" \ |
| 105 | "offset:%zu;\tsize:0;\n", \ | 107 | "offset:%zu;\tsize:0;\tsigned:%u;\n", \ |
| 106 | offsetof(typeof(field), item)); \ | 108 | offsetof(typeof(field), item), \ |
| 109 | is_signed_type(type)); \ | ||
| 107 | if (!ret) \ | 110 | if (!ret) \ |
| 108 | return 0; | 111 | return 0; |
| 109 | 112 | ||
| @@ -131,7 +134,6 @@ ftrace_format_##name(struct ftrace_event_call *unused, \ | |||
| 131 | 134 | ||
| 132 | #include "trace_entries.h" | 135 | #include "trace_entries.h" |
| 133 | 136 | ||
| 134 | |||
| 135 | #undef __field | 137 | #undef __field |
| 136 | #define __field(type, item) \ | 138 | #define __field(type, item) \ |
| 137 | ret = trace_define_field(event_call, #type, #item, \ | 139 | ret = trace_define_field(event_call, #type, #item, \ |
| @@ -193,6 +195,11 @@ ftrace_define_fields_##name(struct ftrace_event_call *event_call) \ | |||
| 193 | 195 | ||
| 194 | #include "trace_entries.h" | 196 | #include "trace_entries.h" |
| 195 | 197 | ||
| 198 | static int ftrace_raw_init_event(struct ftrace_event_call *call) | ||
| 199 | { | ||
| 200 | INIT_LIST_HEAD(&call->fields); | ||
| 201 | return 0; | ||
| 202 | } | ||
| 196 | 203 | ||
| 197 | #undef __field | 204 | #undef __field |
| 198 | #define __field(type, item) | 205 | #define __field(type, item) |
| @@ -211,7 +218,6 @@ ftrace_define_fields_##name(struct ftrace_event_call *event_call) \ | |||
| 211 | 218 | ||
| 212 | #undef FTRACE_ENTRY | 219 | #undef FTRACE_ENTRY |
| 213 | #define FTRACE_ENTRY(call, struct_name, type, tstruct, print) \ | 220 | #define FTRACE_ENTRY(call, struct_name, type, tstruct, print) \ |
| 214 | static int ftrace_raw_init_event_##call(void); \ | ||
| 215 | \ | 221 | \ |
| 216 | struct ftrace_event_call __used \ | 222 | struct ftrace_event_call __used \ |
| 217 | __attribute__((__aligned__(4))) \ | 223 | __attribute__((__aligned__(4))) \ |
| @@ -219,14 +225,9 @@ __attribute__((section("_ftrace_events"))) event_##call = { \ | |||
| 219 | .name = #call, \ | 225 | .name = #call, \ |
| 220 | .id = type, \ | 226 | .id = type, \ |
| 221 | .system = __stringify(TRACE_SYSTEM), \ | 227 | .system = __stringify(TRACE_SYSTEM), \ |
| 222 | .raw_init = ftrace_raw_init_event_##call, \ | 228 | .raw_init = ftrace_raw_init_event, \ |
| 223 | .show_format = ftrace_format_##call, \ | 229 | .show_format = ftrace_format_##call, \ |
| 224 | .define_fields = ftrace_define_fields_##call, \ | 230 | .define_fields = ftrace_define_fields_##call, \ |
| 225 | }; \ | 231 | }; \ |
| 226 | static int ftrace_raw_init_event_##call(void) \ | ||
| 227 | { \ | ||
| 228 | INIT_LIST_HEAD(&event_##call.fields); \ | ||
| 229 | return 0; \ | ||
| 230 | } \ | ||
| 231 | 232 | ||
| 232 | #include "trace_entries.h" | 233 | #include "trace_entries.h" |
