diff options
Diffstat (limited to 'kernel/trace/trace_export.c')
| -rw-r--r-- | kernel/trace/trace_export.c | 54 |
1 files changed, 26 insertions, 28 deletions
diff --git a/kernel/trace/trace_export.c b/kernel/trace/trace_export.c index 9753fcc61bc5..d4fa5dc1ee4e 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, \ |
| @@ -156,7 +158,8 @@ ftrace_format_##name(struct ftrace_event_call *unused, \ | |||
| 156 | BUILD_BUG_ON(len > MAX_FILTER_STR_VAL); \ | 158 | BUILD_BUG_ON(len > MAX_FILTER_STR_VAL); \ |
| 157 | ret = trace_define_field(event_call, #type "[" #len "]", #item, \ | 159 | ret = trace_define_field(event_call, #type "[" #len "]", #item, \ |
| 158 | offsetof(typeof(field), item), \ | 160 | offsetof(typeof(field), item), \ |
| 159 | sizeof(field.item), 0, FILTER_OTHER); \ | 161 | sizeof(field.item), \ |
| 162 | is_signed_type(type), FILTER_OTHER); \ | ||
| 160 | if (ret) \ | 163 | if (ret) \ |
| 161 | return ret; | 164 | return ret; |
| 162 | 165 | ||
| @@ -166,8 +169,8 @@ ftrace_format_##name(struct ftrace_event_call *unused, \ | |||
| 166 | ret = trace_define_field(event_call, #type "[" #len "]", #item, \ | 169 | ret = trace_define_field(event_call, #type "[" #len "]", #item, \ |
| 167 | offsetof(typeof(field), \ | 170 | offsetof(typeof(field), \ |
| 168 | container.item), \ | 171 | container.item), \ |
| 169 | sizeof(field.container.item), 0, \ | 172 | sizeof(field.container.item), \ |
| 170 | FILTER_OTHER); \ | 173 | is_signed_type(type), FILTER_OTHER); \ |
| 171 | if (ret) \ | 174 | if (ret) \ |
| 172 | return ret; | 175 | return ret; |
| 173 | 176 | ||
| @@ -182,10 +185,6 @@ ftrace_define_fields_##name(struct ftrace_event_call *event_call) \ | |||
| 182 | struct struct_name field; \ | 185 | struct struct_name field; \ |
| 183 | int ret; \ | 186 | int ret; \ |
| 184 | \ | 187 | \ |
| 185 | ret = trace_define_common_fields(event_call); \ | ||
| 186 | if (ret) \ | ||
| 187 | return ret; \ | ||
| 188 | \ | ||
| 189 | tstruct; \ | 188 | tstruct; \ |
| 190 | \ | 189 | \ |
| 191 | return ret; \ | 190 | return ret; \ |
| @@ -193,6 +192,11 @@ ftrace_define_fields_##name(struct ftrace_event_call *event_call) \ | |||
| 193 | 192 | ||
| 194 | #include "trace_entries.h" | 193 | #include "trace_entries.h" |
| 195 | 194 | ||
| 195 | static int ftrace_raw_init_event(struct ftrace_event_call *call) | ||
| 196 | { | ||
| 197 | INIT_LIST_HEAD(&call->fields); | ||
| 198 | return 0; | ||
| 199 | } | ||
| 196 | 200 | ||
| 197 | #undef __field | 201 | #undef __field |
| 198 | #define __field(type, item) | 202 | #define __field(type, item) |
| @@ -211,7 +215,6 @@ ftrace_define_fields_##name(struct ftrace_event_call *event_call) \ | |||
| 211 | 215 | ||
| 212 | #undef FTRACE_ENTRY | 216 | #undef FTRACE_ENTRY |
| 213 | #define FTRACE_ENTRY(call, struct_name, type, tstruct, print) \ | 217 | #define FTRACE_ENTRY(call, struct_name, type, tstruct, print) \ |
| 214 | static int ftrace_raw_init_event_##call(void); \ | ||
| 215 | \ | 218 | \ |
| 216 | struct ftrace_event_call __used \ | 219 | struct ftrace_event_call __used \ |
| 217 | __attribute__((__aligned__(4))) \ | 220 | __attribute__((__aligned__(4))) \ |
| @@ -219,14 +222,9 @@ __attribute__((section("_ftrace_events"))) event_##call = { \ | |||
| 219 | .name = #call, \ | 222 | .name = #call, \ |
| 220 | .id = type, \ | 223 | .id = type, \ |
| 221 | .system = __stringify(TRACE_SYSTEM), \ | 224 | .system = __stringify(TRACE_SYSTEM), \ |
| 222 | .raw_init = ftrace_raw_init_event_##call, \ | 225 | .raw_init = ftrace_raw_init_event, \ |
| 223 | .show_format = ftrace_format_##call, \ | 226 | .show_format = ftrace_format_##call, \ |
| 224 | .define_fields = ftrace_define_fields_##call, \ | 227 | .define_fields = ftrace_define_fields_##call, \ |
| 225 | }; \ | 228 | }; \ |
| 226 | static int ftrace_raw_init_event_##call(void) \ | ||
| 227 | { \ | ||
| 228 | INIT_LIST_HEAD(&event_##call.fields); \ | ||
| 229 | return 0; \ | ||
| 230 | } \ | ||
| 231 | 229 | ||
| 232 | #include "trace_entries.h" | 230 | #include "trace_entries.h" |
