blob: 3e68366d485af387a1f894bec7e15f491484d3a3 [file] [log] [blame]
Steven Rostedtf42c85e2009-04-13 12:25:37 -04001/*
2 * Stage 1 of the trace events.
3 *
4 * Override the macros in <trace/trace_events.h> to include the following:
5 *
6 * struct ftrace_raw_<call> {
7 * struct trace_entry ent;
8 * <type> <item>;
9 * <type2> <item2>[<len>];
10 * [...]
11 * };
12 *
13 * The <type> <item> is created by the __field(type, item) macro or
14 * the __array(type2, item2, len) macro.
15 * We simply do "type item;", and that will create the fields
16 * in the structure.
17 */
18
19#include <linux/ftrace_event.h>
20
Steven Rostedtff038f52009-11-18 20:27:27 -050021/*
Ingo Molnar091ad362009-11-26 09:04:55 +010022 * DECLARE_EVENT_CLASS can be used to add a generic function
Steven Rostedtff038f52009-11-18 20:27:27 -050023 * handlers for events. That is, if all events have the same
24 * parameters and just have distinct trace points.
25 * Each tracepoint can be defined with DEFINE_EVENT and that
Ingo Molnar091ad362009-11-26 09:04:55 +010026 * will map the DECLARE_EVENT_CLASS to the tracepoint.
Steven Rostedtff038f52009-11-18 20:27:27 -050027 *
28 * TRACE_EVENT is a one to one mapping between tracepoint and template.
29 */
30#undef TRACE_EVENT
31#define TRACE_EVENT(name, proto, args, tstruct, assign, print) \
Ingo Molnar091ad362009-11-26 09:04:55 +010032 DECLARE_EVENT_CLASS(name, \
Steven Rostedtff038f52009-11-18 20:27:27 -050033 PARAMS(proto), \
34 PARAMS(args), \
35 PARAMS(tstruct), \
36 PARAMS(assign), \
37 PARAMS(print)); \
38 DEFINE_EVENT(name, name, PARAMS(proto), PARAMS(args));
39
40
Steven Rostedtf42c85e2009-04-13 12:25:37 -040041#undef __field
42#define __field(type, item) type item;
43
Li Zefan43b51ea2009-08-07 10:33:22 +080044#undef __field_ext
45#define __field_ext(type, item, filter_type) type item;
46
Li Zefan7fcb7c42009-06-01 15:35:46 +080047#undef __array
48#define __array(type, item, len) type item[len];
49
50#undef __dynamic_array
Li Zefan7d536cb2009-07-16 10:54:02 +080051#define __dynamic_array(type, item, len) u32 __data_loc_##item;
Li Zefan7fcb7c42009-06-01 15:35:46 +080052
Frederic Weisbecker9cbf1172009-04-19 04:51:29 +020053#undef __string
Li Zefan7fcb7c42009-06-01 15:35:46 +080054#define __string(item, src) __dynamic_array(char, item, -1)
Frederic Weisbecker9cbf1172009-04-19 04:51:29 +020055
Steven Rostedtf42c85e2009-04-13 12:25:37 -040056#undef TP_STRUCT__entry
57#define TP_STRUCT__entry(args...) args
58
Ingo Molnar091ad362009-11-26 09:04:55 +010059#undef DECLARE_EVENT_CLASS
60#define DECLARE_EVENT_CLASS(name, proto, args, tstruct, assign, print) \
Steven Rostedtff038f52009-11-18 20:27:27 -050061 struct ftrace_raw_##name { \
62 struct trace_entry ent; \
63 tstruct \
64 char __data[0]; \
Steven Rostedt8f082012010-04-20 10:47:33 -040065 }; \
66 \
67 static struct ftrace_event_class event_class_##name;
68
Steven Rostedtff038f52009-11-18 20:27:27 -050069#undef DEFINE_EVENT
70#define DEFINE_EVENT(template, name, proto, args) \
Steven Rostedt49c17742010-05-25 06:19:35 -070071 static struct ftrace_event_call __used \
Jeff Mahoney86c38a32010-02-24 13:59:23 -050072 __attribute__((__aligned__(4))) event_##name
Steven Rostedtf42c85e2009-04-13 12:25:37 -040073
Steven Rostedte5bc9722009-11-18 20:36:26 -050074#undef DEFINE_EVENT_PRINT
75#define DEFINE_EVENT_PRINT(template, name, proto, args, print) \
76 DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args))
77
Josh Stone97419872009-08-24 14:43:13 -070078/* Callbacks are meaningless to ftrace. */
79#undef TRACE_EVENT_FN
Frederic Weisbecker0dd7b742009-08-28 00:50:06 +020080#define TRACE_EVENT_FN(name, proto, args, tstruct, \
81 assign, print, reg, unreg) \
Frederic Weisbecker819ce452010-07-20 18:41:24 +020082 TRACE_EVENT(name, PARAMS(proto), PARAMS(args), \
83 PARAMS(tstruct), PARAMS(assign), PARAMS(print)) \
Josh Stone97419872009-08-24 14:43:13 -070084
Frederic Weisbecker1ed0c592010-11-18 01:46:57 +010085#undef TRACE_EVENT_FLAGS
86#define TRACE_EVENT_FLAGS(name, value) \
Frederic Weisbecker53cf810b2010-11-18 02:11:42 +010087 __TRACE_EVENT_FLAGS(name, value)
Frederic Weisbecker1ed0c592010-11-18 01:46:57 +010088
Steven Rostedtf42c85e2009-04-13 12:25:37 -040089#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
90
Frederic Weisbecker9cbf1172009-04-19 04:51:29 +020091
Steven Rostedtf42c85e2009-04-13 12:25:37 -040092/*
93 * Stage 2 of the trace events.
94 *
Frederic Weisbecker9cbf1172009-04-19 04:51:29 +020095 * Include the following:
96 *
Li Zefan7fcb7c42009-06-01 15:35:46 +080097 * struct ftrace_data_offsets_<call> {
Li Zefan7d536cb2009-07-16 10:54:02 +080098 * u32 <item1>;
99 * u32 <item2>;
Frederic Weisbecker9cbf1172009-04-19 04:51:29 +0200100 * [...]
101 * };
102 *
Li Zefan7d536cb2009-07-16 10:54:02 +0800103 * The __dynamic_array() macro will create each u32 <item>, this is
Li Zefan7fcb7c42009-06-01 15:35:46 +0800104 * to keep the offset of each array from the beginning of the event.
Li Zefan7d536cb2009-07-16 10:54:02 +0800105 * The size of an array is also encoded, in the higher 16 bits of <item>.
Frederic Weisbecker9cbf1172009-04-19 04:51:29 +0200106 */
107
Frederic Weisbecker9cbf1172009-04-19 04:51:29 +0200108#undef __field
Li Zefan43b51ea2009-08-07 10:33:22 +0800109#define __field(type, item)
110
111#undef __field_ext
112#define __field_ext(type, item, filter_type)
Frederic Weisbecker9cbf1172009-04-19 04:51:29 +0200113
Li Zefan7fcb7c42009-06-01 15:35:46 +0800114#undef __array
115#define __array(type, item, len)
116
117#undef __dynamic_array
Li Zefan7d536cb2009-07-16 10:54:02 +0800118#define __dynamic_array(type, item, len) u32 item;
Li Zefan7fcb7c42009-06-01 15:35:46 +0800119
Frederic Weisbecker9cbf1172009-04-19 04:51:29 +0200120#undef __string
Li Zefan7fcb7c42009-06-01 15:35:46 +0800121#define __string(item, src) __dynamic_array(char, item, -1)
Frederic Weisbecker9cbf1172009-04-19 04:51:29 +0200122
Ingo Molnar091ad362009-11-26 09:04:55 +0100123#undef DECLARE_EVENT_CLASS
124#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \
Li Zefan7fcb7c42009-06-01 15:35:46 +0800125 struct ftrace_data_offsets_##call { \
Frederic Weisbecker9cbf1172009-04-19 04:51:29 +0200126 tstruct; \
127 };
128
Steven Rostedtff038f52009-11-18 20:27:27 -0500129#undef DEFINE_EVENT
130#define DEFINE_EVENT(template, name, proto, args)
131
Steven Rostedte5bc9722009-11-18 20:36:26 -0500132#undef DEFINE_EVENT_PRINT
133#define DEFINE_EVENT_PRINT(template, name, proto, args, print) \
134 DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args))
135
Frederic Weisbecker1ed0c592010-11-18 01:46:57 +0100136#undef TRACE_EVENT_FLAGS
137#define TRACE_EVENT_FLAGS(event, flag)
138
Frederic Weisbecker9cbf1172009-04-19 04:51:29 +0200139#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
140
141/*
142 * Stage 3 of the trace events.
143 *
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400144 * Override the macros in <trace/trace_events.h> to include the following:
145 *
146 * enum print_line_t
147 * ftrace_raw_output_<call>(struct trace_iterator *iter, int flags)
148 * {
149 * struct trace_seq *s = &iter->seq;
150 * struct ftrace_raw_<call> *field; <-- defined in stage 1
151 * struct trace_entry *entry;
Lai Jiangshanbc289ae2010-06-03 18:26:24 +0800152 * struct trace_seq *p = &iter->tmp_seq;
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400153 * int ret;
154 *
155 * entry = iter->ent;
156 *
Steven Rostedt32c0eda2010-04-23 10:38:03 -0400157 * if (entry->type != event_<call>->event.type) {
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400158 * WARN_ON_ONCE(1);
159 * return TRACE_TYPE_UNHANDLED;
160 * }
161 *
162 * field = (typeof(field))entry;
163 *
Steven Whitehouse56d8bd32009-06-03 14:52:03 +0100164 * trace_seq_init(p);
Li Zefan50354a82010-03-24 10:58:24 +0800165 * ret = trace_seq_printf(s, "%s: ", <call>);
166 * if (ret)
167 * ret = trace_seq_printf(s, <TP_printk> "\n");
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400168 * if (!ret)
169 * return TRACE_TYPE_PARTIAL_LINE;
170 *
171 * return TRACE_TYPE_HANDLED;
172 * }
173 *
174 * This is the method used to print the raw event to the trace
175 * output format. Note, this is not needed if the data is read
176 * in binary.
177 */
178
179#undef __entry
180#define __entry field
181
182#undef TP_printk
183#define TP_printk(fmt, args...) fmt "\n", args
184
Li Zefan7fcb7c42009-06-01 15:35:46 +0800185#undef __get_dynamic_array
186#define __get_dynamic_array(field) \
Li Zefan7d536cb2009-07-16 10:54:02 +0800187 ((void *)__entry + (__entry->__data_loc_##field & 0xffff))
Li Zefan7fcb7c42009-06-01 15:35:46 +0800188
Frederic Weisbecker9cbf1172009-04-19 04:51:29 +0200189#undef __get_str
Li Zefan7fcb7c42009-06-01 15:35:46 +0800190#define __get_str(field) (char *)__get_dynamic_array(field)
Frederic Weisbecker9cbf1172009-04-19 04:51:29 +0200191
Steven Rostedtbe74b732009-05-26 20:25:22 +0200192#undef __print_flags
193#define __print_flags(flag, delim, flag_array...) \
194 ({ \
Steven Rostedta48f4942009-09-14 11:18:02 -0400195 static const struct trace_print_flags __flags[] = \
Steven Rostedtbe74b732009-05-26 20:25:22 +0200196 { flag_array, { -1, NULL }}; \
Steven Rostedta48f4942009-09-14 11:18:02 -0400197 ftrace_print_flags_seq(p, delim, flag, __flags); \
Steven Rostedtbe74b732009-05-26 20:25:22 +0200198 })
199
Steven Rostedt0f4fc292009-05-20 19:21:47 -0400200#undef __print_symbolic
201#define __print_symbolic(value, symbol_array...) \
202 ({ \
203 static const struct trace_print_flags symbols[] = \
204 { symbol_array, { -1, NULL }}; \
205 ftrace_print_symbols_seq(p, value, symbols); \
206 })
207
Kei Tokunaga5a2e3992010-04-01 20:40:58 +0900208#undef __print_hex
209#define __print_hex(buf, buf_len) ftrace_print_hex_seq(p, buf, buf_len)
210
Ingo Molnar091ad362009-11-26 09:04:55 +0100211#undef DECLARE_EVENT_CLASS
212#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \
Steven Rostedt83f0d532010-02-16 10:38:47 -0500213static notrace enum print_line_t \
Steven Rostedt80decc72010-04-23 10:00:22 -0400214ftrace_raw_output_##call(struct trace_iterator *iter, int flags, \
215 struct trace_event *trace_event) \
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400216{ \
Steven Rostedt80decc72010-04-23 10:00:22 -0400217 struct ftrace_event_call *event; \
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400218 struct trace_seq *s = &iter->seq; \
219 struct ftrace_raw_##call *field; \
220 struct trace_entry *entry; \
Lai Jiangshanbc289ae2010-06-03 18:26:24 +0800221 struct trace_seq *p = &iter->tmp_seq; \
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400222 int ret; \
223 \
Steven Rostedt80decc72010-04-23 10:00:22 -0400224 event = container_of(trace_event, struct ftrace_event_call, \
225 event); \
226 \
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400227 entry = iter->ent; \
228 \
Steven Rostedt32c0eda2010-04-23 10:38:03 -0400229 if (entry->type != event->event.type) { \
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400230 WARN_ON_ONCE(1); \
231 return TRACE_TYPE_UNHANDLED; \
232 } \
233 \
234 field = (typeof(field))entry; \
235 \
Steven Whitehouse56d8bd32009-06-03 14:52:03 +0100236 trace_seq_init(p); \
Steven Rostedt80decc72010-04-23 10:00:22 -0400237 ret = trace_seq_printf(s, "%s: ", event->name); \
Steven Rostedtff038f52009-11-18 20:27:27 -0500238 if (ret) \
239 ret = trace_seq_printf(s, print); \
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400240 if (!ret) \
241 return TRACE_TYPE_PARTIAL_LINE; \
242 \
243 return TRACE_TYPE_HANDLED; \
Steven Rostedt80decc72010-04-23 10:00:22 -0400244} \
245static struct trace_event_functions ftrace_event_type_funcs_##call = { \
246 .trace = ftrace_raw_output_##call, \
247};
Steven Rostedtff038f52009-11-18 20:27:27 -0500248
Steven Rostedte5bc9722009-11-18 20:36:26 -0500249#undef DEFINE_EVENT_PRINT
250#define DEFINE_EVENT_PRINT(template, call, proto, args, print) \
Steven Rostedt83f0d532010-02-16 10:38:47 -0500251static notrace enum print_line_t \
Steven Rostedta9a57762010-04-22 18:46:14 -0400252ftrace_raw_output_##call(struct trace_iterator *iter, int flags, \
253 struct trace_event *event) \
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400254{ \
255 struct trace_seq *s = &iter->seq; \
Steven Rostedte5bc9722009-11-18 20:36:26 -0500256 struct ftrace_raw_##template *field; \
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400257 struct trace_entry *entry; \
Lai Jiangshanbc289ae2010-06-03 18:26:24 +0800258 struct trace_seq *p = &iter->tmp_seq; \
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400259 int ret; \
260 \
261 entry = iter->ent; \
262 \
Steven Rostedt32c0eda2010-04-23 10:38:03 -0400263 if (entry->type != event_##call.event.type) { \
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400264 WARN_ON_ONCE(1); \
265 return TRACE_TYPE_UNHANDLED; \
266 } \
267 \
268 field = (typeof(field))entry; \
269 \
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400270 trace_seq_init(p); \
Steven Rostedte5bc9722009-11-18 20:36:26 -0500271 ret = trace_seq_printf(s, "%s: ", #call); \
272 if (ret) \
273 ret = trace_seq_printf(s, print); \
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400274 if (!ret) \
275 return TRACE_TYPE_PARTIAL_LINE; \
276 \
277 return TRACE_TYPE_HANDLED; \
Steven Rostedt80decc72010-04-23 10:00:22 -0400278} \
279static struct trace_event_functions ftrace_event_type_funcs_##call = { \
280 .trace = ftrace_raw_output_##call, \
281};
Steven Rostedte5bc9722009-11-18 20:36:26 -0500282
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400283#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
284
Li Zefan43b51ea2009-08-07 10:33:22 +0800285#undef __field_ext
286#define __field_ext(type, item, filter_type) \
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400287 ret = trace_define_field(event_call, #type, #item, \
288 offsetof(typeof(field), item), \
Li Zefan43b51ea2009-08-07 10:33:22 +0800289 sizeof(field.item), \
290 is_signed_type(type), filter_type); \
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400291 if (ret) \
292 return ret;
293
Li Zefan43b51ea2009-08-07 10:33:22 +0800294#undef __field
295#define __field(type, item) __field_ext(type, item, FILTER_OTHER)
296
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400297#undef __array
298#define __array(type, item, len) \
Steven Rostedt04295782010-11-12 22:32:11 -0500299 do { \
300 mutex_lock(&event_storage_mutex); \
301 BUILD_BUG_ON(len > MAX_FILTER_STR_VAL); \
302 snprintf(event_storage, sizeof(event_storage), \
303 "%s[%d]", #type, len); \
304 ret = trace_define_field(event_call, event_storage, #item, \
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400305 offsetof(typeof(field), item), \
Lai Jiangshanfb7ae982009-12-15 15:39:38 +0800306 sizeof(field.item), \
307 is_signed_type(type), FILTER_OTHER); \
Steven Rostedt04295782010-11-12 22:32:11 -0500308 mutex_unlock(&event_storage_mutex); \
309 if (ret) \
310 return ret; \
311 } while (0);
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400312
Li Zefan7fcb7c42009-06-01 15:35:46 +0800313#undef __dynamic_array
314#define __dynamic_array(type, item, len) \
Lai Jiangshan68fd60a2009-07-16 10:53:34 +0800315 ret = trace_define_field(event_call, "__data_loc " #type "[]", #item, \
Li Zefan43b51ea2009-08-07 10:33:22 +0800316 offsetof(typeof(field), __data_loc_##item), \
Lai Jiangshanfb7ae982009-12-15 15:39:38 +0800317 sizeof(field.__data_loc_##item), \
318 is_signed_type(type), FILTER_OTHER);
Li Zefan7fcb7c42009-06-01 15:35:46 +0800319
Frederic Weisbecker9cbf1172009-04-19 04:51:29 +0200320#undef __string
Li Zefan7fcb7c42009-06-01 15:35:46 +0800321#define __string(item, src) __dynamic_array(char, item, -1)
Frederic Weisbecker9cbf1172009-04-19 04:51:29 +0200322
Ingo Molnar091ad362009-11-26 09:04:55 +0100323#undef DECLARE_EVENT_CLASS
324#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, func, print) \
Steven Rostedt83f0d532010-02-16 10:38:47 -0500325static int notrace \
Li Zefan14be96c2009-08-19 15:53:52 +0800326ftrace_define_fields_##call(struct ftrace_event_call *event_call) \
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400327{ \
328 struct ftrace_raw_##call field; \
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400329 int ret; \
330 \
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400331 tstruct; \
332 \
333 return ret; \
334}
335
Steven Rostedtff038f52009-11-18 20:27:27 -0500336#undef DEFINE_EVENT
337#define DEFINE_EVENT(template, name, proto, args)
338
Steven Rostedte5bc9722009-11-18 20:36:26 -0500339#undef DEFINE_EVENT_PRINT
340#define DEFINE_EVENT_PRINT(template, name, proto, args, print) \
341 DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args))
342
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400343#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
344
345/*
Li Zefan7fcb7c42009-06-01 15:35:46 +0800346 * remember the offset of each array from the beginning of the event.
347 */
348
349#undef __entry
350#define __entry entry
351
352#undef __field
353#define __field(type, item)
354
Li Zefan43b51ea2009-08-07 10:33:22 +0800355#undef __field_ext
356#define __field_ext(type, item, filter_type)
357
Li Zefan7fcb7c42009-06-01 15:35:46 +0800358#undef __array
359#define __array(type, item, len)
360
361#undef __dynamic_array
362#define __dynamic_array(type, item, len) \
363 __data_offsets->item = __data_size + \
364 offsetof(typeof(*entry), __data); \
Li Zefan7d536cb2009-07-16 10:54:02 +0800365 __data_offsets->item |= (len * sizeof(type)) << 16; \
Li Zefan7fcb7c42009-06-01 15:35:46 +0800366 __data_size += (len) * sizeof(type);
367
368#undef __string
Steven Rostedtff038f52009-11-18 20:27:27 -0500369#define __string(item, src) __dynamic_array(char, item, strlen(src) + 1)
Li Zefan7fcb7c42009-06-01 15:35:46 +0800370
Ingo Molnar091ad362009-11-26 09:04:55 +0100371#undef DECLARE_EVENT_CLASS
372#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \
Steven Rostedt83f0d532010-02-16 10:38:47 -0500373static inline notrace int ftrace_get_offsets_##call( \
Li Zefan7fcb7c42009-06-01 15:35:46 +0800374 struct ftrace_data_offsets_##call *__data_offsets, proto) \
375{ \
376 int __data_size = 0; \
377 struct ftrace_raw_##call __maybe_unused *entry; \
378 \
379 tstruct; \
380 \
381 return __data_size; \
382}
383
Steven Rostedtff038f52009-11-18 20:27:27 -0500384#undef DEFINE_EVENT
385#define DEFINE_EVENT(template, name, proto, args)
386
Steven Rostedte5bc9722009-11-18 20:36:26 -0500387#undef DEFINE_EVENT_PRINT
388#define DEFINE_EVENT_PRINT(template, name, proto, args, print) \
389 DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args))
390
Li Zefan7fcb7c42009-06-01 15:35:46 +0800391#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
392
393/*
Frederic Weisbecker9cbf1172009-04-19 04:51:29 +0200394 * Stage 4 of the trace events.
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400395 *
396 * Override the macros in <trace/trace_events.h> to include the following:
397 *
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400398 * For those macros defined with TRACE_EVENT:
399 *
400 * static struct ftrace_event_call event_<call>;
401 *
Steven Rostedt22392912010-04-21 12:27:06 -0400402 * static void ftrace_raw_event_<call>(void *__data, proto)
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400403 * {
Steven Rostedt22392912010-04-21 12:27:06 -0400404 * struct ftrace_event_call *event_call = __data;
Li Zefan50354a82010-03-24 10:58:24 +0800405 * struct ftrace_data_offsets_<call> __maybe_unused __data_offsets;
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400406 * struct ring_buffer_event *event;
407 * struct ftrace_raw_<call> *entry; <-- defined in stage 1
Steven Rostedte77405a2009-09-02 14:17:06 -0400408 * struct ring_buffer *buffer;
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400409 * unsigned long irq_flags;
Li Zefan50354a82010-03-24 10:58:24 +0800410 * int __data_size;
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400411 * int pc;
412 *
413 * local_save_flags(irq_flags);
414 * pc = preempt_count();
415 *
Li Zefan50354a82010-03-24 10:58:24 +0800416 * __data_size = ftrace_get_offsets_<call>(&__data_offsets, args);
417 *
Steven Rostedte77405a2009-09-02 14:17:06 -0400418 * event = trace_current_buffer_lock_reserve(&buffer,
Steven Rostedt32c0eda2010-04-23 10:38:03 -0400419 * event_<call>->event.type,
Li Zefan50354a82010-03-24 10:58:24 +0800420 * sizeof(*entry) + __data_size,
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400421 * irq_flags, pc);
422 * if (!event)
423 * return;
424 * entry = ring_buffer_event_data(event);
425 *
Li Zefan50354a82010-03-24 10:58:24 +0800426 * { <assign>; } <-- Here we assign the entries by the __field and
427 * __array macros.
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400428 *
Li Zefan50354a82010-03-24 10:58:24 +0800429 * if (!filter_current_check_discard(buffer, event_call, entry, event))
430 * trace_current_buffer_unlock_commit(buffer,
431 * event, irq_flags, pc);
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400432 * }
433 *
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400434 * static struct trace_event ftrace_event_type_<call> = {
435 * .trace = ftrace_raw_output_<call>, <-- stage 2
436 * };
437 *
Li Zefan50354a82010-03-24 10:58:24 +0800438 * static const char print_fmt_<call>[] = <TP_printk>;
439 *
Steven Rostedt8f082012010-04-20 10:47:33 -0400440 * static struct ftrace_event_class __used event_class_<template> = {
441 * .system = "<system>",
Steven Rostedt2e33af02010-04-22 10:35:55 -0400442 * .define_fields = ftrace_define_fields_<call>,
Steven Rostedt0405ab82010-04-22 11:46:44 -0400443 * .fields = LIST_HEAD_INIT(event_class_##call.fields),
444 * .raw_init = trace_event_raw_init,
445 * .probe = ftrace_raw_event_##call,
Steven Rostedta1d0ce82010-06-08 11:22:06 -0400446 * .reg = ftrace_event_reg,
Steven Rostedt8f082012010-04-20 10:47:33 -0400447 * };
448 *
Steven Rostedte4a9ea52011-01-27 09:15:30 -0500449 * static struct ftrace_event_call event_<call> = {
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400450 * .name = "<call>",
Steven Rostedt8f082012010-04-20 10:47:33 -0400451 * .class = event_class_<template>,
Steven Rostedt2e33af02010-04-22 10:35:55 -0400452 * .event = &ftrace_event_type_<call>,
Li Zefan50354a82010-03-24 10:58:24 +0800453 * .print_fmt = print_fmt_<call>,
Steven Rostedt8f082012010-04-20 10:47:33 -0400454 * };
Steven Rostedte4a9ea52011-01-27 09:15:30 -0500455 * // its only safe to use pointers when doing linker tricks to
456 * // create an array.
457 * static struct ftrace_event_call __used
458 * __attribute__((section("_ftrace_events"))) *__event_<call> = &event_<call>;
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400459 *
460 */
461
Li Zefan07b139c2009-12-21 14:27:35 +0800462#ifdef CONFIG_PERF_EVENTS
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400463
Steven Rostedt22392912010-04-21 12:27:06 -0400464#define _TRACE_PERF_PROTO(call, proto) \
465 static notrace void \
466 perf_trace_##call(void *__data, proto);
467
Frederic Weisbecker97d5a222010-03-05 05:35:37 +0100468#define _TRACE_PERF_INIT(call) \
Steven Rostedt22392912010-04-21 12:27:06 -0400469 .perf_probe = perf_trace_##call,
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400470
471#else
Steven Rostedt22392912010-04-21 12:27:06 -0400472#define _TRACE_PERF_PROTO(call, proto)
Frederic Weisbecker97d5a222010-03-05 05:35:37 +0100473#define _TRACE_PERF_INIT(call)
Li Zefan07b139c2009-12-21 14:27:35 +0800474#endif /* CONFIG_PERF_EVENTS */
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400475
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400476#undef __entry
477#define __entry entry
478
Frederic Weisbecker9cbf1172009-04-19 04:51:29 +0200479#undef __field
480#define __field(type, item)
481
482#undef __array
483#define __array(type, item, len)
484
Li Zefan7fcb7c42009-06-01 15:35:46 +0800485#undef __dynamic_array
486#define __dynamic_array(type, item, len) \
487 __entry->__data_loc_##item = __data_offsets.item;
488
Frederic Weisbecker9cbf1172009-04-19 04:51:29 +0200489#undef __string
Li Zefan7fcb7c42009-06-01 15:35:46 +0800490#define __string(item, src) __dynamic_array(char, item, -1) \
Frederic Weisbecker9cbf1172009-04-19 04:51:29 +0200491
492#undef __assign_str
493#define __assign_str(dst, src) \
Frederic Weisbecker9cbf1172009-04-19 04:51:29 +0200494 strcpy(__get_str(dst), src);
495
Lai Jiangshan0fa0eda2009-12-15 15:39:57 +0800496#undef TP_fast_assign
497#define TP_fast_assign(args...) args
498
499#undef TP_perf_assign
500#define TP_perf_assign(args...)
501
Ingo Molnar091ad362009-11-26 09:04:55 +0100502#undef DECLARE_EVENT_CLASS
503#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400504 \
Steven Rostedt83f0d532010-02-16 10:38:47 -0500505static notrace void \
Steven Rostedt22392912010-04-21 12:27:06 -0400506ftrace_raw_event_##call(void *__data, proto) \
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400507{ \
Steven Rostedt22392912010-04-21 12:27:06 -0400508 struct ftrace_event_call *event_call = __data; \
Li Zefan7fcb7c42009-06-01 15:35:46 +0800509 struct ftrace_data_offsets_##call __maybe_unused __data_offsets;\
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400510 struct ring_buffer_event *event; \
511 struct ftrace_raw_##call *entry; \
Steven Rostedte77405a2009-09-02 14:17:06 -0400512 struct ring_buffer *buffer; \
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400513 unsigned long irq_flags; \
Li Zefan7fcb7c42009-06-01 15:35:46 +0800514 int __data_size; \
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400515 int pc; \
516 \
517 local_save_flags(irq_flags); \
518 pc = preempt_count(); \
519 \
Li Zefan7fcb7c42009-06-01 15:35:46 +0800520 __data_size = ftrace_get_offsets_##call(&__data_offsets, args); \
Frederic Weisbecker9cbf1172009-04-19 04:51:29 +0200521 \
Steven Rostedte77405a2009-09-02 14:17:06 -0400522 event = trace_current_buffer_lock_reserve(&buffer, \
Steven Rostedt32c0eda2010-04-23 10:38:03 -0400523 event_call->event.type, \
Li Zefan7fcb7c42009-06-01 15:35:46 +0800524 sizeof(*entry) + __data_size, \
Frederic Weisbecker9cbf1172009-04-19 04:51:29 +0200525 irq_flags, pc); \
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400526 if (!event) \
527 return; \
528 entry = ring_buffer_event_data(event); \
529 \
Li Zefan7fcb7c42009-06-01 15:35:46 +0800530 tstruct \
531 \
Li Zefana9c1c3a2009-06-01 15:35:13 +0800532 { assign; } \
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400533 \
Steven Rostedte77405a2009-09-02 14:17:06 -0400534 if (!filter_current_check_discard(buffer, event_call, entry, event)) \
535 trace_nowake_buffer_unlock_commit(buffer, \
536 event, irq_flags, pc); \
Steven Rostedtff038f52009-11-18 20:27:27 -0500537}
Steven Rostedt22392912010-04-21 12:27:06 -0400538/*
539 * The ftrace_test_probe is compiled out, it is only here as a build time check
540 * to make sure that if the tracepoint handling changes, the ftrace probe will
541 * fail to compile unless it too is updated.
542 */
Steven Rostedtff038f52009-11-18 20:27:27 -0500543
544#undef DEFINE_EVENT
545#define DEFINE_EVENT(template, call, proto, args) \
Steven Rostedt22392912010-04-21 12:27:06 -0400546static inline void ftrace_test_probe_##call(void) \
Steven Rostedtff038f52009-11-18 20:27:27 -0500547{ \
Steven Rostedt22392912010-04-21 12:27:06 -0400548 check_trace_callback_type_##call(ftrace_raw_event_##template); \
549}
Steven Rostedte5bc9722009-11-18 20:36:26 -0500550
551#undef DEFINE_EVENT_PRINT
Steven Rostedt80decc72010-04-23 10:00:22 -0400552#define DEFINE_EVENT_PRINT(template, name, proto, args, print)
Steven Rostedte5bc9722009-11-18 20:36:26 -0500553
554#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
555
Lai Jiangshan509e7602009-12-15 15:39:42 +0800556#undef __entry
557#define __entry REC
558
559#undef __print_flags
560#undef __print_symbolic
561#undef __get_dynamic_array
562#undef __get_str
563
564#undef TP_printk
565#define TP_printk(fmt, args...) "\"" fmt "\", " __stringify(args)
566
Ingo Molnar091ad362009-11-26 09:04:55 +0100567#undef DECLARE_EVENT_CLASS
Lai Jiangshan509e7602009-12-15 15:39:42 +0800568#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \
Steven Rostedt22392912010-04-21 12:27:06 -0400569_TRACE_PERF_PROTO(call, PARAMS(proto)); \
Steven Rostedt8f082012010-04-20 10:47:33 -0400570static const char print_fmt_##call[] = print; \
571static struct ftrace_event_class __used event_class_##call = { \
Steven Rostedt22392912010-04-21 12:27:06 -0400572 .system = __stringify(TRACE_SYSTEM), \
Steven Rostedt2e33af02010-04-22 10:35:55 -0400573 .define_fields = ftrace_define_fields_##call, \
574 .fields = LIST_HEAD_INIT(event_class_##call.fields),\
Steven Rostedt0405ab82010-04-22 11:46:44 -0400575 .raw_init = trace_event_raw_init, \
Steven Rostedt22392912010-04-21 12:27:06 -0400576 .probe = ftrace_raw_event_##call, \
Steven Rostedta1d0ce82010-06-08 11:22:06 -0400577 .reg = ftrace_event_reg, \
Steven Rostedt22392912010-04-21 12:27:06 -0400578 _TRACE_PERF_INIT(call) \
Steven Rostedt8f082012010-04-20 10:47:33 -0400579};
Steven Rostedte5bc9722009-11-18 20:36:26 -0500580
581#undef DEFINE_EVENT
582#define DEFINE_EVENT(template, call, proto, args) \
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400583 \
Steven Rostedte4a9ea52011-01-27 09:15:30 -0500584static struct ftrace_event_call __used event_##call = { \
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400585 .name = #call, \
Steven Rostedt8f082012010-04-20 10:47:33 -0400586 .class = &event_class_##template, \
Steven Rostedt80decc72010-04-23 10:00:22 -0400587 .event.funcs = &ftrace_event_type_funcs_##template, \
Lai Jiangshan509e7602009-12-15 15:39:42 +0800588 .print_fmt = print_fmt_##template, \
Steven Rostedte4a9ea52011-01-27 09:15:30 -0500589}; \
590static struct ftrace_event_call __used \
591__attribute__((section("_ftrace_events"))) *__event_##call = &event_##call
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400592
Steven Rostedte5bc9722009-11-18 20:36:26 -0500593#undef DEFINE_EVENT_PRINT
594#define DEFINE_EVENT_PRINT(template, call, proto, args, print) \
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400595 \
Lai Jiangshan509e7602009-12-15 15:39:42 +0800596static const char print_fmt_##call[] = print; \
597 \
Steven Rostedte4a9ea52011-01-27 09:15:30 -0500598static struct ftrace_event_call __used event_##call = { \
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400599 .name = #call, \
Steven Rostedt8f082012010-04-20 10:47:33 -0400600 .class = &event_class_##template, \
Steven Rostedt80decc72010-04-23 10:00:22 -0400601 .event.funcs = &ftrace_event_type_funcs_##call, \
Lai Jiangshan509e7602009-12-15 15:39:42 +0800602 .print_fmt = print_fmt_##call, \
Steven Rostedte4a9ea52011-01-27 09:15:30 -0500603}; \
604static struct ftrace_event_call __used \
605__attribute__((section("_ftrace_events"))) *__event_##call = &event_##call
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400606
607#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
608
Frederic Weisbeckerf413cdb2009-08-07 01:25:54 +0200609/*
Frederic Weisbecker97d5a222010-03-05 05:35:37 +0100610 * Define the insertion callback to perf events
Frederic Weisbeckerf413cdb2009-08-07 01:25:54 +0200611 *
612 * The job is very similar to ftrace_raw_event_<call> except that we don't
613 * insert in the ring buffer but in a perf counter.
614 *
Frederic Weisbecker97d5a222010-03-05 05:35:37 +0100615 * static void ftrace_perf_<call>(proto)
Frederic Weisbeckerf413cdb2009-08-07 01:25:54 +0200616 * {
617 * struct ftrace_data_offsets_<call> __maybe_unused __data_offsets;
618 * struct ftrace_event_call *event_call = &event_<call>;
Ingo Molnarcdd6c482009-09-21 12:02:48 +0200619 * extern void perf_tp_event(int, u64, u64, void *, int);
Frederic Weisbeckerf413cdb2009-08-07 01:25:54 +0200620 * struct ftrace_raw_##call *entry;
Frederic Weisbecker444a2a32009-11-06 04:13:05 +0100621 * struct perf_trace_buf *trace_buf;
Frederic Weisbeckerf413cdb2009-08-07 01:25:54 +0200622 * u64 __addr = 0, __count = 1;
623 * unsigned long irq_flags;
Frederic Weisbecker20ab44252009-09-18 06:10:28 +0200624 * struct trace_entry *ent;
Frederic Weisbeckerf413cdb2009-08-07 01:25:54 +0200625 * int __entry_size;
626 * int __data_size;
Frederic Weisbecker20ab44252009-09-18 06:10:28 +0200627 * int __cpu
Frederic Weisbeckerf413cdb2009-08-07 01:25:54 +0200628 * int pc;
629 *
Frederic Weisbeckerf413cdb2009-08-07 01:25:54 +0200630 * pc = preempt_count();
631 *
632 * __data_size = ftrace_get_offsets_<call>(&__data_offsets, args);
Frederic Weisbecker304703a2009-08-10 16:11:32 +0200633 *
634 * // Below we want to get the aligned size by taking into account
635 * // the u32 field that will later store the buffer size
636 * __entry_size = ALIGN(__data_size + sizeof(*entry) + sizeof(u32),
637 * sizeof(u64));
638 * __entry_size -= sizeof(u32);
Frederic Weisbeckerf413cdb2009-08-07 01:25:54 +0200639 *
Frederic Weisbecker20ab44252009-09-18 06:10:28 +0200640 * // Protect the non nmi buffer
641 * // This also protects the rcu read side
642 * local_irq_save(irq_flags);
643 * __cpu = smp_processor_id();
Frederic Weisbeckerf413cdb2009-08-07 01:25:54 +0200644 *
Frederic Weisbecker20ab44252009-09-18 06:10:28 +0200645 * if (in_nmi())
Paul E. McKenney8d53dd52010-03-03 17:50:18 -0800646 * trace_buf = rcu_dereference_sched(perf_trace_buf_nmi);
Frederic Weisbecker20ab44252009-09-18 06:10:28 +0200647 * else
Paul E. McKenney8d53dd52010-03-03 17:50:18 -0800648 * trace_buf = rcu_dereference_sched(perf_trace_buf);
Frederic Weisbecker1853db02009-08-10 16:38:36 +0200649 *
Frederic Weisbecker444a2a32009-11-06 04:13:05 +0100650 * if (!trace_buf)
Frederic Weisbecker20ab44252009-09-18 06:10:28 +0200651 * goto end;
Frederic Weisbeckerf413cdb2009-08-07 01:25:54 +0200652 *
Frederic Weisbecker444a2a32009-11-06 04:13:05 +0100653 * trace_buf = per_cpu_ptr(trace_buf, __cpu);
654 *
655 * // Avoid recursion from perf that could mess up the buffer
656 * if (trace_buf->recursion++)
657 * goto end_recursion;
658 *
659 * raw_data = trace_buf->buf;
660 *
661 * // Make recursion update visible before entering perf_tp_event
662 * // so that we protect from perf recursions.
663 *
664 * barrier();
Frederic Weisbeckerf413cdb2009-08-07 01:25:54 +0200665 *
Frederic Weisbecker20ab44252009-09-18 06:10:28 +0200666 * //zero dead bytes from alignment to avoid stack leak to userspace:
667 * *(u64 *)(&raw_data[__entry_size - sizeof(u64)]) = 0ULL;
668 * entry = (struct ftrace_raw_<call> *)raw_data;
669 * ent = &entry->ent;
670 * tracing_generic_entry_update(ent, irq_flags, pc);
671 * ent->type = event_call->id;
Frederic Weisbeckerf413cdb2009-08-07 01:25:54 +0200672 *
Frederic Weisbecker20ab44252009-09-18 06:10:28 +0200673 * <tstruct> <- do some jobs with dynamic arrays
674 *
675 * <assign> <- affect our values
676 *
Linus Torvalds43c12662009-09-21 09:15:07 -0700677 * perf_tp_event(event_call->id, __addr, __count, entry,
Frederic Weisbecker20ab44252009-09-18 06:10:28 +0200678 * __entry_size); <- submit them to perf counter
Frederic Weisbeckerf413cdb2009-08-07 01:25:54 +0200679 *
680 * }
681 */
682
Li Zefan07b139c2009-12-21 14:27:35 +0800683#ifdef CONFIG_PERF_EVENTS
Frederic Weisbeckerf413cdb2009-08-07 01:25:54 +0200684
Lai Jiangshan509e7602009-12-15 15:39:42 +0800685#undef __entry
686#define __entry entry
687
688#undef __get_dynamic_array
689#define __get_dynamic_array(field) \
690 ((void *)__entry + (__entry->__data_loc_##field & 0xffff))
691
692#undef __get_str
693#define __get_str(field) (char *)__get_dynamic_array(field)
694
Frederic Weisbeckerf413cdb2009-08-07 01:25:54 +0200695#undef __perf_addr
696#define __perf_addr(a) __addr = (a)
697
698#undef __perf_count
699#define __perf_count(c) __count = (c)
700
Ingo Molnar091ad362009-11-26 09:04:55 +0100701#undef DECLARE_EVENT_CLASS
702#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \
Steven Rostedt83f0d532010-02-16 10:38:47 -0500703static notrace void \
Steven Rostedt22392912010-04-21 12:27:06 -0400704perf_trace_##call(void *__data, proto) \
Frederic Weisbeckerf413cdb2009-08-07 01:25:54 +0200705{ \
Steven Rostedt22392912010-04-21 12:27:06 -0400706 struct ftrace_event_call *event_call = __data; \
Frederic Weisbeckerf413cdb2009-08-07 01:25:54 +0200707 struct ftrace_data_offsets_##call __maybe_unused __data_offsets;\
Frederic Weisbeckerf413cdb2009-08-07 01:25:54 +0200708 struct ftrace_raw_##call *entry; \
Steven Rostedtff5f1492010-05-21 11:49:57 -0400709 struct pt_regs __regs; \
Frederic Weisbeckerf413cdb2009-08-07 01:25:54 +0200710 u64 __addr = 0, __count = 1; \
Peter Zijlstra1c024eca2010-05-19 14:02:22 +0200711 struct hlist_head *head; \
Frederic Weisbeckerf413cdb2009-08-07 01:25:54 +0200712 int __entry_size; \
713 int __data_size; \
Peter Zijlstra4ed7c922009-11-23 11:37:29 +0100714 int rctx; \
Frederic Weisbeckerf413cdb2009-08-07 01:25:54 +0200715 \
Frederic Weisbeckerb0f82b82010-05-20 07:47:21 +0200716 perf_fetch_caller_regs(&__regs); \
Steven Rostedtf0218b32010-05-17 22:26:53 -0400717 \
Frederic Weisbeckerf413cdb2009-08-07 01:25:54 +0200718 __data_size = ftrace_get_offsets_##call(&__data_offsets, args); \
Peter Zijlstraa0445602009-08-10 11:16:52 +0200719 __entry_size = ALIGN(__data_size + sizeof(*entry) + sizeof(u32),\
720 sizeof(u64)); \
Frederic Weisbecker304703a2009-08-10 16:11:32 +0200721 __entry_size -= sizeof(u32); \
Frederic Weisbeckerf413cdb2009-08-07 01:25:54 +0200722 \
Frederic Weisbecker97d5a222010-03-05 05:35:37 +0100723 if (WARN_ONCE(__entry_size > PERF_MAX_TRACE_SIZE, \
Frederic Weisbecker20ab44252009-09-18 06:10:28 +0200724 "profile buffer not large enough")) \
725 return; \
Peter Zijlstrab7e2ece2010-05-19 10:52:27 +0200726 \
Frederic Weisbecker97d5a222010-03-05 05:35:37 +0100727 entry = (struct ftrace_raw_##call *)perf_trace_buf_prepare( \
Steven Rostedtff5f1492010-05-21 11:49:57 -0400728 __entry_size, event_call->event.type, &__regs, &rctx); \
Xiao Guangrong430ad5a2010-01-28 09:32:29 +0800729 if (!entry) \
730 return; \
Peter Zijlstrab7e2ece2010-05-19 10:52:27 +0200731 \
Frederic Weisbecker20ab44252009-09-18 06:10:28 +0200732 tstruct \
733 \
734 { assign; } \
735 \
Peter Zijlstra3771f072010-05-21 12:31:09 +0200736 head = this_cpu_ptr(event_call->perf_events); \
Frederic Weisbecker97d5a222010-03-05 05:35:37 +0100737 perf_trace_buf_submit(entry, __entry_size, rctx, __addr, \
Steven Rostedtff5f1492010-05-21 11:49:57 -0400738 __count, &__regs, head); \
Frederic Weisbeckerf413cdb2009-08-07 01:25:54 +0200739}
740
Steven Rostedt22392912010-04-21 12:27:06 -0400741/*
742 * This part is compiled out, it is only here as a build time check
743 * to make sure that if the tracepoint handling changes, the
744 * perf probe will fail to compile unless it too is updated.
745 */
Steven Rostedtff038f52009-11-18 20:27:27 -0500746#undef DEFINE_EVENT
Frederic Weisbecker6cc8a7c2010-03-19 01:23:53 +0100747#define DEFINE_EVENT(template, call, proto, args) \
Steven Rostedt22392912010-04-21 12:27:06 -0400748static inline void perf_test_probe_##call(void) \
Frederic Weisbecker6cc8a7c2010-03-19 01:23:53 +0100749{ \
Steven Rostedt22392912010-04-21 12:27:06 -0400750 check_trace_callback_type_##call(perf_trace_##template); \
Steven Rostedtff038f52009-11-18 20:27:27 -0500751}
752
Steven Rostedt22392912010-04-21 12:27:06 -0400753
Steven Rostedte5bc9722009-11-18 20:36:26 -0500754#undef DEFINE_EVENT_PRINT
755#define DEFINE_EVENT_PRINT(template, name, proto, args, print) \
756 DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args))
757
Frederic Weisbeckerf413cdb2009-08-07 01:25:54 +0200758#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
Li Zefan07b139c2009-12-21 14:27:35 +0800759#endif /* CONFIG_PERF_EVENTS */
Frederic Weisbeckerf413cdb2009-08-07 01:25:54 +0200760
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400761#undef _TRACE_PROFILE_INIT
762