2 * lttng-tracepoint-event-impl.h
4 * Copyright (C) 2009 Steven Rostedt <rostedt@goodmis.org>
5 * Copyright (C) 2009-2014 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; only
10 * version 2.1 of the License.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 #include <linux/uaccess.h>
23 #include <linux/debugfs.h>
24 #include <linux/rculist.h>
25 #include <asm/byteorder.h>
26 #include <linux/swab.h>
28 #include <probes/lttng.h>
29 #include <probes/lttng-types.h>
30 #include <probes/lttng-probe-user.h>
31 #include <wrapper/vmalloc.h> /* for wrapper_vmalloc_sync_all() */
32 #include <wrapper/ringbuffer/frontend_types.h>
33 #include <wrapper/ringbuffer/backend.h>
34 #include <wrapper/rcu.h>
35 #include <lttng-events.h>
36 #include <lttng-tracer-core.h>
39 * Macro declarations used for all stages.
43 * LTTng name mapping macros. LTTng remaps some of the kernel events to
44 * enforce name-spacing.
46 #undef LTTNG_TRACEPOINT_EVENT_MAP
47 #define LTTNG_TRACEPOINT_EVENT_MAP(name, map, proto, args, fields) \
48 LTTNG_TRACEPOINT_EVENT_CLASS(map, \
52 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(map, name, map, PARAMS(proto), PARAMS(args))
54 #undef LTTNG_TRACEPOINT_EVENT_MAP_NOARGS
55 #define LTTNG_TRACEPOINT_EVENT_MAP_NOARGS(name, map, fields) \
56 LTTNG_TRACEPOINT_EVENT_CLASS_NOARGS(map, \
58 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP_NOARGS(map, name, map)
60 #undef LTTNG_TRACEPOINT_EVENT_CODE_MAP
61 #define LTTNG_TRACEPOINT_EVENT_CODE_MAP(name, map, proto, args, _locvar, _code_pre, fields, _code_post) \
62 LTTNG_TRACEPOINT_EVENT_CLASS_CODE(map, \
69 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(map, name, map, PARAMS(proto), PARAMS(args))
71 #undef LTTNG_TRACEPOINT_EVENT_CODE
72 #define LTTNG_TRACEPOINT_EVENT_CODE(name, proto, args, _locvar, _code_pre, fields, _code_post) \
73 LTTNG_TRACEPOINT_EVENT_CODE_MAP(name, name, \
82 * LTTNG_TRACEPOINT_EVENT_CLASS can be used to add a generic function
83 * handlers for events. That is, if all events have the same parameters
84 * and just have distinct trace points. Each tracepoint can be defined
85 * with LTTNG_TRACEPOINT_EVENT_INSTANCE and that will map the
86 * LTTNG_TRACEPOINT_EVENT_CLASS to the tracepoint.
88 * LTTNG_TRACEPOINT_EVENT is a one to one mapping between tracepoint and
92 #undef LTTNG_TRACEPOINT_EVENT
93 #define LTTNG_TRACEPOINT_EVENT(name, proto, args, fields) \
94 LTTNG_TRACEPOINT_EVENT_MAP(name, name, \
99 #undef LTTNG_TRACEPOINT_EVENT_NOARGS
100 #define LTTNG_TRACEPOINT_EVENT_NOARGS(name, fields) \
101 LTTNG_TRACEPOINT_EVENT_MAP_NOARGS(name, name, PARAMS(fields))
103 #undef LTTNG_TRACEPOINT_EVENT_INSTANCE
104 #define LTTNG_TRACEPOINT_EVENT_INSTANCE(template, name, proto, args) \
105 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(template, name, name, PARAMS(proto), PARAMS(args))
107 #undef LTTNG_TRACEPOINT_EVENT_INSTANCE_NOARGS
108 #define LTTNG_TRACEPOINT_EVENT_INSTANCE_NOARGS(template, name) \
109 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP_NOARGS(template, name, name)
111 #undef LTTNG_TRACEPOINT_EVENT_CLASS
112 #define LTTNG_TRACEPOINT_EVENT_CLASS(_name, _proto, _args, _fields) \
113 LTTNG_TRACEPOINT_EVENT_CLASS_CODE(_name, PARAMS(_proto), PARAMS(_args), , , \
116 #undef LTTNG_TRACEPOINT_EVENT_CLASS_NOARGS
117 #define LTTNG_TRACEPOINT_EVENT_CLASS_NOARGS(_name, _fields) \
118 LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS(_name, , , PARAMS(_fields), )
122 * Stage 1 of the trace events.
124 * Create dummy trace calls for each events, verifying that the LTTng module
125 * instrumentation headers match the kernel arguments. Will be optimized
126 * out by the compiler.
129 /* Reset all macros within TRACEPOINT_EVENT */
130 #include <probes/lttng-events-reset.h>
133 #define TP_PROTO(...) __VA_ARGS__
136 #define TP_ARGS(...) __VA_ARGS__
138 #undef LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP
139 #define LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(_template, _name, _map, _proto, _args) \
140 void trace_##_name(_proto);
142 #undef LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP_NOARGS
143 #define LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP_NOARGS(_template, _name, _map) \
144 void trace_##_name(void);
146 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
149 * Stage 1.1 of the trace events.
151 * Create dummy trace prototypes for each event class, and for each used
152 * template. This will allow checking whether the prototypes from the
153 * class and the instance using the class actually match.
156 #include <probes/lttng-events-reset.h> /* Reset all macros within TRACE_EVENT */
159 #define TP_PROTO(...) __VA_ARGS__
162 #define TP_ARGS(...) __VA_ARGS__
164 #undef LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP
165 #define LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(_template, _name, _map, _proto, _args) \
166 void __event_template_proto___##_template(_proto);
168 #undef LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP_NOARGS
169 #define LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP_NOARGS(_template, _name, _map) \
170 void __event_template_proto___##_template(void);
172 #undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE
173 #define LTTNG_TRACEPOINT_EVENT_CLASS_CODE(_name, _proto, _args, _locvar, _code_pre, _fields, _code_post) \
174 void __event_template_proto___##_name(_proto);
176 #undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS
177 #define LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS(_name, _locvar, _code_pre, _fields, _code_post) \
178 void __event_template_proto___##_name(void);
180 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
183 * Stage 1.2 of tracepoint event generation
185 * Unfolding the enums
187 #include <probes/lttng-events-reset.h> /* Reset all macros within TRACE_EVENT */
189 /* Enumeration entry (single value) */
190 #undef ctf_enum_value
191 #define ctf_enum_value(_string, _value) \
194 .signedness = lttng_is_signed_type(__typeof__(_value)), \
195 .value = lttng_is_signed_type(__typeof__(_value)) ? \
196 (long long) (_value) : (_value), \
199 .signedness = lttng_is_signed_type(__typeof__(_value)), \
200 .value = lttng_is_signed_type(__typeof__(_value)) ? \
201 (long long) (_value) : (_value), \
203 .string = (_string), \
206 /* Enumeration entry (range) */
207 #undef ctf_enum_range
208 #define ctf_enum_range(_string, _range_start, _range_end) \
211 .signedness = lttng_is_signed_type(__typeof__(_range_start)), \
212 .value = lttng_is_signed_type(__typeof__(_range_start)) ? \
213 (long long) (_range_start) : (_range_start), \
216 .signedness = lttng_is_signed_type(__typeof__(_range_end)), \
217 .value = lttng_is_signed_type(__typeof__(_range_end)) ? \
218 (long long) (_range_end) : (_range_end), \
220 .string = (_string), \
223 #undef TP_ENUM_VALUES
224 #define TP_ENUM_VALUES(...) \
227 #undef LTTNG_TRACEPOINT_ENUM
228 #define LTTNG_TRACEPOINT_ENUM(_name, _values) \
229 const struct lttng_enum_entry __enum_values__##_name[] = { \
233 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
236 * Stage 2 of the trace events.
238 * Create event field type metadata section.
239 * Each event produce an array of fields.
242 /* Reset all macros within TRACEPOINT_EVENT */
243 #include <probes/lttng-events-reset.h>
244 #include <probes/lttng-events-write.h>
245 #include <probes/lttng-events-nowrite.h>
247 #undef _ctf_integer_ext
248 #define _ctf_integer_ext(_type, _item, _src, _byte_order, _base, _user, _nowrite) \
251 .type = __type_integer(_type, 0, 0, -1, _byte_order, _base, none),\
252 .nowrite = _nowrite, \
256 #undef _ctf_array_encoded
257 #define _ctf_array_encoded(_type, _item, _src, _length, _encoding, _user, _nowrite) \
262 .atype = atype_array, \
267 .elem_type = __type_integer(_type, 0, 0, 0, __BYTE_ORDER, 10, _encoding), \
272 .nowrite = _nowrite, \
276 #undef _ctf_array_bitfield
277 #define _ctf_array_bitfield(_type, _item, _src, _length, _user, _nowrite) \
282 .atype = atype_array, \
287 .elem_type = __type_integer(_type, 1, 1, 0, __LITTLE_ENDIAN, 10, none), \
288 .length = (_length) * sizeof(_type) * CHAR_BIT, \
289 .elem_alignment = lttng_alignof(_type), \
293 .nowrite = _nowrite, \
298 #undef _ctf_sequence_encoded
299 #define _ctf_sequence_encoded(_type, _item, _src, \
300 _length_type, _src_length, _encoding, \
301 _byte_order, _base, _user, _nowrite) \
306 .atype = atype_sequence, \
311 .length_type = __type_integer(_length_type, 0, 0, 0, __BYTE_ORDER, 10, none), \
312 .elem_type = __type_integer(_type, 0, 0, -1, _byte_order, _base, _encoding), \
316 .nowrite = _nowrite, \
320 #undef _ctf_sequence_bitfield
321 #define _ctf_sequence_bitfield(_type, _item, _src, \
322 _length_type, _src_length, \
328 .atype = atype_sequence, \
333 .length_type = __type_integer(_length_type, 0, 0, 0, __BYTE_ORDER, 10, none), \
334 .elem_type = __type_integer(_type, 1, 1, 0, __LITTLE_ENDIAN, 10, none), \
335 .elem_alignment = lttng_alignof(_type), \
339 .nowrite = _nowrite, \
344 #define _ctf_string(_item, _src, _user, _nowrite) \
349 .atype = atype_string, \
352 .basic = { .string = { .encoding = lttng_encode_UTF8 } } \
355 .nowrite = _nowrite, \
360 #define _ctf_enum(_name, _type, _item, _src, _user, _nowrite) \
364 .atype = atype_enum, \
368 .desc = &__enum_##_name, \
369 .container_type = { \
370 .size = sizeof(_type) * CHAR_BIT, \
371 .alignment = lttng_alignof(_type) * CHAR_BIT, \
372 .signedness = lttng_is_signed_type(_type), \
373 .reverse_byte_order = 0, \
375 .encoding = lttng_encode_none, \
381 .nowrite = _nowrite, \
385 #undef ctf_custom_field
386 #define ctf_custom_field(_type, _item, _code) \
394 #undef ctf_custom_type
395 #define ctf_custom_type(...) __VA_ARGS__
398 #define TP_FIELDS(...) __VA_ARGS__ /* Only one used in this phase */
400 #undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS
401 #define LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS(_name, _locvar, _code_pre, _fields, _code_post) \
402 static const struct lttng_event_field __event_fields___##_name[] = { \
406 #undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE
407 #define LTTNG_TRACEPOINT_EVENT_CLASS_CODE(_name, _proto, _args, _locvar, _code_pre, _fields, _code_post) \
408 LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS(_name, _locvar, _code_pre, PARAMS(_fields), _code_post)
410 #undef LTTNG_TRACEPOINT_ENUM
411 #define LTTNG_TRACEPOINT_ENUM(_name, _values) \
412 static const struct lttng_enum_desc __enum_##_name = { \
414 .entries = __enum_values__##_name, \
415 .nr_entries = ARRAY_SIZE(__enum_values__##_name), \
418 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
421 * Stage 3 of the trace events.
423 * Create probe callback prototypes.
426 /* Reset all macros within TRACEPOINT_EVENT */
427 #include <probes/lttng-events-reset.h>
430 #define TP_PROTO(...) __VA_ARGS__
432 #undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE
433 #define LTTNG_TRACEPOINT_EVENT_CLASS_CODE(_name, _proto, _args, _locvar, _code_pre, _fields, _code_post) \
434 static void __event_probe__##_name(void *__data, _proto);
436 #undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS
437 #define LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS(_name, _locvar, _code_pre, _fields, _code_post) \
438 static void __event_probe__##_name(void *__data);
440 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
443 * Stage 4 of the trace events.
445 * Create static inline function that calculates event size.
448 /* Reset all macros within TRACEPOINT_EVENT */
449 #include <probes/lttng-events-reset.h>
450 #include <probes/lttng-events-write.h>
452 #undef _ctf_integer_ext
453 #define _ctf_integer_ext(_type, _item, _src, _byte_order, _base, _user, _nowrite) \
454 __event_len += lib_ring_buffer_align(__event_len, lttng_alignof(_type)); \
455 __event_len += sizeof(_type);
457 #undef _ctf_array_encoded
458 #define _ctf_array_encoded(_type, _item, _src, _length, _encoding, _user, _nowrite) \
459 __event_len += lib_ring_buffer_align(__event_len, lttng_alignof(_type)); \
460 __event_len += sizeof(_type) * (_length);
462 #undef _ctf_array_bitfield
463 #define _ctf_array_bitfield(_type, _item, _src, _length, _user, _nowrite) \
464 _ctf_array_encoded(_type, _item, _src, _length, none, _user, _nowrite)
466 #undef _ctf_sequence_encoded
467 #define _ctf_sequence_encoded(_type, _item, _src, _length_type, \
468 _src_length, _encoding, _byte_order, _base, _user, _nowrite) \
469 __event_len += lib_ring_buffer_align(__event_len, lttng_alignof(_length_type)); \
470 __event_len += sizeof(_length_type); \
471 __event_len += lib_ring_buffer_align(__event_len, lttng_alignof(_type)); \
473 size_t __seqlen = (_src_length); \
475 if (unlikely(++this_cpu_ptr(<tng_dynamic_len_stack)->offset >= LTTNG_DYNAMIC_LEN_STACK_SIZE)) \
477 barrier(); /* reserve before use. */ \
478 this_cpu_ptr(<tng_dynamic_len_stack)->stack[this_cpu_ptr(<tng_dynamic_len_stack)->offset - 1] = __seqlen; \
479 __event_len += sizeof(_type) * __seqlen; \
482 #undef _ctf_sequence_bitfield
483 #define _ctf_sequence_bitfield(_type, _item, _src, \
484 _length_type, _src_length, \
486 _ctf_sequence_encoded(_type, _item, _src, _length_type, _src_length, \
487 none, __LITTLE_ENDIAN, 10, _user, _nowrite)
490 * ctf_user_string includes \0. If returns 0, it faulted, so we set size to
494 #define _ctf_string(_item, _src, _user, _nowrite) \
495 if (unlikely(++this_cpu_ptr(<tng_dynamic_len_stack)->offset >= LTTNG_DYNAMIC_LEN_STACK_SIZE)) \
497 barrier(); /* reserve before use. */ \
499 __event_len += this_cpu_ptr(<tng_dynamic_len_stack)->stack[this_cpu_ptr(<tng_dynamic_len_stack)->offset - 1] = \
500 max_t(size_t, lttng_strlen_user_inatomic(_src), 1); \
502 __event_len += this_cpu_ptr(<tng_dynamic_len_stack)->stack[this_cpu_ptr(<tng_dynamic_len_stack)->offset - 1] = \
507 #define _ctf_enum(_name, _type, _item, _src, _user, _nowrite) \
508 _ctf_integer_ext(_type, _item, _src, __BYTE_ORDER, 10, _user, _nowrite)
511 #define ctf_align(_type) \
512 __event_len += lib_ring_buffer_align(__event_len, lttng_alignof(_type));
514 #undef ctf_custom_field
515 #define ctf_custom_field(_type, _item, _code) \
520 #undef ctf_custom_code
521 #define ctf_custom_code(...) __VA_ARGS__
524 #define TP_PROTO(...) __VA_ARGS__
527 #define TP_FIELDS(...) __VA_ARGS__
530 #define TP_locvar(...) __VA_ARGS__
532 #undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE
533 #define LTTNG_TRACEPOINT_EVENT_CLASS_CODE(_name, _proto, _args, _locvar, _code_pre, _fields, _code_post) \
534 static inline ssize_t __event_get_size__##_name(void *__tp_locvar, _proto) \
536 size_t __event_len = 0; \
537 unsigned int __dynamic_len_idx __attribute__((unused)) = 0; \
538 struct { _locvar } *tp_locvar __attribute__((unused)) = __tp_locvar; \
541 return __event_len; \
544 __attribute__((unused)); \
548 #undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS
549 #define LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS(_name, _locvar, _code_pre, _fields, _code_post) \
550 static inline ssize_t __event_get_size__##_name(void *__tp_locvar) \
552 size_t __event_len = 0; \
553 unsigned int __dynamic_len_idx __attribute__((unused)) = 0; \
554 struct { _locvar } *tp_locvar __attribute__((unused)) = __tp_locvar; \
557 return __event_len; \
560 __attribute__((unused)); \
564 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
568 * Stage 4.1 of tracepoint event generation.
570 * Create static inline function that layout the filter stack data.
571 * We make both write and nowrite data available to the filter.
574 /* Reset all macros within TRACEPOINT_EVENT */
575 #include <probes/lttng-events-reset.h>
576 #include <probes/lttng-events-write.h>
577 #include <probes/lttng-events-nowrite.h>
579 #undef _ctf_integer_ext_fetched
580 #define _ctf_integer_ext_fetched(_type, _item, _src, _byte_order, _base, _nowrite) \
581 if (lttng_is_signed_type(_type)) { \
582 int64_t __ctf_tmp_int64; \
583 switch (sizeof(_type)) { \
586 union { _type t; int8_t v; } __tmp = { (_type) (_src) }; \
587 __ctf_tmp_int64 = (int64_t) __tmp.v; \
592 union { _type t; int16_t v; } __tmp = { (_type) (_src) }; \
593 if (_byte_order != __BYTE_ORDER) \
594 __swab16s(&__tmp.v); \
595 __ctf_tmp_int64 = (int64_t) __tmp.v; \
600 union { _type t; int32_t v; } __tmp = { (_type) (_src) }; \
601 if (_byte_order != __BYTE_ORDER) \
602 __swab32s(&__tmp.v); \
603 __ctf_tmp_int64 = (int64_t) __tmp.v; \
608 union { _type t; int64_t v; } __tmp = { (_type) (_src) }; \
609 if (_byte_order != __BYTE_ORDER) \
610 __swab64s(&__tmp.v); \
611 __ctf_tmp_int64 = (int64_t) __tmp.v; \
617 memcpy(__stack_data, &__ctf_tmp_int64, sizeof(int64_t)); \
619 uint64_t __ctf_tmp_uint64; \
620 switch (sizeof(_type)) { \
623 union { _type t; uint8_t v; } __tmp = { (_type) (_src) }; \
624 __ctf_tmp_uint64 = (uint64_t) __tmp.v; \
629 union { _type t; uint16_t v; } __tmp = { (_type) (_src) }; \
630 if (_byte_order != __BYTE_ORDER) \
631 __swab16s(&__tmp.v); \
632 __ctf_tmp_uint64 = (uint64_t) __tmp.v; \
637 union { _type t; uint32_t v; } __tmp = { (_type) (_src) }; \
638 if (_byte_order != __BYTE_ORDER) \
639 __swab32s(&__tmp.v); \
640 __ctf_tmp_uint64 = (uint64_t) __tmp.v; \
645 union { _type t; uint64_t v; } __tmp = { (_type) (_src) }; \
646 if (_byte_order != __BYTE_ORDER) \
647 __swab64s(&__tmp.v); \
648 __ctf_tmp_uint64 = (uint64_t) __tmp.v; \
654 memcpy(__stack_data, &__ctf_tmp_uint64, sizeof(uint64_t)); \
656 __stack_data += sizeof(int64_t);
658 #undef _ctf_integer_ext_isuser0
659 #define _ctf_integer_ext_isuser0(_type, _item, _src, _byte_order, _base, _nowrite) \
660 _ctf_integer_ext_fetched(_type, _item, _src, _byte_order, _base, _nowrite)
662 #undef _ctf_integer_ext_isuser1
663 #define _ctf_integer_ext_isuser1(_type, _item, _user_src, _byte_order, _base, _nowrite) \
666 char __array[sizeof(_user_src)]; \
667 __typeof__(_user_src) __v; \
669 if (lib_ring_buffer_copy_from_user_check_nofault(__tmp_fetch.__array, \
670 &(_user_src), sizeof(_user_src))) \
671 memset(__tmp_fetch.__array, 0, sizeof(__tmp_fetch.__array)); \
672 _ctf_integer_ext_fetched(_type, _item, __tmp_fetch.__v, _byte_order, _base, _nowrite) \
675 #undef _ctf_integer_ext
676 #define _ctf_integer_ext(_type, _item, _user_src, _byte_order, _base, _user, _nowrite) \
677 _ctf_integer_ext_isuser##_user(_type, _item, _user_src, _byte_order, _base, _nowrite)
679 #undef _ctf_array_encoded
680 #define _ctf_array_encoded(_type, _item, _src, _length, _encoding, _user, _nowrite) \
682 unsigned long __ctf_tmp_ulong = (unsigned long) (_length); \
683 const void *__ctf_tmp_ptr = (_src); \
684 memcpy(__stack_data, &__ctf_tmp_ulong, sizeof(unsigned long)); \
685 __stack_data += sizeof(unsigned long); \
686 memcpy(__stack_data, &__ctf_tmp_ptr, sizeof(void *)); \
687 __stack_data += sizeof(void *); \
690 #undef _ctf_array_bitfield
691 #define _ctf_array_bitfield(_type, _item, _src, _length, _user, _nowrite) \
692 _ctf_array_encoded(_type, _item, _src, _length, none, _user, _nowrite)
694 #undef _ctf_sequence_encoded
695 #define _ctf_sequence_encoded(_type, _item, _src, _length_type, \
696 _src_length, _encoding, _byte_order, _base, _user, _nowrite) \
698 unsigned long __ctf_tmp_ulong = (unsigned long) (_src_length); \
699 const void *__ctf_tmp_ptr = (_src); \
700 memcpy(__stack_data, &__ctf_tmp_ulong, sizeof(unsigned long)); \
701 __stack_data += sizeof(unsigned long); \
702 memcpy(__stack_data, &__ctf_tmp_ptr, sizeof(void *)); \
703 __stack_data += sizeof(void *); \
706 #undef _ctf_sequence_bitfield
707 #define _ctf_sequence_bitfield(_type, _item, _src, \
708 _length_type, _src_length, \
710 _ctf_sequence_encoded(_type, _item, _src, _length_type, _src_length, \
711 none, __LITTLE_ENDIAN, 10, _user, _nowrite)
714 #define _ctf_string(_item, _src, _user, _nowrite) \
716 const void *__ctf_tmp_ptr = (_src); \
717 memcpy(__stack_data, &__ctf_tmp_ptr, sizeof(void *)); \
718 __stack_data += sizeof(void *); \
722 #define _ctf_enum(_name, _type, _item, _src, _user, _nowrite) \
723 _ctf_integer_ext(_type, _item, _src, __BYTE_ORDER, 10, _user, _nowrite)
726 #define TP_PROTO(...) __VA_ARGS__
729 #define TP_FIELDS(...) __VA_ARGS__
732 #define TP_locvar(...) __VA_ARGS__
734 #undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS
735 #define LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS(_name, _locvar, _code_pre, _fields, _code_post) \
737 void __event_prepare_filter_stack__##_name(char *__stack_data, \
740 struct { _locvar } *tp_locvar __attribute__((unused)) = __tp_locvar; \
745 #undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE
746 #define LTTNG_TRACEPOINT_EVENT_CLASS_CODE(_name, _proto, _args, _locvar, _code_pre, _fields, _code_post) \
748 void __event_prepare_filter_stack__##_name(char *__stack_data, \
749 void *__tp_locvar, _proto) \
751 struct { _locvar } *tp_locvar __attribute__((unused)) = __tp_locvar; \
756 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
759 * Stage 5 of the trace events.
761 * Create static inline function that calculates event payload alignment.
764 /* Reset all macros within TRACEPOINT_EVENT */
765 #include <probes/lttng-events-reset.h>
766 #include <probes/lttng-events-write.h>
768 #undef _ctf_integer_ext
769 #define _ctf_integer_ext(_type, _item, _src, _byte_order, _base, _user, _nowrite) \
770 __event_align = max_t(size_t, __event_align, lttng_alignof(_type));
772 #undef _ctf_array_encoded
773 #define _ctf_array_encoded(_type, _item, _src, _length, _encoding, _user, _nowrite) \
774 __event_align = max_t(size_t, __event_align, lttng_alignof(_type));
776 #undef _ctf_array_bitfield
777 #define _ctf_array_bitfield(_type, _item, _src, _length, _user, _nowrite) \
778 _ctf_array_encoded(_type, _item, _src, _length, none, _user, _nowrite)
780 #undef _ctf_sequence_encoded
781 #define _ctf_sequence_encoded(_type, _item, _src, _length_type, \
782 _src_length, _encoding, _byte_order, _base, _user, _nowrite) \
783 __event_align = max_t(size_t, __event_align, lttng_alignof(_length_type)); \
784 __event_align = max_t(size_t, __event_align, lttng_alignof(_type));
786 #undef _ctf_sequence_bitfield
787 #define _ctf_sequence_bitfield(_type, _item, _src, \
788 _length_type, _src_length, \
790 _ctf_sequence_encoded(_type, _item, _src, _length_type, _src_length, \
791 none, __LITTLE_ENDIAN, 10, _user, _nowrite)
794 #define _ctf_string(_item, _src, _user, _nowrite)
797 #define _ctf_enum(_name, _type, _item, _src, _user, _nowrite) \
798 _ctf_integer_ext(_type, _item, _src, __BYTE_ORDER, 10, _user, _nowrite)
801 #define ctf_align(_type) \
802 __event_align = max_t(size_t, __event_align, lttng_alignof(_type));
805 #define TP_PROTO(...) __VA_ARGS__
808 #define TP_FIELDS(...) __VA_ARGS__
811 #define TP_locvar(...) __VA_ARGS__
813 #undef ctf_custom_field
814 #define ctf_custom_field(_type, _item, _code) _code
816 #undef ctf_custom_code
817 #define ctf_custom_code(...) \
822 #undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE
823 #define LTTNG_TRACEPOINT_EVENT_CLASS_CODE(_name, _proto, _args, _locvar, _code_pre, _fields, _code_post) \
824 static inline size_t __event_get_align__##_name(void *__tp_locvar, _proto) \
826 size_t __event_align = 1; \
827 struct { _locvar } *tp_locvar __attribute__((unused)) = __tp_locvar; \
830 return __event_align; \
833 #undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS
834 #define LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS(_name, _locvar, _code_pre, _fields, _code_post) \
835 static inline size_t __event_get_align__##_name(void *__tp_locvar) \
837 size_t __event_align = 1; \
838 struct { _locvar } *tp_locvar __attribute__((unused)) = __tp_locvar; \
841 return __event_align; \
844 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
847 * Stage 6 of tracepoint event generation.
849 * Create the probe function. This function calls event size calculation
850 * and writes event data into the buffer.
853 /* Reset all macros within TRACEPOINT_EVENT */
854 #include <probes/lttng-events-reset.h>
855 #include <probes/lttng-events-write.h>
857 #undef _ctf_integer_ext_fetched
858 #define _ctf_integer_ext_fetched(_type, _item, _src, _byte_order, _base, _nowrite) \
860 _type __tmp = _src; \
861 lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(__tmp));\
862 __chan->ops->event_write(&__ctx, &__tmp, sizeof(__tmp));\
865 #undef _ctf_integer_ext_isuser0
866 #define _ctf_integer_ext_isuser0(_type, _item, _src, _byte_order, _base, _nowrite) \
867 _ctf_integer_ext_fetched(_type, _item, _src, _byte_order, _base, _nowrite)
869 #undef _ctf_integer_ext_isuser1
870 #define _ctf_integer_ext_isuser1(_type, _item, _user_src, _byte_order, _base, _nowrite) \
873 char __array[sizeof(_user_src)]; \
874 __typeof__(_user_src) __v; \
876 if (lib_ring_buffer_copy_from_user_check_nofault(__tmp_fetch.__array, \
877 &(_user_src), sizeof(_user_src))) \
878 memset(__tmp_fetch.__array, 0, sizeof(__tmp_fetch.__array)); \
879 _ctf_integer_ext_fetched(_type, _item, __tmp_fetch.__v, _byte_order, _base, _nowrite) \
882 #undef _ctf_integer_ext
883 #define _ctf_integer_ext(_type, _item, _user_src, _byte_order, _base, _user, _nowrite) \
884 _ctf_integer_ext_isuser##_user(_type, _item, _user_src, _byte_order, _base, _nowrite)
886 #undef _ctf_array_encoded
887 #define _ctf_array_encoded(_type, _item, _src, _length, _encoding, _user, _nowrite) \
888 lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(_type)); \
890 __chan->ops->event_write_from_user(&__ctx, _src, sizeof(_type) * (_length)); \
892 __chan->ops->event_write(&__ctx, _src, sizeof(_type) * (_length)); \
895 #if (__BYTE_ORDER == __LITTLE_ENDIAN)
896 #undef _ctf_array_bitfield
897 #define _ctf_array_bitfield(_type, _item, _src, _length, _user, _nowrite) \
898 lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(_type)); \
900 __chan->ops->event_write_from_user(&__ctx, _src, sizeof(_type) * (_length)); \
902 __chan->ops->event_write(&__ctx, _src, sizeof(_type) * (_length)); \
904 #else /* #if (__BYTE_ORDER == __LITTLE_ENDIAN) */
906 * For big endian, we need to byteswap into little endian.
908 #undef _ctf_array_bitfield
909 #define _ctf_array_bitfield(_type, _item, _src, _length, _user, _nowrite) \
910 lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(_type)); \
914 for (_i = 0; _i < (_length); _i++) { \
918 if (get_user(_tmp, (_type *) _src + _i)) \
921 _tmp = ((_type *) _src)[_i]; \
923 switch (sizeof(_type)) { \
927 _tmp = cpu_to_le16(_tmp); \
930 _tmp = cpu_to_le32(_tmp); \
933 _tmp = cpu_to_le64(_tmp); \
938 __chan->ops->event_write(&__ctx, &_tmp, sizeof(_type)); \
941 #endif /* #else #if (__BYTE_ORDER == __LITTLE_ENDIAN) */
943 #undef _ctf_sequence_encoded
944 #define _ctf_sequence_encoded(_type, _item, _src, _length_type, \
945 _src_length, _encoding, _byte_order, _base, _user, _nowrite) \
947 _length_type __tmpl = this_cpu_ptr(<tng_dynamic_len_stack)->stack[__dynamic_len_idx]; \
948 lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(_length_type));\
949 __chan->ops->event_write(&__ctx, &__tmpl, sizeof(_length_type));\
951 lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(_type)); \
953 __chan->ops->event_write_from_user(&__ctx, _src, \
954 sizeof(_type) * __get_dynamic_len(dest)); \
956 __chan->ops->event_write(&__ctx, _src, \
957 sizeof(_type) * __get_dynamic_len(dest)); \
960 #if (__BYTE_ORDER == __LITTLE_ENDIAN)
961 #undef _ctf_sequence_bitfield
962 #define _ctf_sequence_bitfield(_type, _item, _src, \
963 _length_type, _src_length, \
966 _length_type __tmpl = this_cpu_ptr(<tng_dynamic_len_stack)->stack[__dynamic_len_idx] * sizeof(_type) * CHAR_BIT; \
967 lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(_length_type));\
968 __chan->ops->event_write(&__ctx, &__tmpl, sizeof(_length_type));\
970 lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(_type)); \
972 __chan->ops->event_write_from_user(&__ctx, _src, \
973 sizeof(_type) * __get_dynamic_len(dest)); \
975 __chan->ops->event_write(&__ctx, _src, \
976 sizeof(_type) * __get_dynamic_len(dest)); \
978 #else /* #if (__BYTE_ORDER == __LITTLE_ENDIAN) */
980 * For big endian, we need to byteswap into little endian.
982 #undef _ctf_sequence_bitfield
983 #define _ctf_sequence_bitfield(_type, _item, _src, \
984 _length_type, _src_length, \
987 _length_type __tmpl = this_cpu_ptr(<tng_dynamic_len_stack)->stack[__dynamic_len_idx] * sizeof(_type) * CHAR_BIT; \
988 lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(_length_type));\
989 __chan->ops->event_write(&__ctx, &__tmpl, sizeof(_length_type));\
991 lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(_type)); \
993 size_t _i, _length; \
995 _length = __get_dynamic_len(dest); \
996 for (_i = 0; _i < _length; _i++) { \
1000 if (get_user(_tmp, (_type *) _src + _i)) \
1003 _tmp = ((_type *) _src)[_i]; \
1005 switch (sizeof(_type)) { \
1009 _tmp = cpu_to_le16(_tmp); \
1012 _tmp = cpu_to_le32(_tmp); \
1015 _tmp = cpu_to_le64(_tmp); \
1020 __chan->ops->event_write(&__ctx, &_tmp, sizeof(_type)); \
1023 #endif /* #else #if (__BYTE_ORDER == __LITTLE_ENDIAN) */
1026 #define _ctf_string(_item, _src, _user, _nowrite) \
1027 lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(*(_src))); \
1029 __chan->ops->event_strcpy_from_user(&__ctx, _src, \
1030 __get_dynamic_len(dest)); \
1032 __chan->ops->event_strcpy(&__ctx, _src, \
1033 __get_dynamic_len(dest)); \
1037 #define _ctf_enum(_name, _type, _item, _src, _user, _nowrite) \
1038 _ctf_integer_ext(_type, _item, _src, __BYTE_ORDER, 10, _user, _nowrite)
1041 #define ctf_align(_type) \
1042 lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(_type));
1044 #undef ctf_custom_field
1045 #define ctf_custom_field(_type, _item, _code) _code
1047 #undef ctf_custom_code
1048 #define ctf_custom_code(...) \
1053 /* Beware: this get len actually consumes the len value */
1054 #undef __get_dynamic_len
1055 #define __get_dynamic_len(field) this_cpu_ptr(<tng_dynamic_len_stack)->stack[__dynamic_len_idx++]
1058 #define TP_PROTO(...) __VA_ARGS__
1061 #define TP_ARGS(...) __VA_ARGS__
1064 #define TP_FIELDS(...) __VA_ARGS__
1067 #define TP_locvar(...) __VA_ARGS__
1070 #define TP_code_pre(...) __VA_ARGS__
1073 #define TP_code_post(...) __VA_ARGS__
1076 * For state dump, check that "session" argument (mandatory) matches the
1077 * session this event belongs to. Ensures that we write state dump data only
1078 * into the started session, not into all sessions.
1080 #ifdef TP_SESSION_CHECK
1081 #define _TP_SESSION_CHECK(session, csession) (session == csession)
1082 #else /* TP_SESSION_CHECK */
1083 #define _TP_SESSION_CHECK(session, csession) 1
1084 #endif /* TP_SESSION_CHECK */
1087 * Using twice size for filter stack data to hold size and pointer for
1088 * each field (worse case). For integers, max size required is 64-bit.
1089 * Same for double-precision floats. Those fit within
1090 * 2*sizeof(unsigned long) for all supported architectures.
1091 * Perform UNION (||) of filter runtime list.
1093 #undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE
1094 #define LTTNG_TRACEPOINT_EVENT_CLASS_CODE(_name, _proto, _args, _locvar, _code_pre, _fields, _code_post) \
1095 static void __event_probe__##_name(void *__data, _proto) \
1097 struct probe_local_vars { _locvar }; \
1098 struct lttng_event *__event = __data; \
1099 struct lttng_probe_ctx __lttng_probe_ctx = { \
1101 .interruptible = !irqs_disabled(), \
1103 struct lttng_channel *__chan = __event->chan; \
1104 struct lttng_session *__session = __chan->session; \
1105 struct lib_ring_buffer_ctx __ctx; \
1106 ssize_t __event_len; \
1107 size_t __event_align; \
1108 size_t __orig_dynamic_len_offset, __dynamic_len_idx; \
1110 size_t __dynamic_len_removed[ARRAY_SIZE(__event_fields___##_name)]; \
1111 char __filter_stack_data[2 * sizeof(unsigned long) * ARRAY_SIZE(__event_fields___##_name)]; \
1114 struct probe_local_vars __tp_locvar; \
1115 struct probe_local_vars *tp_locvar __attribute__((unused)) = \
1117 struct lttng_pid_tracker *__lpf; \
1119 if (!_TP_SESSION_CHECK(session, __session)) \
1121 if (unlikely(!ACCESS_ONCE(__session->active))) \
1123 if (unlikely(!ACCESS_ONCE(__chan->enabled))) \
1125 if (unlikely(!ACCESS_ONCE(__event->enabled))) \
1127 __lpf = lttng_rcu_dereference(__session->pid_tracker); \
1128 if (__lpf && likely(!lttng_pid_tracker_lookup(__lpf, current->pid))) \
1130 __orig_dynamic_len_offset = this_cpu_ptr(<tng_dynamic_len_stack)->offset; \
1131 __dynamic_len_idx = __orig_dynamic_len_offset; \
1133 if (unlikely(!list_empty(&__event->bytecode_runtime_head))) { \
1134 struct lttng_bytecode_runtime *bc_runtime; \
1135 int __filter_record = __event->has_enablers_without_bytecode; \
1137 __event_prepare_filter_stack__##_name(__stackvar.__filter_stack_data, \
1138 tp_locvar, _args); \
1139 lttng_list_for_each_entry_rcu(bc_runtime, &__event->bytecode_runtime_head, node) { \
1140 if (unlikely(bc_runtime->filter(bc_runtime, &__lttng_probe_ctx, \
1141 __stackvar.__filter_stack_data) & LTTNG_FILTER_RECORD_FLAG)) \
1142 __filter_record = 1; \
1144 if (likely(!__filter_record)) \
1147 __event_len = __event_get_size__##_name(tp_locvar, _args); \
1148 if (unlikely(__event_len < 0)) { \
1149 lib_ring_buffer_lost_event_too_big(__chan->chan); \
1152 __event_align = __event_get_align__##_name(tp_locvar, _args); \
1153 lib_ring_buffer_ctx_init(&__ctx, __chan->chan, &__lttng_probe_ctx, __event_len, \
1154 __event_align, -1); \
1155 __ret = __chan->ops->event_reserve(&__ctx, __event->id); \
1159 __chan->ops->event_commit(&__ctx); \
1162 barrier(); /* use before un-reserve. */ \
1163 this_cpu_ptr(<tng_dynamic_len_stack)->offset = __orig_dynamic_len_offset; \
1167 #undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS
1168 #define LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS(_name, _locvar, _code_pre, _fields, _code_post) \
1169 static void __event_probe__##_name(void *__data) \
1171 struct probe_local_vars { _locvar }; \
1172 struct lttng_event *__event = __data; \
1173 struct lttng_probe_ctx __lttng_probe_ctx = { \
1175 .interruptible = !irqs_disabled(), \
1177 struct lttng_channel *__chan = __event->chan; \
1178 struct lttng_session *__session = __chan->session; \
1179 struct lib_ring_buffer_ctx __ctx; \
1180 ssize_t __event_len; \
1181 size_t __event_align; \
1182 size_t __orig_dynamic_len_offset, __dynamic_len_idx; \
1184 size_t __dynamic_len_removed[ARRAY_SIZE(__event_fields___##_name)]; \
1185 char __filter_stack_data[2 * sizeof(unsigned long) * ARRAY_SIZE(__event_fields___##_name)]; \
1188 struct probe_local_vars __tp_locvar; \
1189 struct probe_local_vars *tp_locvar __attribute__((unused)) = \
1191 struct lttng_pid_tracker *__lpf; \
1193 if (!_TP_SESSION_CHECK(session, __session)) \
1195 if (unlikely(!ACCESS_ONCE(__session->active))) \
1197 if (unlikely(!ACCESS_ONCE(__chan->enabled))) \
1199 if (unlikely(!ACCESS_ONCE(__event->enabled))) \
1201 __lpf = lttng_rcu_dereference(__session->pid_tracker); \
1202 if (__lpf && likely(!lttng_pid_tracker_lookup(__lpf, current->pid))) \
1204 __orig_dynamic_len_offset = this_cpu_ptr(<tng_dynamic_len_stack)->offset; \
1205 __dynamic_len_idx = __orig_dynamic_len_offset; \
1207 if (unlikely(!list_empty(&__event->bytecode_runtime_head))) { \
1208 struct lttng_bytecode_runtime *bc_runtime; \
1209 int __filter_record = __event->has_enablers_without_bytecode; \
1211 __event_prepare_filter_stack__##_name(__stackvar.__filter_stack_data, \
1213 lttng_list_for_each_entry_rcu(bc_runtime, &__event->bytecode_runtime_head, node) { \
1214 if (unlikely(bc_runtime->filter(bc_runtime, &__lttng_probe_ctx, \
1215 __stackvar.__filter_stack_data) & LTTNG_FILTER_RECORD_FLAG)) \
1216 __filter_record = 1; \
1218 if (likely(!__filter_record)) \
1221 __event_len = __event_get_size__##_name(tp_locvar); \
1222 if (unlikely(__event_len < 0)) { \
1223 lib_ring_buffer_lost_event_too_big(__chan->chan); \
1226 __event_align = __event_get_align__##_name(tp_locvar); \
1227 lib_ring_buffer_ctx_init(&__ctx, __chan->chan, &__lttng_probe_ctx, __event_len, \
1228 __event_align, -1); \
1229 __ret = __chan->ops->event_reserve(&__ctx, __event->id); \
1233 __chan->ops->event_commit(&__ctx); \
1236 barrier(); /* use before un-reserve. */ \
1237 this_cpu_ptr(<tng_dynamic_len_stack)->offset = __orig_dynamic_len_offset; \
1241 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
1243 #undef __get_dynamic_len
1246 * Stage 7 of the trace events.
1248 * Create event descriptions.
1251 /* Named field types must be defined in lttng-types.h */
1253 #include <probes/lttng-events-reset.h> /* Reset all macros within LTTNG_TRACEPOINT_EVENT */
1256 #define TP_PROBE_CB(_template) &__event_probe__##_template
1259 #undef LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP_NOARGS
1260 #define LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP_NOARGS(_template, _name, _map) \
1261 static const struct lttng_event_desc __event_desc___##_map = { \
1262 .fields = __event_fields___##_template, \
1265 .probe_callback = (void *) TP_PROBE_CB(_template), \
1266 .nr_fields = ARRAY_SIZE(__event_fields___##_template), \
1267 .owner = THIS_MODULE, \
1270 #undef LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP
1271 #define LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(_template, _name, _map, _proto, _args) \
1272 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP_NOARGS(_template, _name, _map)
1274 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
1277 * Stage 8 of the trace events.
1279 * Create an array of event description pointers.
1282 #include <probes/lttng-events-reset.h> /* Reset all macros within LTTNG_TRACEPOINT_EVENT */
1284 #undef LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP_NOARGS
1285 #define LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP_NOARGS(_template, _name, _map) \
1286 &__event_desc___##_map,
1288 #undef LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP
1289 #define LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(_template, _name, _map, _proto, _args) \
1290 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP_NOARGS(_template, _name, _map)
1292 #define TP_ID1(_token, _system) _token##_system
1293 #define TP_ID(_token, _system) TP_ID1(_token, _system)
1295 static const struct lttng_event_desc
*TP_ID(__event_desc___
, TRACE_SYSTEM
)[] = {
1296 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
1303 * Stage 9 of the trace events.
1305 * Create a toplevel descriptor for the whole probe.
1308 #define TP_ID1(_token, _system) _token##_system
1309 #define TP_ID(_token, _system) TP_ID1(_token, _system)
1311 /* non-const because list head will be modified when registered. */
1312 static __used
struct lttng_probe_desc
TP_ID(__probe_desc___
, TRACE_SYSTEM
) = {
1313 .provider
= __stringify(TRACE_SYSTEM
),
1314 .event_desc
= TP_ID(__event_desc___
, TRACE_SYSTEM
),
1315 .nr_events
= ARRAY_SIZE(TP_ID(__event_desc___
, TRACE_SYSTEM
)),
1316 .head
= { NULL
, NULL
},
1317 .lazy_init_head
= { NULL
, NULL
},
1325 * Stage 10 of the trace events.
1327 * Register/unregister probes at module load/unload.
1330 #include <probes/lttng-events-reset.h> /* Reset all macros within LTTNG_TRACEPOINT_EVENT */
1332 #define TP_ID1(_token, _system) _token##_system
1333 #define TP_ID(_token, _system) TP_ID1(_token, _system)
1334 #define module_init_eval1(_token, _system) module_init(_token##_system)
1335 #define module_init_eval(_token, _system) module_init_eval1(_token, _system)
1336 #define module_exit_eval1(_token, _system) module_exit(_token##_system)
1337 #define module_exit_eval(_token, _system) module_exit_eval1(_token, _system)
1339 #ifndef TP_MODULE_NOINIT
1340 static int TP_ID(__lttng_events_init__
, TRACE_SYSTEM
)(void)
1342 wrapper_vmalloc_sync_all();
1343 return lttng_probe_register(&TP_ID(__probe_desc___
, TRACE_SYSTEM
));
1346 static void TP_ID(__lttng_events_exit__
, TRACE_SYSTEM
)(void)
1348 lttng_probe_unregister(&TP_ID(__probe_desc___
, TRACE_SYSTEM
));
1351 #ifndef TP_MODULE_NOAUTOLOAD
1352 module_init_eval(__lttng_events_init__
, TRACE_SYSTEM
);
1353 module_exit_eval(__lttng_events_exit__
, TRACE_SYSTEM
);
1358 #undef module_init_eval
1359 #undef module_exit_eval
This page took 0.069565 seconds and 5 git commands to generate.