hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/kernel/trace/trace_export.c
....@@ -29,10 +29,8 @@
2929 * function and thus become accesible via perf.
3030 */
3131 #undef FTRACE_ENTRY_REG
32
-#define FTRACE_ENTRY_REG(name, struct_name, id, tstruct, print, \
33
- filter, regfn) \
34
- FTRACE_ENTRY(name, struct_name, id, PARAMS(tstruct), PARAMS(print), \
35
- filter)
32
+#define FTRACE_ENTRY_REG(name, struct_name, id, tstruct, print, regfn) \
33
+ FTRACE_ENTRY(name, struct_name, id, PARAMS(tstruct), PARAMS(print))
3634
3735 /* not needed for this file */
3836 #undef __field_struct
....@@ -41,8 +39,14 @@
4139 #undef __field
4240 #define __field(type, item) type item;
4341
42
+#undef __field_fn
43
+#define __field_fn(type, item) type item;
44
+
4445 #undef __field_desc
4546 #define __field_desc(type, container, item) type item;
47
+
48
+#undef __field_packed
49
+#define __field_packed(type, container, item) type item;
4650
4751 #undef __array
4852 #define __array(type, item, size) type item[size];
....@@ -60,7 +64,7 @@
6064 #define F_printk(fmt, args...) fmt, args
6165
6266 #undef FTRACE_ENTRY
63
-#define FTRACE_ENTRY(name, struct_name, id, tstruct, print, filter) \
67
+#define FTRACE_ENTRY(name, struct_name, id, tstruct, print) \
6468 struct ____ftrace_##name { \
6569 tstruct \
6670 }; \
....@@ -73,76 +77,56 @@
7377 }
7478
7579 #undef FTRACE_ENTRY_DUP
76
-#define FTRACE_ENTRY_DUP(name, struct_name, id, tstruct, print, filter) \
77
- FTRACE_ENTRY(name, struct_name, id, PARAMS(tstruct), PARAMS(print), \
78
- filter)
80
+#define FTRACE_ENTRY_DUP(name, struct_name, id, tstruct, print) \
81
+ FTRACE_ENTRY(name, struct_name, id, PARAMS(tstruct), PARAMS(print))
7982
8083 #include "trace_entries.h"
8184
85
+#undef __field_ext
86
+#define __field_ext(_type, _item, _filter_type) { \
87
+ .type = #_type, .name = #_item, \
88
+ .size = sizeof(_type), .align = __alignof__(_type), \
89
+ is_signed_type(_type), .filter_type = _filter_type },
90
+
91
+
92
+#undef __field_ext_packed
93
+#define __field_ext_packed(_type, _item, _filter_type) { \
94
+ .type = #_type, .name = #_item, \
95
+ .size = sizeof(_type), .align = 1, \
96
+ is_signed_type(_type), .filter_type = _filter_type },
97
+
8298 #undef __field
83
-#define __field(type, item) \
84
- ret = trace_define_field(event_call, #type, #item, \
85
- offsetof(typeof(field), item), \
86
- sizeof(field.item), \
87
- is_signed_type(type), filter_type); \
88
- if (ret) \
89
- return ret;
99
+#define __field(_type, _item) __field_ext(_type, _item, FILTER_OTHER)
100
+
101
+#undef __field_fn
102
+#define __field_fn(_type, _item) __field_ext(_type, _item, FILTER_TRACE_FN)
90103
91104 #undef __field_desc
92
-#define __field_desc(type, container, item) \
93
- ret = trace_define_field(event_call, #type, #item, \
94
- offsetof(typeof(field), \
95
- container.item), \
96
- sizeof(field.container.item), \
97
- is_signed_type(type), filter_type); \
98
- if (ret) \
99
- return ret;
105
+#define __field_desc(_type, _container, _item) __field_ext(_type, _item, FILTER_OTHER)
106
+
107
+#undef __field_packed
108
+#define __field_packed(_type, _container, _item) __field_ext_packed(_type, _item, FILTER_OTHER)
100109
101110 #undef __array
102
-#define __array(type, item, len) \
103
- do { \
104
- char *type_str = #type"["__stringify(len)"]"; \
105
- BUILD_BUG_ON(len > MAX_FILTER_STR_VAL); \
106
- ret = trace_define_field(event_call, type_str, #item, \
107
- offsetof(typeof(field), item), \
108
- sizeof(field.item), \
109
- is_signed_type(type), filter_type); \
110
- if (ret) \
111
- return ret; \
112
- } while (0);
111
+#define __array(_type, _item, _len) { \
112
+ .type = #_type"["__stringify(_len)"]", .name = #_item, \
113
+ .size = sizeof(_type[_len]), .align = __alignof__(_type), \
114
+ is_signed_type(_type), .filter_type = FILTER_OTHER },
113115
114116 #undef __array_desc
115
-#define __array_desc(type, container, item, len) \
116
- BUILD_BUG_ON(len > MAX_FILTER_STR_VAL); \
117
- ret = trace_define_field(event_call, #type "[" #len "]", #item, \
118
- offsetof(typeof(field), \
119
- container.item), \
120
- sizeof(field.container.item), \
121
- is_signed_type(type), filter_type); \
122
- if (ret) \
123
- return ret;
117
+#define __array_desc(_type, _container, _item, _len) __array(_type, _item, _len)
124118
125119 #undef __dynamic_array
126
-#define __dynamic_array(type, item) \
127
- ret = trace_define_field(event_call, #type "[]", #item, \
128
- offsetof(typeof(field), item), \
129
- 0, is_signed_type(type), filter_type);\
130
- if (ret) \
131
- return ret;
120
+#define __dynamic_array(_type, _item) { \
121
+ .type = #_type "[]", .name = #_item, \
122
+ .size = 0, .align = __alignof__(_type), \
123
+ is_signed_type(_type), .filter_type = FILTER_OTHER },
132124
133125 #undef FTRACE_ENTRY
134
-#define FTRACE_ENTRY(name, struct_name, id, tstruct, print, filter) \
135
-static int __init \
136
-ftrace_define_fields_##name(struct trace_event_call *event_call) \
137
-{ \
138
- struct struct_name field; \
139
- int ret; \
140
- int filter_type = filter; \
141
- \
142
- tstruct; \
143
- \
144
- return ret; \
145
-}
126
+#define FTRACE_ENTRY(name, struct_name, id, tstruct, print) \
127
+static struct trace_event_fields ftrace_event_fields_##name[] = { \
128
+ tstruct \
129
+ {} };
146130
147131 #include "trace_entries.h"
148132
....@@ -152,8 +136,14 @@
152136 #undef __field
153137 #define __field(type, item)
154138
139
+#undef __field_fn
140
+#define __field_fn(type, item)
141
+
155142 #undef __field_desc
156143 #define __field_desc(type, container, item)
144
+
145
+#undef __field_packed
146
+#define __field_packed(type, container, item)
157147
158148 #undef __array
159149 #define __array(type, item, len)
....@@ -168,12 +158,10 @@
168158 #define F_printk(fmt, args...) __stringify(fmt) ", " __stringify(args)
169159
170160 #undef FTRACE_ENTRY_REG
171
-#define FTRACE_ENTRY_REG(call, struct_name, etype, tstruct, print, filter,\
172
- regfn) \
173
- \
174
-struct trace_event_class __refdata event_class_ftrace_##call = { \
161
+#define FTRACE_ENTRY_REG(call, struct_name, etype, tstruct, print, regfn) \
162
+static struct trace_event_class __refdata event_class_ftrace_##call = { \
175163 .system = __stringify(TRACE_SYSTEM), \
176
- .define_fields = ftrace_define_fields_##call, \
164
+ .fields_array = ftrace_event_fields_##call, \
177165 .fields = LIST_HEAD_INIT(event_class_ftrace_##call.fields),\
178166 .reg = regfn, \
179167 }; \
....@@ -187,13 +175,13 @@
187175 .print_fmt = print, \
188176 .flags = TRACE_EVENT_FL_IGNORE_ENABLE, \
189177 }; \
190
-struct trace_event_call __used \
191
-__attribute__((section("_ftrace_events"))) *__event_##call = &event_##call;
178
+static struct trace_event_call __used \
179
+__section("_ftrace_events") *__event_##call = &event_##call;
192180
193181 #undef FTRACE_ENTRY
194
-#define FTRACE_ENTRY(call, struct_name, etype, tstruct, print, filter) \
182
+#define FTRACE_ENTRY(call, struct_name, etype, tstruct, print) \
195183 FTRACE_ENTRY_REG(call, struct_name, etype, \
196
- PARAMS(tstruct), PARAMS(print), filter, NULL)
184
+ PARAMS(tstruct), PARAMS(print), NULL)
197185
198186 bool ftrace_event_is_function(struct trace_event_call *call)
199187 {