1 /* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
3 * lttng/tracepoint-event-impl.h
5 * Copyright (C) 2009 Steven Rostedt <rostedt@goodmis.org>
6 * Copyright (C) 2009-2014 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 #include <linux/uaccess.h>
10 #include <linux/debugfs.h>
11 #include <linux/rculist.h>
12 #include <asm/byteorder.h>
13 #include <linux/swab.h>
15 #include <wrapper/vmalloc.h> /* for wrapper_vmalloc_sync_mappings() */
16 #include <ringbuffer/frontend_types.h>
17 #include <ringbuffer/backend.h>
18 #include <wrapper/rcu.h>
19 #include <wrapper/user_namespace.h>
20 #include <lttng/types.h>
21 #include <lttng/probe-user.h>
22 #include <lttng/events.h>
23 #include <lttng/events-internal.h> /* TODO: remove this include after refactoring is done. */
24 #include <lttng/tracer-core.h>
25 #include <lttng/tp-mempool.h>
27 #define __LTTNG_NULL_STRING "(null)"
30 #define PARAMS(args...) args
33 * Macro declarations used for all stages.
37 * LTTng name mapping macros. LTTng remaps some of the kernel events to
38 * enforce name-spacing.
40 #undef LTTNG_TRACEPOINT_EVENT_MAP
41 #define LTTNG_TRACEPOINT_EVENT_MAP(name, map, proto, args, fields) \
42 LTTNG_TRACEPOINT_EVENT_CLASS(map, \
46 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(map, name, map, PARAMS(proto), PARAMS(args))
48 #undef LTTNG_TRACEPOINT_EVENT_MAP_NOARGS
49 #define LTTNG_TRACEPOINT_EVENT_MAP_NOARGS(name, map, fields) \
50 LTTNG_TRACEPOINT_EVENT_CLASS_NOARGS(map, \
52 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP_NOARGS(map, name, map)
54 #undef LTTNG_TRACEPOINT_EVENT_CODE_MAP
55 #define LTTNG_TRACEPOINT_EVENT_CODE_MAP(name, map, proto, args, _locvar, _code_pre, fields, _code_post) \
56 LTTNG_TRACEPOINT_EVENT_CLASS_CODE(map, \
63 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(map, name, map, PARAMS(proto), PARAMS(args))
65 #undef LTTNG_TRACEPOINT_EVENT_CODE
66 #define LTTNG_TRACEPOINT_EVENT_CODE(name, proto, args, _locvar, _code_pre, fields, _code_post) \
67 LTTNG_TRACEPOINT_EVENT_CODE_MAP(name, name, \
76 * LTTNG_TRACEPOINT_EVENT_CLASS can be used to add a generic function
77 * handlers for events. That is, if all events have the same parameters
78 * and just have distinct trace points. Each tracepoint can be defined
79 * with LTTNG_TRACEPOINT_EVENT_INSTANCE and that will map the
80 * LTTNG_TRACEPOINT_EVENT_CLASS to the tracepoint.
82 * LTTNG_TRACEPOINT_EVENT is a one to one mapping between tracepoint and
86 #undef LTTNG_TRACEPOINT_EVENT
87 #define LTTNG_TRACEPOINT_EVENT(name, proto, args, fields) \
88 LTTNG_TRACEPOINT_EVENT_MAP(name, name, \
93 #undef LTTNG_TRACEPOINT_EVENT_NOARGS
94 #define LTTNG_TRACEPOINT_EVENT_NOARGS(name, fields) \
95 LTTNG_TRACEPOINT_EVENT_MAP_NOARGS(name, name, PARAMS(fields))
97 #undef LTTNG_TRACEPOINT_EVENT_INSTANCE
98 #define LTTNG_TRACEPOINT_EVENT_INSTANCE(template, name, proto, args) \
99 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(template, name, name, PARAMS(proto), PARAMS(args))
101 #undef LTTNG_TRACEPOINT_EVENT_INSTANCE_NOARGS
102 #define LTTNG_TRACEPOINT_EVENT_INSTANCE_NOARGS(template, name) \
103 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP_NOARGS(template, name, name)
105 #undef LTTNG_TRACEPOINT_EVENT_CLASS
106 #define LTTNG_TRACEPOINT_EVENT_CLASS(_name, _proto, _args, _fields) \
107 LTTNG_TRACEPOINT_EVENT_CLASS_CODE(_name, PARAMS(_proto), PARAMS(_args), , , \
110 #undef LTTNG_TRACEPOINT_EVENT_CLASS_NOARGS
111 #define LTTNG_TRACEPOINT_EVENT_CLASS_NOARGS(_name, _fields) \
112 LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS(_name, , , PARAMS(_fields), )
116 * Stage 1 of the trace events.
118 * Create dummy trace calls for each events, verifying that the LTTng module
119 * instrumentation headers match the kernel arguments. Will be optimized
120 * out by the compiler.
123 /* Reset all macros within TRACEPOINT_EVENT */
124 #include <lttng/events-reset.h>
127 #define TP_PROTO(...) __VA_ARGS__
130 #define TP_ARGS(...) __VA_ARGS__
132 #undef LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP
133 #define LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(_template, _name, _map, _proto, _args) \
134 void trace_##_name(_proto);
136 #undef LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP_NOARGS
137 #define LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP_NOARGS(_template, _name, _map) \
138 void trace_##_name(void);
140 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
143 * Stage 1.1 of the trace events.
145 * Create dummy trace prototypes for each event class, and for each used
146 * template. This will allow checking whether the prototypes from the
147 * class and the instance using the class actually match.
150 #include <lttng/events-reset.h> /* Reset all macros within TRACE_EVENT */
153 #define TP_PROTO(...) __VA_ARGS__
156 #define TP_ARGS(...) __VA_ARGS__
158 #undef LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP
159 #define LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(_template, _name, _map, _proto, _args) \
160 void __event_template_proto___##_template(_proto);
162 #undef LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP_NOARGS
163 #define LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP_NOARGS(_template, _name, _map) \
164 void __event_template_proto___##_template(void);
166 #undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE
167 #define LTTNG_TRACEPOINT_EVENT_CLASS_CODE(_name, _proto, _args, _locvar, _code_pre, _fields, _code_post) \
168 void __event_template_proto___##_name(_proto);
170 #undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS
171 #define LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS(_name, _locvar, _code_pre, _fields, _code_post) \
172 void __event_template_proto___##_name(void);
174 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
177 * Stage 1.2 of tracepoint event generation
179 * Unfolding the enums
181 #include <lttng/events-reset.h> /* Reset all macros within TRACE_EVENT */
183 /* Enumeration entry (single value) */
184 #undef ctf_enum_value
185 #define ctf_enum_value(_string, _value) \
186 lttng_kernel_static_enum_entry_value(_string, _value)
188 /* Enumeration entry (range) */
189 #undef ctf_enum_range
190 #define ctf_enum_range(_string, _range_start, _range_end) \
191 lttng_kernel_static_enum_entry_range(_string, _range_start, _range_end)
193 /* Enumeration entry (automatic value; follows the rules of CTF) */
195 #define ctf_enum_auto(_string) \
196 lttng_kernel_static_enum_entry_auto(_string)
198 #undef TP_ENUM_VALUES
199 #define TP_ENUM_VALUES(...) \
202 #undef LTTNG_TRACEPOINT_ENUM
203 #define LTTNG_TRACEPOINT_ENUM(_name, _values) \
204 static const struct lttng_kernel_enum_entry *__enum_values__##_name[] = { \
208 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
211 * Stage 2 of the trace events.
213 * Create event field type metadata section.
214 * Each event produce an array of fields.
217 /* Reset all macros within TRACEPOINT_EVENT */
218 #include <lttng/events-reset.h>
219 #include <lttng/events-write.h>
220 #include <lttng/events-nowrite.h>
222 #undef _ctf_integer_ext
223 #define _ctf_integer_ext(_type, _item, _src, _byte_order, _base, _user, _nowrite) \
224 lttng_kernel_static_event_field(#_item, \
225 lttng_kernel_static_type_integer_from_type(_type, _byte_order, _base), \
228 #undef _ctf_array_encoded
229 #define _ctf_array_encoded(_type, _item, _src, _length, \
230 _encoding, _byte_order, _elem_type_base, _user, _nowrite) \
231 lttng_kernel_static_event_field(#_item, \
232 lttng_kernel_static_type_array(_length, \
233 lttng_kernel_static_type_integer_from_type(_type, _byte_order, _elem_type_base), \
238 #undef _ctf_array_bitfield
239 #define _ctf_array_bitfield(_type, _item, _src, _length, _user, _nowrite) \
240 lttng_kernel_static_event_field(#_item, \
241 lttng_kernel_static_type_array((_length) * sizeof(_type) * CHAR_BIT, \
242 lttng_kernel_static_type_integer(1, 1, 0, __LITTLE_ENDIAN, 10), \
243 lttng_alignof(_type), \
247 #undef _ctf_sequence_encoded
248 #define _ctf_sequence_encoded(_type, _item, _src, \
249 _length_type, _src_length, _encoding, \
250 _byte_order, _elem_type_base, _user, _nowrite) \
251 lttng_kernel_static_event_field("_" #_item "_length", \
252 lttng_kernel_static_type_integer_from_type(_length_type, __BYTE_ORDER, 10), \
254 lttng_kernel_static_event_field(#_item, \
255 lttng_kernel_static_type_sequence(NULL, /* Use previous field. */ \
256 lttng_kernel_static_type_integer_from_type(_type, _byte_order, _elem_type_base), \
261 #undef _ctf_sequence_bitfield
262 #define _ctf_sequence_bitfield(_type, _item, _src, \
263 _length_type, _src_length, \
265 lttng_kernel_static_event_field("_" #_item "_length", \
266 lttng_kernel_static_type_integer_from_type(_length_type, __BYTE_ORDER, 10), \
268 lttng_kernel_static_event_field(#_item, \
269 lttng_kernel_static_type_sequence(NULL, /* Use previous field. */ \
270 lttng_kernel_static_type_integer(1, 1, 0, __LITTLE_ENDIAN, 10), \
271 lttng_alignof(_type), \
276 #define _ctf_string(_item, _src, _user, _nowrite) \
277 lttng_kernel_static_event_field(#_item, \
278 lttng_kernel_static_type_string(UTF8), \
282 #define _ctf_unused(_src)
285 #define _ctf_enum(_name, _type, _item, _src, _user, _nowrite) \
286 lttng_kernel_static_event_field(#_item, \
287 lttng_kernel_static_type_enum(&__enum_##_name, \
288 lttng_kernel_static_type_integer_from_type(_type, __BYTE_ORDER, 10)), \
291 #undef ctf_custom_field
292 #define ctf_custom_field(_type, _item, _code) \
293 lttng_kernel_static_event_field(#_item, PARAMS(_type), 0, 0, 1),
295 #undef ctf_custom_type
296 #define ctf_custom_type(...) __VA_ARGS__
299 #define TP_FIELDS(...) __VA_ARGS__ /* Only one used in this phase */
301 #undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS
302 #define LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS(_name, _locvar, _code_pre, _fields, _code_post) \
303 static const struct lttng_kernel_event_field *__event_fields___##_name[] = { \
307 #undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE
308 #define LTTNG_TRACEPOINT_EVENT_CLASS_CODE(_name, _proto, _args, _locvar, _code_pre, _fields, _code_post) \
309 LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS(_name, _locvar, _code_pre, PARAMS(_fields), _code_post)
311 #undef LTTNG_TRACEPOINT_ENUM
312 #define LTTNG_TRACEPOINT_ENUM(_name, _values) \
313 static const struct lttng_kernel_enum_desc __enum_##_name = { \
315 .entries = __enum_values__##_name, \
316 .nr_entries = ARRAY_SIZE(__enum_values__##_name), \
319 #define LTTNG_CREATE_FIELD_METADATA
320 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
321 #undef LTTNG_CREATE_FIELD_METADATA
324 * Stage 3 of the trace events.
326 * Create probe callback prototypes.
329 /* Reset all macros within TRACEPOINT_EVENT */
330 #include <lttng/events-reset.h>
333 #define TP_PROTO(...) __VA_ARGS__
335 #undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE
336 #define LTTNG_TRACEPOINT_EVENT_CLASS_CODE(_name, _proto, _args, _locvar, _code_pre, _fields, _code_post) \
337 static void __event_probe__##_name(void *__data, _proto);
339 #undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS
340 #define LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS(_name, _locvar, _code_pre, _fields, _code_post) \
341 static void __event_probe__##_name(void *__data);
343 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
346 * Stage 4 of the trace events.
348 * Create static inline function that calculates event size.
351 /* Reset all macros within TRACEPOINT_EVENT */
352 #include <lttng/events-reset.h>
353 #include <lttng/events-write.h>
355 #undef _ctf_integer_ext
356 #define _ctf_integer_ext(_type, _item, _src, _byte_order, _base, _user, _nowrite) \
357 __event_len += lib_ring_buffer_align(__event_len, lttng_alignof(_type)); \
358 __event_len += sizeof(_type);
360 #undef _ctf_array_encoded
361 #define _ctf_array_encoded(_type, _item, _src, _length, _encoding, _byte_order, _base, _user, _nowrite) \
362 __event_len += lib_ring_buffer_align(__event_len, lttng_alignof(_type)); \
363 __event_len += sizeof(_type) * (_length);
365 #undef _ctf_array_bitfield
366 #define _ctf_array_bitfield(_type, _item, _src, _length, _user, _nowrite) \
367 _ctf_array_encoded(_type, _item, _src, _length, none, __LITTLE_ENDIAN, 0, _user, _nowrite)
369 #undef _ctf_sequence_encoded
370 #define _ctf_sequence_encoded(_type, _item, _src, _length_type, \
371 _src_length, _encoding, _byte_order, _base, _user, _nowrite) \
372 __event_len += lib_ring_buffer_align(__event_len, lttng_alignof(_length_type)); \
373 __event_len += sizeof(_length_type); \
374 __event_len += lib_ring_buffer_align(__event_len, lttng_alignof(_type)); \
376 size_t __seqlen = (_src_length); \
378 if (unlikely(++this_cpu_ptr(<tng_dynamic_len_stack)->offset >= LTTNG_DYNAMIC_LEN_STACK_SIZE)) \
380 barrier(); /* reserve before use. */ \
381 this_cpu_ptr(<tng_dynamic_len_stack)->stack[this_cpu_ptr(<tng_dynamic_len_stack)->offset - 1] = __seqlen; \
382 __event_len += sizeof(_type) * __seqlen; \
385 #undef _ctf_sequence_bitfield
386 #define _ctf_sequence_bitfield(_type, _item, _src, \
387 _length_type, _src_length, \
389 _ctf_sequence_encoded(_type, _item, _src, _length_type, _src_length, \
390 none, __LITTLE_ENDIAN, 10, _user, _nowrite)
393 * ctf_user_string includes \0. If returns 0, it faulted, so we set size to
397 #define _ctf_string(_item, _src, _user, _nowrite) \
398 if (unlikely(++this_cpu_ptr(<tng_dynamic_len_stack)->offset >= LTTNG_DYNAMIC_LEN_STACK_SIZE)) \
400 barrier(); /* reserve before use. */ \
402 __event_len += this_cpu_ptr(<tng_dynamic_len_stack)->stack[this_cpu_ptr(<tng_dynamic_len_stack)->offset - 1] = \
403 max_t(size_t, lttng_strlen_user_inatomic(_src), 1); \
405 __event_len += this_cpu_ptr(<tng_dynamic_len_stack)->stack[this_cpu_ptr(<tng_dynamic_len_stack)->offset - 1] = \
406 strlen((_src) ? (_src) : __LTTNG_NULL_STRING) + 1; \
410 #define _ctf_enum(_name, _type, _item, _src, _user, _nowrite) \
411 _ctf_integer_ext(_type, _item, _src, __BYTE_ORDER, 10, _user, _nowrite)
414 #define ctf_align(_type) \
415 __event_len += lib_ring_buffer_align(__event_len, lttng_alignof(_type));
417 #undef ctf_custom_field
418 #define ctf_custom_field(_type, _item, _code) \
423 #undef ctf_custom_code
424 #define ctf_custom_code(...) __VA_ARGS__
427 #define TP_PROTO(...) __VA_ARGS__
430 #define TP_FIELDS(...) __VA_ARGS__
433 #define TP_locvar(...) __VA_ARGS__
435 #undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE
436 #define LTTNG_TRACEPOINT_EVENT_CLASS_CODE(_name, _proto, _args, _locvar, _code_pre, _fields, _code_post) \
437 static inline ssize_t __event_get_size__##_name(void *__tp_locvar, _proto) \
439 size_t __event_len = 0; \
440 unsigned int __dynamic_len_idx __attribute__((unused)) = 0; \
441 struct { _locvar } *tp_locvar __attribute__((unused)) = __tp_locvar; \
444 return __event_len; \
447 __attribute__((unused)); \
451 #undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS
452 #define LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS(_name, _locvar, _code_pre, _fields, _code_post) \
453 static inline ssize_t __event_get_size__##_name(void *__tp_locvar) \
455 size_t __event_len = 0; \
456 unsigned int __dynamic_len_idx __attribute__((unused)) = 0; \
457 struct { _locvar } *tp_locvar __attribute__((unused)) = __tp_locvar; \
460 return __event_len; \
463 __attribute__((unused)); \
467 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
471 * Stage 4.1 of tracepoint event generation.
473 * Create static inline function that layout the filter stack data.
474 * We make both write and nowrite data available to the filter.
477 /* Reset all macros within TRACEPOINT_EVENT */
478 #include <lttng/events-reset.h>
479 #include <lttng/events-write.h>
480 #include <lttng/events-nowrite.h>
482 #undef _ctf_integer_ext_fetched
483 #define _ctf_integer_ext_fetched(_type, _item, _src, _byte_order, _base, _nowrite) \
484 if (lttng_is_signed_type(_type)) { \
485 int64_t __ctf_tmp_int64; \
486 switch (sizeof(_type)) { \
489 union { _type t; int8_t v; } __tmp = { (_type) (_src) }; \
490 __ctf_tmp_int64 = (int64_t) __tmp.v; \
495 union { _type t; int16_t v; } __tmp = { (_type) (_src) }; \
496 if (_byte_order != __BYTE_ORDER) \
497 __swab16s(&__tmp.v); \
498 __ctf_tmp_int64 = (int64_t) __tmp.v; \
503 union { _type t; int32_t v; } __tmp = { (_type) (_src) }; \
504 if (_byte_order != __BYTE_ORDER) \
505 __swab32s(&__tmp.v); \
506 __ctf_tmp_int64 = (int64_t) __tmp.v; \
511 union { _type t; int64_t v; } __tmp = { (_type) (_src) }; \
512 if (_byte_order != __BYTE_ORDER) \
513 __swab64s(&__tmp.v); \
514 __ctf_tmp_int64 = (int64_t) __tmp.v; \
520 memcpy(__stack_data, &__ctf_tmp_int64, sizeof(int64_t)); \
522 uint64_t __ctf_tmp_uint64; \
523 switch (sizeof(_type)) { \
526 union { _type t; uint8_t v; } __tmp = { (_type) (_src) }; \
527 __ctf_tmp_uint64 = (uint64_t) __tmp.v; \
532 union { _type t; uint16_t v; } __tmp = { (_type) (_src) }; \
533 if (_byte_order != __BYTE_ORDER) \
534 __swab16s(&__tmp.v); \
535 __ctf_tmp_uint64 = (uint64_t) __tmp.v; \
540 union { _type t; uint32_t v; } __tmp = { (_type) (_src) }; \
541 if (_byte_order != __BYTE_ORDER) \
542 __swab32s(&__tmp.v); \
543 __ctf_tmp_uint64 = (uint64_t) __tmp.v; \
548 union { _type t; uint64_t v; } __tmp = { (_type) (_src) }; \
549 if (_byte_order != __BYTE_ORDER) \
550 __swab64s(&__tmp.v); \
551 __ctf_tmp_uint64 = (uint64_t) __tmp.v; \
557 memcpy(__stack_data, &__ctf_tmp_uint64, sizeof(uint64_t)); \
559 __stack_data += sizeof(int64_t);
561 #undef _ctf_integer_ext_isuser0
562 #define _ctf_integer_ext_isuser0(_type, _item, _src, _byte_order, _base, _nowrite) \
563 _ctf_integer_ext_fetched(_type, _item, _src, _byte_order, _base, _nowrite)
565 #undef _ctf_integer_ext_isuser1
566 #define _ctf_integer_ext_isuser1(_type, _item, _user_src, _byte_order, _base, _nowrite) \
569 char __array[sizeof(_user_src)]; \
570 __typeof__(_user_src) __v; \
572 if (lib_ring_buffer_copy_from_user_check_nofault(__tmp_fetch.__array, \
573 &(_user_src), sizeof(_user_src))) \
574 memset(__tmp_fetch.__array, 0, sizeof(__tmp_fetch.__array)); \
575 _ctf_integer_ext_fetched(_type, _item, __tmp_fetch.__v, _byte_order, _base, _nowrite) \
578 #undef _ctf_integer_ext
579 #define _ctf_integer_ext(_type, _item, _user_src, _byte_order, _base, _user, _nowrite) \
580 _ctf_integer_ext_isuser##_user(_type, _item, _user_src, _byte_order, _base, _nowrite)
582 #undef _ctf_array_encoded
583 #define _ctf_array_encoded(_type, _item, _src, _length, _encoding, _byte_order, _base, _user, _nowrite) \
585 unsigned long __ctf_tmp_ulong = (unsigned long) (_length); \
586 const void *__ctf_tmp_ptr = (_src); \
587 memcpy(__stack_data, &__ctf_tmp_ulong, sizeof(unsigned long)); \
588 __stack_data += sizeof(unsigned long); \
589 memcpy(__stack_data, &__ctf_tmp_ptr, sizeof(void *)); \
590 __stack_data += sizeof(void *); \
593 #undef _ctf_array_bitfield
594 #define _ctf_array_bitfield(_type, _item, _src, _length, _user, _nowrite) \
595 _ctf_array_encoded(_type, _item, _src, _length, none, __LITTLE_ENDIAN, 0, _user, _nowrite)
597 #undef _ctf_sequence_encoded
598 #define _ctf_sequence_encoded(_type, _item, _src, _length_type, \
599 _src_length, _encoding, _byte_order, _base, _user, _nowrite) \
601 unsigned long __ctf_tmp_ulong = (unsigned long) (_src_length); \
602 const void *__ctf_tmp_ptr = (_src); \
603 memcpy(__stack_data, &__ctf_tmp_ulong, sizeof(unsigned long)); \
604 __stack_data += sizeof(unsigned long); \
605 memcpy(__stack_data, &__ctf_tmp_ptr, sizeof(void *)); \
606 __stack_data += sizeof(void *); \
609 #undef _ctf_sequence_bitfield
610 #define _ctf_sequence_bitfield(_type, _item, _src, \
611 _length_type, _src_length, \
613 _ctf_sequence_encoded(_type, _item, _src, _length_type, _src_length, \
614 none, __LITTLE_ENDIAN, 10, _user, _nowrite)
617 #define _ctf_string(_item, _src, _user, _nowrite) \
619 const void *__ctf_tmp_ptr = \
620 ((_src) ? (_src) : __LTTNG_NULL_STRING); \
621 memcpy(__stack_data, &__ctf_tmp_ptr, sizeof(void *)); \
622 __stack_data += sizeof(void *); \
626 #define _ctf_enum(_name, _type, _item, _src, _user, _nowrite) \
627 _ctf_integer_ext(_type, _item, _src, __BYTE_ORDER, 10, _user, _nowrite)
630 #define TP_PROTO(...) __VA_ARGS__
633 #define TP_FIELDS(...) __VA_ARGS__
636 #define TP_locvar(...) __VA_ARGS__
638 #undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS
639 #define LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS(_name, _locvar, _code_pre, _fields, _code_post) \
641 void __event_prepare_interpreter_stack__##_name(char *__stack_data, \
644 struct { _locvar } *tp_locvar __attribute__((unused)) = __tp_locvar; \
649 #undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE
650 #define LTTNG_TRACEPOINT_EVENT_CLASS_CODE(_name, _proto, _args, _locvar, _code_pre, _fields, _code_post) \
652 void __event_prepare_interpreter_stack__##_name(char *__stack_data, \
653 void *__tp_locvar, _proto) \
655 struct { _locvar } *tp_locvar __attribute__((unused)) = __tp_locvar; \
660 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
663 * Stage 5 of the trace events.
665 * Create static inline function that calculates event payload alignment.
668 /* Reset all macros within TRACEPOINT_EVENT */
669 #include <lttng/events-reset.h>
670 #include <lttng/events-write.h>
672 #undef _ctf_integer_ext
673 #define _ctf_integer_ext(_type, _item, _src, _byte_order, _base, _user, _nowrite) \
674 __event_align = max_t(size_t, __event_align, lttng_alignof(_type));
676 #undef _ctf_array_encoded
677 #define _ctf_array_encoded(_type, _item, _src, _length, _encoding, _byte_order, _base, _user, _nowrite) \
678 __event_align = max_t(size_t, __event_align, lttng_alignof(_type));
680 #undef _ctf_array_bitfield
681 #define _ctf_array_bitfield(_type, _item, _src, _length, _user, _nowrite) \
682 _ctf_array_encoded(_type, _item, _src, _length, none, __LITTLE_ENDIAN, 0, _user, _nowrite)
684 #undef _ctf_sequence_encoded
685 #define _ctf_sequence_encoded(_type, _item, _src, _length_type, \
686 _src_length, _encoding, _byte_order, _base, _user, _nowrite) \
687 __event_align = max_t(size_t, __event_align, lttng_alignof(_length_type)); \
688 __event_align = max_t(size_t, __event_align, lttng_alignof(_type));
690 #undef _ctf_sequence_bitfield
691 #define _ctf_sequence_bitfield(_type, _item, _src, \
692 _length_type, _src_length, \
694 _ctf_sequence_encoded(_type, _item, _src, _length_type, _src_length, \
695 none, __LITTLE_ENDIAN, 10, _user, _nowrite)
698 #define _ctf_string(_item, _src, _user, _nowrite)
701 #define _ctf_enum(_name, _type, _item, _src, _user, _nowrite) \
702 _ctf_integer_ext(_type, _item, _src, __BYTE_ORDER, 10, _user, _nowrite)
705 #define ctf_align(_type) \
706 __event_align = max_t(size_t, __event_align, lttng_alignof(_type));
709 #define TP_PROTO(...) __VA_ARGS__
712 #define TP_FIELDS(...) __VA_ARGS__
715 #define TP_locvar(...) __VA_ARGS__
717 #undef ctf_custom_field
718 #define ctf_custom_field(_type, _item, _code) _code
720 #undef ctf_custom_code
721 #define ctf_custom_code(...) \
726 #undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE
727 #define LTTNG_TRACEPOINT_EVENT_CLASS_CODE(_name, _proto, _args, _locvar, _code_pre, _fields, _code_post) \
728 static inline size_t __event_get_align__##_name(void *__tp_locvar, _proto) \
730 size_t __event_align = 1; \
731 struct { _locvar } *tp_locvar __attribute__((unused)) = __tp_locvar; \
734 return __event_align; \
737 #undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS
738 #define LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS(_name, _locvar, _code_pre, _fields, _code_post) \
739 static inline size_t __event_get_align__##_name(void *__tp_locvar) \
741 size_t __event_align = 1; \
742 struct { _locvar } *tp_locvar __attribute__((unused)) = __tp_locvar; \
745 return __event_align; \
748 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
751 * Stage 6 of tracepoint event generation.
753 * Create the probe function. This function calls event size calculation
754 * and writes event data into the buffer.
757 /* Reset all macros within TRACEPOINT_EVENT */
758 #include <lttng/events-reset.h>
759 #include <lttng/events-write.h>
761 #undef _ctf_integer_ext_fetched
762 #define _ctf_integer_ext_fetched(_type, _item, _src, _byte_order, _base, _nowrite) \
764 _type __tmp = _src; \
765 lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(__tmp));\
766 __chan->ops->event_write(&__ctx, &__tmp, sizeof(__tmp));\
769 #undef _ctf_integer_ext_isuser0
770 #define _ctf_integer_ext_isuser0(_type, _item, _src, _byte_order, _base, _nowrite) \
771 _ctf_integer_ext_fetched(_type, _item, _src, _byte_order, _base, _nowrite)
773 #undef _ctf_integer_ext_isuser1
774 #define _ctf_integer_ext_isuser1(_type, _item, _user_src, _byte_order, _base, _nowrite) \
777 char __array[sizeof(_user_src)]; \
778 __typeof__(_user_src) __v; \
780 if (lib_ring_buffer_copy_from_user_check_nofault(__tmp_fetch.__array, \
781 &(_user_src), sizeof(_user_src))) \
782 memset(__tmp_fetch.__array, 0, sizeof(__tmp_fetch.__array)); \
783 _ctf_integer_ext_fetched(_type, _item, __tmp_fetch.__v, _byte_order, _base, _nowrite) \
786 #undef _ctf_integer_ext
787 #define _ctf_integer_ext(_type, _item, _user_src, _byte_order, _base, _user, _nowrite) \
788 _ctf_integer_ext_isuser##_user(_type, _item, _user_src, _byte_order, _base, _nowrite)
790 #undef _ctf_array_encoded
791 #define _ctf_array_encoded(_type, _item, _src, _length, _encoding, _byte_order, _base, _user, _nowrite) \
792 lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(_type)); \
794 __chan->ops->event_write_from_user(&__ctx, _src, sizeof(_type) * (_length)); \
796 __chan->ops->event_write(&__ctx, _src, sizeof(_type) * (_length)); \
799 #if (__BYTE_ORDER == __LITTLE_ENDIAN)
800 #undef _ctf_array_bitfield
801 #define _ctf_array_bitfield(_type, _item, _src, _length, _user, _nowrite) \
802 lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(_type)); \
804 __chan->ops->event_write_from_user(&__ctx, _src, sizeof(_type) * (_length)); \
806 __chan->ops->event_write(&__ctx, _src, sizeof(_type) * (_length)); \
808 #else /* #if (__BYTE_ORDER == __LITTLE_ENDIAN) */
810 * For big endian, we need to byteswap into little endian.
812 #undef _ctf_array_bitfield
813 #define _ctf_array_bitfield(_type, _item, _src, _length, _user, _nowrite) \
814 lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(_type)); \
818 for (_i = 0; _i < (_length); _i++) { \
822 if (get_user(_tmp, (_type *) _src + _i)) \
825 _tmp = ((_type *) _src)[_i]; \
827 switch (sizeof(_type)) { \
831 _tmp = cpu_to_le16(_tmp); \
834 _tmp = cpu_to_le32(_tmp); \
837 _tmp = cpu_to_le64(_tmp); \
842 __chan->ops->event_write(&__ctx, &_tmp, sizeof(_type)); \
845 #endif /* #else #if (__BYTE_ORDER == __LITTLE_ENDIAN) */
847 #undef _ctf_sequence_encoded
848 #define _ctf_sequence_encoded(_type, _item, _src, _length_type, \
849 _src_length, _encoding, _byte_order, _base, _user, _nowrite) \
851 _length_type __tmpl = this_cpu_ptr(<tng_dynamic_len_stack)->stack[__dynamic_len_idx]; \
852 lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(_length_type));\
853 __chan->ops->event_write(&__ctx, &__tmpl, sizeof(_length_type));\
855 lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(_type)); \
857 __chan->ops->event_write_from_user(&__ctx, _src, \
858 sizeof(_type) * __get_dynamic_len(dest)); \
860 __chan->ops->event_write(&__ctx, _src, \
861 sizeof(_type) * __get_dynamic_len(dest)); \
864 #if (__BYTE_ORDER == __LITTLE_ENDIAN)
865 #undef _ctf_sequence_bitfield
866 #define _ctf_sequence_bitfield(_type, _item, _src, \
867 _length_type, _src_length, \
870 _length_type __tmpl = this_cpu_ptr(<tng_dynamic_len_stack)->stack[__dynamic_len_idx] * sizeof(_type) * CHAR_BIT; \
871 lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(_length_type));\
872 __chan->ops->event_write(&__ctx, &__tmpl, sizeof(_length_type));\
874 lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(_type)); \
876 __chan->ops->event_write_from_user(&__ctx, _src, \
877 sizeof(_type) * __get_dynamic_len(dest)); \
879 __chan->ops->event_write(&__ctx, _src, \
880 sizeof(_type) * __get_dynamic_len(dest)); \
882 #else /* #if (__BYTE_ORDER == __LITTLE_ENDIAN) */
884 * For big endian, we need to byteswap into little endian.
886 #undef _ctf_sequence_bitfield
887 #define _ctf_sequence_bitfield(_type, _item, _src, \
888 _length_type, _src_length, \
891 _length_type __tmpl = this_cpu_ptr(<tng_dynamic_len_stack)->stack[__dynamic_len_idx] * sizeof(_type) * CHAR_BIT; \
892 lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(_length_type));\
893 __chan->ops->event_write(&__ctx, &__tmpl, sizeof(_length_type));\
895 lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(_type)); \
897 size_t _i, _length; \
899 _length = __get_dynamic_len(dest); \
900 for (_i = 0; _i < _length; _i++) { \
904 if (get_user(_tmp, (_type *) _src + _i)) \
907 _tmp = ((_type *) _src)[_i]; \
909 switch (sizeof(_type)) { \
913 _tmp = cpu_to_le16(_tmp); \
916 _tmp = cpu_to_le32(_tmp); \
919 _tmp = cpu_to_le64(_tmp); \
924 __chan->ops->event_write(&__ctx, &_tmp, sizeof(_type)); \
927 #endif /* #else #if (__BYTE_ORDER == __LITTLE_ENDIAN) */
930 #define _ctf_string(_item, _src, _user, _nowrite) \
932 lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(*(_src))); \
933 __chan->ops->event_strcpy_from_user(&__ctx, _src, \
934 __get_dynamic_len(dest)); \
936 const char *__ctf_tmp_string = \
937 ((_src) ? (_src) : __LTTNG_NULL_STRING); \
938 lib_ring_buffer_align_ctx(&__ctx, \
939 lttng_alignof(*__ctf_tmp_string)); \
940 __chan->ops->event_strcpy(&__ctx, __ctf_tmp_string, \
941 __get_dynamic_len(dest)); \
945 #define _ctf_enum(_name, _type, _item, _src, _user, _nowrite) \
946 _ctf_integer_ext(_type, _item, _src, __BYTE_ORDER, 10, _user, _nowrite)
949 #define ctf_align(_type) \
950 lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(_type));
952 #undef ctf_custom_field
953 #define ctf_custom_field(_type, _item, _code) _code
955 #undef ctf_custom_code
956 #define ctf_custom_code(...) \
961 /* Beware: this get len actually consumes the len value */
962 #undef __get_dynamic_len
963 #define __get_dynamic_len(field) this_cpu_ptr(<tng_dynamic_len_stack)->stack[__dynamic_len_idx++]
966 #define TP_PROTO(...) __VA_ARGS__
969 #define TP_ARGS(...) __VA_ARGS__
972 #define TP_FIELDS(...) __VA_ARGS__
975 #define TP_locvar(...) __VA_ARGS__
978 #define TP_code_pre(...) __VA_ARGS__
981 #define TP_code_post(...) __VA_ARGS__
984 * For state dump, check that "session" argument (mandatory) matches the
985 * session this event belongs to. Ensures that we write state dump data only
986 * into the started session, not into all sessions.
988 #ifdef TP_SESSION_CHECK
989 #define _TP_SESSION_CHECK(session, csession) (session == csession)
990 #else /* TP_SESSION_CHECK */
991 #define _TP_SESSION_CHECK(session, csession) 1
992 #endif /* TP_SESSION_CHECK */
995 * Using twice size for filter stack data to hold size and pointer for
996 * each field (worse case). For integers, max size required is 64-bit.
997 * Same for double-precision floats. Those fit within
998 * 2*sizeof(unsigned long) for all supported architectures.
999 * Perform UNION (||) of filter runtime list.
1001 #undef _LTTNG_TRACEPOINT_EVENT_CLASS_CODE
1002 #define _LTTNG_TRACEPOINT_EVENT_CLASS_CODE(_name, _data_proto, _locvar_args, _locvar, _code_pre, _fields, _code_post) \
1003 static void __event_probe__##_name(_data_proto) \
1005 struct probe_local_vars { _locvar }; \
1006 struct lttng_kernel_event_common *__event = __data; \
1007 struct lttng_probe_ctx __lttng_probe_ctx = { \
1009 .interruptible = !irqs_disabled(), \
1012 size_t __dynamic_len_removed[ARRAY_SIZE(__event_fields___##_name)]; \
1013 char __interpreter_stack_data[2 * sizeof(unsigned long) * ARRAY_SIZE(__event_fields___##_name)]; \
1015 size_t __orig_dynamic_len_offset, __dynamic_len_idx __attribute__((unused)); \
1016 struct probe_local_vars __tp_locvar; \
1017 struct probe_local_vars *tp_locvar __attribute__((unused)) = \
1019 bool __interpreter_stack_prepared = false; \
1021 switch (__event->type) { \
1022 case LTTNG_KERNEL_EVENT_TYPE_RECORDER: \
1024 struct lttng_kernel_event_recorder *__event_recorder = \
1025 container_of(__event, struct lttng_kernel_event_recorder, parent); \
1026 struct lttng_channel *__chan = __event_recorder->chan; \
1027 struct lttng_session *__session = __chan->session; \
1028 struct lttng_id_tracker_rcu *__lf; \
1030 if (!_TP_SESSION_CHECK(session, __session)) \
1032 if (unlikely(!LTTNG_READ_ONCE(__session->active))) \
1034 if (unlikely(!LTTNG_READ_ONCE(__chan->enabled))) \
1036 __lf = lttng_rcu_dereference(__session->pid_tracker.p); \
1037 if (__lf && likely(!lttng_id_tracker_lookup(__lf, current->tgid))) \
1039 __lf = lttng_rcu_dereference(__session->vpid_tracker.p); \
1040 if (__lf && likely(!lttng_id_tracker_lookup(__lf, task_tgid_vnr(current)))) \
1042 __lf = lttng_rcu_dereference(__session->uid_tracker.p); \
1043 if (__lf && likely(!lttng_id_tracker_lookup(__lf, \
1044 lttng_current_uid()))) \
1046 __lf = lttng_rcu_dereference(__session->vuid_tracker.p); \
1047 if (__lf && likely(!lttng_id_tracker_lookup(__lf, \
1048 lttng_current_vuid()))) \
1050 __lf = lttng_rcu_dereference(__session->gid_tracker.p); \
1051 if (__lf && likely(!lttng_id_tracker_lookup(__lf, \
1052 lttng_current_gid()))) \
1054 __lf = lttng_rcu_dereference(__session->vgid_tracker.p); \
1055 if (__lf && likely(!lttng_id_tracker_lookup(__lf, \
1056 lttng_current_vgid()))) \
1060 case LTTNG_KERNEL_EVENT_TYPE_NOTIFIER: \
1065 if (unlikely(!READ_ONCE(__event->enabled))) \
1067 __orig_dynamic_len_offset = this_cpu_ptr(<tng_dynamic_len_stack)->offset; \
1068 __dynamic_len_idx = __orig_dynamic_len_offset; \
1070 if (unlikely(READ_ONCE(__event->eval_filter))) { \
1071 __event_prepare_interpreter_stack__##_name(__stackvar.__interpreter_stack_data, \
1073 __interpreter_stack_prepared = true; \
1074 if (likely(__event->run_filter(__event, \
1075 __stackvar.__interpreter_stack_data, &__lttng_probe_ctx, NULL) != LTTNG_KERNEL_EVENT_FILTER_ACCEPT)) \
1078 switch (__event->type) { \
1079 case LTTNG_KERNEL_EVENT_TYPE_RECORDER: \
1081 struct lttng_kernel_event_recorder *__event_recorder = \
1082 container_of(__event, struct lttng_kernel_event_recorder, parent); \
1083 struct lttng_channel *__chan = __event_recorder->chan; \
1084 struct lib_ring_buffer_ctx __ctx; \
1085 ssize_t __event_len; \
1086 size_t __event_align; \
1089 __event_len = __event_get_size__##_name(_locvar_args); \
1090 if (unlikely(__event_len < 0)) { \
1091 lib_ring_buffer_lost_event_too_big(__chan->chan); \
1094 __event_align = __event_get_align__##_name(_locvar_args); \
1095 lib_ring_buffer_ctx_init(&__ctx, __event_recorder, __event_len, \
1096 __event_align, &__lttng_probe_ctx); \
1097 __ret = __chan->ops->event_reserve(&__ctx); \
1101 __chan->ops->event_commit(&__ctx); \
1104 case LTTNG_KERNEL_EVENT_TYPE_NOTIFIER: \
1106 struct lttng_kernel_event_notifier *__event_notifier = \
1107 container_of(__event, struct lttng_kernel_event_notifier, parent); \
1108 struct lttng_kernel_notification_ctx __notif_ctx; \
1110 __notif_ctx.eval_capture = LTTNG_READ_ONCE(__event_notifier->eval_capture); \
1111 if (unlikely(!__interpreter_stack_prepared && __notif_ctx.eval_capture)) \
1112 __event_prepare_interpreter_stack__##_name( \
1113 __stackvar.__interpreter_stack_data, \
1116 __event_notifier->notification_send(__event_notifier, \
1117 __stackvar.__interpreter_stack_data, \
1118 &__lttng_probe_ctx, \
1127 barrier(); /* use before un-reserve. */ \
1128 this_cpu_ptr(<tng_dynamic_len_stack)->offset = __orig_dynamic_len_offset; \
1132 #undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE
1133 #define LTTNG_TRACEPOINT_EVENT_CLASS_CODE(_name, _proto, _args, _locvar, _code_pre, _fields, _code_post) \
1134 _LTTNG_TRACEPOINT_EVENT_CLASS_CODE(_name, PARAMS(void *__data, _proto), PARAMS(tp_locvar, _args), \
1135 PARAMS(_locvar), PARAMS(_code_pre), PARAMS(_fields), PARAMS(_code_post))
1137 #undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS
1138 #define LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS(_name, _locvar, _code_pre, _fields, _code_post) \
1139 _LTTNG_TRACEPOINT_EVENT_CLASS_CODE(_name, PARAMS(void *__data), PARAMS(tp_locvar), PARAMS(_locvar), \
1140 PARAMS(_code_pre), PARAMS(_fields), PARAMS(_code_post))
1142 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
1144 #undef __get_dynamic_len
1147 * Stage 7 of the trace events.
1149 * Create event descriptions.
1152 /* Named field types must be defined in lttng-types.h */
1154 #include <lttng/events-reset.h> /* Reset all macros within LTTNG_TRACEPOINT_EVENT */
1157 #define TP_PROBE_CB(_template) &__event_probe__##_template
1160 #undef LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP_NOARGS
1161 #define LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP_NOARGS(_template, _name, _map) \
1162 static const struct lttng_kernel_event_desc __event_desc___##_map = { \
1163 .event_name = #_map, \
1164 .event_kname = #_name, \
1165 .probe_callback = (void (*)(void)) TP_PROBE_CB(_template), \
1166 .fields = __event_fields___##_template, \
1167 .nr_fields = ARRAY_SIZE(__event_fields___##_template), \
1168 .owner = THIS_MODULE, \
1171 #undef LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP
1172 #define LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(_template, _name, _map, _proto, _args) \
1173 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP_NOARGS(_template, _name, _map)
1175 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
1178 * Stage 8 of the trace events.
1180 * Create an array of event description pointers.
1183 #include <lttng/events-reset.h> /* Reset all macros within LTTNG_TRACEPOINT_EVENT */
1185 #undef LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP_NOARGS
1186 #define LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP_NOARGS(_template, _name, _map) \
1187 &__event_desc___##_map,
1189 #undef LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP
1190 #define LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(_template, _name, _map, _proto, _args) \
1191 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP_NOARGS(_template, _name, _map)
1193 #define TP_ID1(_token, _system) _token##_system
1194 #define TP_ID(_token, _system) TP_ID1(_token, _system)
1196 static const struct lttng_kernel_event_desc
*TP_ID(__event_desc___
, TRACE_SYSTEM
)[] = {
1197 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
1204 * Stage 9 of the trace events.
1206 * Create a toplevel descriptor for the whole probe.
1209 #define TP_ID1(_token, _system) _token##_system
1210 #define TP_ID(_token, _system) TP_ID1(_token, _system)
1212 /* non-const because list head will be modified when registered. */
1213 static __used
struct lttng_kernel_probe_desc
TP_ID(__probe_desc___
, TRACE_SYSTEM
) = {
1214 .provider_name
= __stringify(TRACE_SYSTEM
),
1215 .event_desc
= TP_ID(__event_desc___
, TRACE_SYSTEM
),
1216 .nr_events
= ARRAY_SIZE(TP_ID(__event_desc___
, TRACE_SYSTEM
)),
1217 .head
= { NULL
, NULL
},
1218 .lazy_init_head
= { NULL
, NULL
},
1226 * Stage 10 of the trace events.
1228 * Register/unregister probes at module load/unload.
1231 #include <lttng/events-reset.h> /* Reset all macros within LTTNG_TRACEPOINT_EVENT */
1233 #define TP_ID1(_token, _system) _token##_system
1234 #define TP_ID(_token, _system) TP_ID1(_token, _system)
1235 #define module_init_eval1(_token, _system) module_init(_token##_system)
1236 #define module_init_eval(_token, _system) module_init_eval1(_token, _system)
1237 #define module_exit_eval1(_token, _system) module_exit(_token##_system)
1238 #define module_exit_eval(_token, _system) module_exit_eval1(_token, _system)
1240 #ifndef TP_MODULE_NOINIT
1241 static int TP_ID(__lttng_events_init__
, TRACE_SYSTEM
)(void)
1243 wrapper_vmalloc_sync_mappings();
1244 return lttng_probe_register(&TP_ID(__probe_desc___
, TRACE_SYSTEM
));
1247 static void TP_ID(__lttng_events_exit__
, TRACE_SYSTEM
)(void)
1249 lttng_probe_unregister(&TP_ID(__probe_desc___
, TRACE_SYSTEM
));
1252 #ifndef TP_MODULE_NOAUTOLOAD
1253 module_init_eval(__lttng_events_init__
, TRACE_SYSTEM
);
1254 module_exit_eval(__lttng_events_exit__
, TRACE_SYSTEM
);
1259 #undef module_init_eval
1260 #undef module_exit_eval
This page took 0.061196 seconds and 4 git commands to generate.