1 /* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
5 * Holds LTTng per-session event registry.
7 * Copyright (C) 2010-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 #ifndef _LTTNG_EVENTS_H
11 #define _LTTNG_EVENTS_H
13 #include <lttng/kernel-version.h>
14 #include <linux/list.h>
15 #include <linux/kprobes.h>
16 #include <linux/kref.h>
17 #include <linux/uuid.h>
18 #include <linux/irq_work.h>
19 #include <wrapper/uprobes.h>
20 #include <lttng/cpuhotplug.h>
21 #include <lttng/tracer.h>
22 #include <lttng/abi.h>
23 #include <lttng/abi-old.h>
24 #include <lttng/endian.h>
26 #define lttng_is_signed_type(type) (((type) -1) < (type) 1)
30 struct lttng_metadata_cache
;
31 struct lib_ring_buffer_ctx
;
33 struct perf_event_attr
;
34 struct lib_ring_buffer_config
;
36 /* Type description */
38 enum lttng_kernel_type
{
39 lttng_kernel_type_integer
,
40 lttng_kernel_type_string
,
41 lttng_kernel_type_enum
,
42 lttng_kernel_type_array
,
43 lttng_kernel_type_sequence
,
44 lttng_kernel_type_struct
,
45 lttng_kernel_type_variant
,
46 NR_LTTNG_KERNEL_TYPES
,
49 enum lttng_kernel_string_encoding
{
50 lttng_kernel_string_encoding_none
= 0,
51 lttng_kernel_string_encoding_UTF8
= 1,
52 lttng_kernel_string_encoding_ASCII
= 2,
53 NR_LTTNG_KERNEL_STRING_ENCODING
,
61 struct lttng_kernel_enum_value
{
62 unsigned long long value
;
63 unsigned int signedness
:1;
66 struct lttng_kernel_enum_entry
{
67 struct lttng_kernel_enum_value start
, end
; /* start and end are inclusive */
70 unsigned int is_auto
:1;
75 * struct lttng_kernel_type_common is fixed-size. Its children inherits
76 * from it by embedding struct lttng_kernel_type_common as its first field.
78 struct lttng_kernel_type_common
{
79 enum lttng_kernel_type type
;
82 struct lttng_kernel_type_integer
{
83 struct lttng_kernel_type_common parent
;
84 unsigned int size
; /* in bits */
85 unsigned short alignment
; /* in bits */
86 unsigned int signedness
:1,
88 unsigned int base
; /* 2, 8, 10, 16, for pretty print */
91 struct lttng_kernel_type_string
{
92 struct lttng_kernel_type_common parent
;
93 enum lttng_kernel_string_encoding encoding
;
96 struct lttng_kernel_type_enum
{
97 struct lttng_kernel_type_common parent
;
98 const struct lttng_kernel_enum_desc
*desc
; /* Enumeration mapping */
99 const struct lttng_kernel_type_common
*container_type
;
102 struct lttng_kernel_type_array
{
103 struct lttng_kernel_type_common parent
;
104 const struct lttng_kernel_type_common
*elem_type
;
105 unsigned int length
; /* Num. elems. */
106 unsigned int alignment
;
107 enum lttng_kernel_string_encoding encoding
;
110 struct lttng_kernel_type_sequence
{
111 struct lttng_kernel_type_common parent
;
112 const char *length_name
; /* Length field name. */
113 const struct lttng_kernel_type_common
*elem_type
;
114 unsigned int alignment
; /* Alignment before elements. */
115 enum lttng_kernel_string_encoding encoding
;
118 struct lttng_kernel_type_struct
{
119 struct lttng_kernel_type_common parent
;
120 unsigned int nr_fields
;
121 const struct lttng_kernel_event_field
**fields
; /* Array of pointers to fields. */
122 unsigned int alignment
;
125 struct lttng_kernel_type_variant
{
126 struct lttng_kernel_type_common parent
;
127 const char *tag_name
;
128 const struct lttng_kernel_event_field
**choices
; /* Array of pointers to fields. */
129 unsigned int nr_choices
;
130 unsigned int alignment
;
133 struct lttng_kernel_enum_desc
{
135 const struct lttng_kernel_enum_entry
**entries
;
136 unsigned int nr_entries
;
139 /* Event field description */
141 struct lttng_kernel_event_field
{
143 const struct lttng_kernel_type_common
*type
;
144 unsigned int nowrite
:1, /* do not write into trace */
145 user
:1, /* fetch from user-space */
146 nofilter
:1; /* do not consider for filter */
149 #define lttng_kernel_static_type_integer(_size, _alignment, _signedness, _byte_order, _base) \
150 ((const struct lttng_kernel_type_common *) __LTTNG_COMPOUND_LITERAL(const struct lttng_kernel_type_integer, { \
152 .type = lttng_kernel_type_integer, \
155 .alignment = (_alignment), \
156 .signedness = (_signedness), \
157 .reverse_byte_order = (_byte_order) != __BYTE_ORDER, \
161 #define lttng_kernel_static_type_integer_from_type(_type, _byte_order, _base) \
162 lttng_kernel_static_type_integer(sizeof(_type) * CHAR_BIT, \
163 lttng_alignof(_type) * CHAR_BIT, \
164 lttng_is_signed_type(_type), \
168 #define lttng_kernel_static_type_enum(_desc, _container_type) \
169 ((const struct lttng_kernel_type_common *) __LTTNG_COMPOUND_LITERAL(const struct lttng_kernel_type_enum, { \
171 .type = lttng_kernel_type_enum, \
174 .container_type = (_container_type), \
177 #define lttng_kernel_static_type_array(_length, _elem_type, _alignment, _encoding) \
178 ((const struct lttng_kernel_type_common *) __LTTNG_COMPOUND_LITERAL(const struct lttng_kernel_type_array, { \
180 .type = lttng_kernel_type_array, \
182 .length = (_length), \
183 .alignment = (_alignment), \
184 .encoding = lttng_kernel_string_encoding_##_encoding, \
185 .elem_type = (_elem_type), \
188 #define lttng_kernel_static_type_array_text(_length) \
189 lttng_kernel_static_type_array(_length, \
190 lttng_kernel_static_type_integer(sizeof(char) * CHAR_BIT, \
191 lttng_alignof(char) * CHAR_BIT, lttng_is_signed_type(char), \
195 #define lttng_kernel_static_type_sequence(_length_name, _elem_type, _alignment, _encoding) \
196 ((const struct lttng_kernel_type_common *) __LTTNG_COMPOUND_LITERAL(const struct lttng_kernel_type_sequence, { \
198 .type = lttng_kernel_type_sequence, \
200 .length_name = (_length_name), \
201 .alignment = (_alignment), \
202 .encoding = lttng_kernel_string_encoding_##_encoding, \
203 .elem_type = (_elem_type), \
206 #define lttng_kernel_static_type_string(_encoding) \
207 ((const struct lttng_kernel_type_common *) __LTTNG_COMPOUND_LITERAL(const struct lttng_kernel_type_string, { \
209 .type = lttng_kernel_type_string, \
211 .encoding = lttng_kernel_string_encoding_##_encoding, \
214 #define lttng_kernel_static_type_struct(_nr_fields, _fields, _alignment) \
215 ((const struct lttng_kernel_type_common *) __LTTNG_COMPOUND_LITERAL(const struct lttng_kernel_type_struct, { \
217 .type = lttng_kernel_type_struct, \
219 .nr_fields = (_nr_fields), \
221 .alignment = (_alignment), \
224 #define lttng_kernel_static_type_variant(_nr_choices, _choices, _tag_name, _alignment) \
225 ((const struct lttng_kernel_type_common *) __LTTNG_COMPOUND_LITERAL(const struct lttng_kernel_type_variant, { \
227 .type = lttng_kernel_type_variant, \
229 .tag_name = (_tag_name), \
230 .choices = _choices, \
231 .nr_choices = (_nr_choices), \
232 .alignment = (_alignment), \
235 #define lttng_kernel_static_event_field(_name, _type, _nowrite, _user, _nofilter) \
236 __LTTNG_COMPOUND_LITERAL(const struct lttng_kernel_event_field, { \
239 .nowrite = (_nowrite), \
241 .nofilter = (_nofilter), \
244 #define lttng_kernel_static_event_field_array(_fields...) \
245 __LTTNG_COMPOUND_LITERAL(const struct lttng_kernel_event_field *, \
249 #define lttng_kernel_static_ctx_field(_event_field, _get_size, _get_size_arg, _record, _get_value, _destroy, _priv) \
250 __LTTNG_COMPOUND_LITERAL(const struct lttng_kernel_ctx_field, { \
251 .event_field = (_event_field), \
252 .get_size = (_get_size), \
253 .get_size_arg = (_get_size_arg), \
254 .record = (_record), \
255 .get_value = (_get_value), \
256 .destroy = (_destroy), \
260 #define lttng_kernel_static_enum_entry_value(_string, _value) \
261 __LTTNG_COMPOUND_LITERAL(const struct lttng_kernel_enum_entry, { \
263 .signedness = lttng_is_signed_type(__typeof__(_value)), \
264 .value = lttng_is_signed_type(__typeof__(_value)) ? \
265 (long long) (_value) : (_value), \
268 .signedness = lttng_is_signed_type(__typeof__(_value)), \
269 .value = lttng_is_signed_type(__typeof__(_value)) ? \
270 (long long) (_value) : (_value), \
272 .string = (_string), \
275 #define lttng_kernel_static_enum_entry_range(_string, _range_start, _range_end) \
276 __LTTNG_COMPOUND_LITERAL(const struct lttng_kernel_enum_entry, { \
278 .signedness = lttng_is_signed_type(__typeof__(_range_start)), \
279 .value = lttng_is_signed_type(__typeof__(_range_start)) ? \
280 (long long) (_range_start) : (_range_start), \
283 .signedness = lttng_is_signed_type(__typeof__(_range_end)), \
284 .value = lttng_is_signed_type(__typeof__(_range_end)) ? \
285 (long long) (_range_end) : (_range_end), \
287 .string = (_string), \
290 #define lttng_kernel_static_enum_entry_auto(_string) \
291 __LTTNG_COMPOUND_LITERAL(const struct lttng_kernel_enum_entry, { \
300 .string = (_string), \
306 union lttng_ctx_value
{
313 * We need to keep this perf counter field separately from struct
314 * lttng_kernel_ctx_field because cpu hotplug needs fixed-location addresses.
316 struct lttng_perf_counter_field
{
317 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,10,0))
318 struct lttng_cpuhp_node cpuhp_prepare
;
319 struct lttng_cpuhp_node cpuhp_online
;
321 struct notifier_block nb
;
324 struct perf_event_attr
*attr
;
325 struct perf_event
**e
; /* per-cpu array */
327 struct lttng_kernel_event_field
*event_field
;
330 struct lttng_probe_ctx
{
331 struct lttng_event
*event
;
332 struct lttng_event_notifier
*event_notifier
; // Not sure if we will ever need it.
333 uint8_t interruptible
;
336 struct lttng_kernel_ctx_field
{
337 const struct lttng_kernel_event_field
*event_field
;
338 size_t (*get_size
)(size_t offset
);
339 size_t (*get_size_arg
)(size_t offset
, struct lttng_kernel_ctx_field
*field
,
340 struct lib_ring_buffer_ctx
*ctx
,
341 struct lttng_channel
*chan
);
342 void (*record
)(struct lttng_kernel_ctx_field
*field
,
343 struct lib_ring_buffer_ctx
*ctx
,
344 struct lttng_channel
*chan
);
345 void (*get_value
)(struct lttng_kernel_ctx_field
*field
,
346 struct lttng_probe_ctx
*lttng_probe_ctx
,
347 union lttng_ctx_value
*value
);
348 void (*destroy
)(struct lttng_kernel_ctx_field
*field
);
352 struct lttng_kernel_ctx
{
353 struct lttng_kernel_ctx_field
*fields
;
354 unsigned int nr_fields
;
355 unsigned int allocated_fields
;
356 size_t largest_align
; /* in bytes */
359 struct lttng_kernel_event_desc
{
360 const char *event_name
; /* lttng-modules name */
361 const char *event_kname
; /* Linux kernel name (tracepoints) */
362 const struct lttng_kernel_probe_desc
*probe_desc
;
363 void (*probe_callback
)(void);
364 const struct lttng_kernel_event_field
**fields
; /* event payload */
365 unsigned int nr_fields
;
366 struct module
*owner
;
367 void *event_notifier_callback
;
370 struct lttng_kernel_probe_desc
{
371 const char *provider_name
;
372 const struct lttng_kernel_event_desc
**event_desc
;
373 unsigned int nr_events
;
374 struct list_head head
; /* chain registered probes */
375 struct list_head lazy_init_head
;
376 int lazy
; /* lazy registration */
379 struct lttng_krp
; /* Kretprobe handling */
381 enum lttng_event_type
{
382 LTTNG_TYPE_EVENT
= 0,
383 LTTNG_TYPE_ENABLER
= 1,
386 enum lttng_bytecode_node_type
{
387 LTTNG_BYTECODE_NODE_TYPE_FILTER
,
388 LTTNG_BYTECODE_NODE_TYPE_CAPTURE
,
391 struct lttng_bytecode_node
{
392 enum lttng_bytecode_node_type type
;
393 struct list_head node
;
394 struct lttng_enabler
*enabler
;
397 uint32_t reloc_offset
;
404 * Bytecode interpreter return value masks.
406 enum lttng_bytecode_interpreter_ret
{
407 LTTNG_INTERPRETER_DISCARD
= 0,
408 LTTNG_INTERPRETER_RECORD_FLAG
= (1ULL << 0),
409 /* Other bits are kept for future use. */
412 struct lttng_interpreter_output
;
414 struct lttng_bytecode_runtime
{
415 /* Associated bytecode */
416 struct lttng_bytecode_node
*bc
;
418 uint64_t (*filter
)(void *filter_data
,
419 struct lttng_probe_ctx
*lttng_probe_ctx
,
420 const char *filter_stack_data
);
421 uint64_t (*capture
)(void *filter_data
,
422 struct lttng_probe_ctx
*lttng_probe_ctx
,
423 const char *capture_stack_data
,
424 struct lttng_interpreter_output
*output
);
427 struct list_head node
; /* list of bytecode runtime in event */
428 struct lttng_kernel_ctx
*ctx
;
432 * Objects in a linked-list of enablers, owned by an event.
434 struct lttng_enabler_ref
{
435 struct list_head node
; /* enabler ref list */
436 struct lttng_enabler
*ref
; /* backward ref */
439 struct lttng_uprobe_handler
{
441 struct lttng_event
*event
;
442 struct lttng_event_notifier
*event_notifier
;
445 struct uprobe_consumer up_consumer
;
446 struct list_head node
;
449 struct lttng_kprobe
{
454 struct lttng_uprobe
{
456 struct list_head head
;
459 enum lttng_syscall_entryexit
{
464 enum lttng_syscall_abi
{
465 LTTNG_SYSCALL_ABI_NATIVE
,
466 LTTNG_SYSCALL_ABI_COMPAT
,
470 * lttng_event structure is referred to by the tracing fast path. It must be
474 enum lttng_event_type evtype
; /* First field. */
476 struct lttng_channel
*chan
;
478 const struct lttng_kernel_event_desc
*desc
;
480 struct lttng_kernel_ctx
*ctx
;
481 enum lttng_kernel_abi_instrumentation instrumentation
;
483 struct lttng_kprobe kprobe
;
485 struct lttng_krp
*lttng_krp
;
488 struct lttng_uprobe uprobe
;
490 enum lttng_syscall_entryexit entryexit
;
491 enum lttng_syscall_abi abi
;
492 struct hlist_node node
; /* chain registered syscall event */
495 struct list_head list
; /* Event list in session */
496 unsigned int metadata_dumped
:1;
498 /* Backward references: list of lttng_enabler_ref (ref to enablers) */
499 struct list_head enablers_ref_head
;
500 struct hlist_node hlist
; /* session ht of events */
501 int registered
; /* has reg'd tracepoint probe */
502 /* list of struct lttng_bytecode_runtime, sorted by seqnum */
503 struct list_head filter_bytecode_runtime_head
;
504 int has_enablers_without_bytecode
;
507 struct lttng_kernel_notifier_ctx
{
511 // FIXME: Really similar to lttng_event above. Could those be merged ?
512 struct lttng_event_notifier
{
513 enum lttng_event_type evtype
; /* First field. */
515 uint64_t error_counter_index
;
517 int registered
; /* has reg'd tracepoint probe */
518 const struct lttng_kernel_event_desc
*desc
;
520 struct list_head list
; /* event_notifier list in event_notifier group */
522 enum lttng_kernel_abi_instrumentation instrumentation
;
524 struct lttng_kprobe kprobe
;
525 struct lttng_uprobe uprobe
;
527 enum lttng_syscall_entryexit entryexit
;
528 enum lttng_syscall_abi abi
;
529 struct hlist_node node
; /* chain registered syscall event_notifier */
530 unsigned int syscall_id
;
535 /* Backward references: list of lttng_enabler_ref (ref to enablers) */
536 struct list_head enablers_ref_head
;
537 struct hlist_node hlist
; /* session ht of event_notifiers */
538 /* list of struct lttng_bytecode_runtime, sorted by seqnum */
539 struct list_head filter_bytecode_runtime_head
;
541 struct list_head capture_bytecode_runtime_head
;
542 int has_enablers_without_bytecode
;
543 int eval_capture
; /* Should evaluate capture */
545 void (*send_notification
)(struct lttng_event_notifier
*event_notifier
,
546 struct lttng_probe_ctx
*lttng_probe_ctx
,
547 const char *interpreter_stack_data
,
548 struct lttng_kernel_notifier_ctx
*notif_ctx
);
549 struct lttng_event_notifier_group
*group
; /* Weak ref */
552 enum lttng_enabler_format_type
{
553 LTTNG_ENABLER_FORMAT_STAR_GLOB
,
554 LTTNG_ENABLER_FORMAT_NAME
,
558 * Enabler field, within whatever object is enabling an event. Target of
559 * backward reference.
561 struct lttng_enabler
{
562 enum lttng_event_type evtype
; /* First field. */
564 enum lttng_enabler_format_type format_type
;
566 /* head list of struct lttng_bytecode_node */
567 struct list_head filter_bytecode_head
;
569 struct lttng_kernel_abi_event event_param
;
570 unsigned int enabled
:1;
572 uint64_t user_token
; /* User-provided token. */
575 struct lttng_event_enabler
{
576 struct lttng_enabler base
;
577 struct list_head node
; /* per-session list of enablers */
578 struct lttng_channel
*chan
;
580 * Unused, but kept around to make it explicit that the tracer can do
583 struct lttng_kernel_ctx
*ctx
;
586 struct lttng_event_notifier_enabler
{
587 struct lttng_enabler base
;
588 uint64_t error_counter_index
;
589 struct list_head node
; /* List of event_notifier enablers */
590 struct lttng_event_notifier_group
*group
;
592 /* head list of struct lttng_bytecode_node */
593 struct list_head capture_bytecode_head
;
594 uint64_t num_captures
;
599 struct lttng_enabler
*lttng_event_enabler_as_enabler(
600 struct lttng_event_enabler
*event_enabler
)
602 return &event_enabler
->base
;
606 struct lttng_enabler
*lttng_event_notifier_enabler_as_enabler(
607 struct lttng_event_notifier_enabler
*event_notifier_enabler
)
609 return &event_notifier_enabler
->base
;
612 struct lttng_channel_ops
{
613 struct channel
*(*channel_create
)(const char *name
,
616 size_t subbuf_size
, size_t num_subbuf
,
617 unsigned int switch_timer_interval
,
618 unsigned int read_timer_interval
);
619 void (*channel_destroy
)(struct channel
*chan
);
620 struct lib_ring_buffer
*(*buffer_read_open
)(struct channel
*chan
);
621 int (*buffer_has_read_closed_stream
)(struct channel
*chan
);
622 void (*buffer_read_close
)(struct lib_ring_buffer
*buf
);
623 int (*event_reserve
)(struct lib_ring_buffer_ctx
*ctx
,
625 void (*event_commit
)(struct lib_ring_buffer_ctx
*ctx
);
626 void (*event_write
)(struct lib_ring_buffer_ctx
*ctx
, const void *src
,
628 void (*event_write_from_user
)(struct lib_ring_buffer_ctx
*ctx
,
629 const void *src
, size_t len
);
630 void (*event_memset
)(struct lib_ring_buffer_ctx
*ctx
,
632 void (*event_strcpy
)(struct lib_ring_buffer_ctx
*ctx
, const char *src
,
634 void (*event_strcpy_from_user
)(struct lib_ring_buffer_ctx
*ctx
,
635 const char __user
*src
, size_t len
);
637 * packet_avail_size returns the available size in the current
638 * packet. Note that the size returned is only a hint, since it
639 * may change due to concurrent writes.
641 size_t (*packet_avail_size
)(struct channel
*chan
);
642 wait_queue_head_t
*(*get_writer_buf_wait_queue
)(struct channel
*chan
, int cpu
);
643 wait_queue_head_t
*(*get_hp_wait_queue
)(struct channel
*chan
);
644 int (*is_finalized
)(struct channel
*chan
);
645 int (*is_disabled
)(struct channel
*chan
);
646 int (*timestamp_begin
) (const struct lib_ring_buffer_config
*config
,
647 struct lib_ring_buffer
*bufb
,
648 uint64_t *timestamp_begin
);
649 int (*timestamp_end
) (const struct lib_ring_buffer_config
*config
,
650 struct lib_ring_buffer
*bufb
,
651 uint64_t *timestamp_end
);
652 int (*events_discarded
) (const struct lib_ring_buffer_config
*config
,
653 struct lib_ring_buffer
*bufb
,
654 uint64_t *events_discarded
);
655 int (*content_size
) (const struct lib_ring_buffer_config
*config
,
656 struct lib_ring_buffer
*bufb
,
657 uint64_t *content_size
);
658 int (*packet_size
) (const struct lib_ring_buffer_config
*config
,
659 struct lib_ring_buffer
*bufb
,
660 uint64_t *packet_size
);
661 int (*stream_id
) (const struct lib_ring_buffer_config
*config
,
662 struct lib_ring_buffer
*bufb
,
663 uint64_t *stream_id
);
664 int (*current_timestamp
) (const struct lib_ring_buffer_config
*config
,
665 struct lib_ring_buffer
*bufb
,
667 int (*sequence_number
) (const struct lib_ring_buffer_config
*config
,
668 struct lib_ring_buffer
*bufb
,
670 int (*instance_id
) (const struct lib_ring_buffer_config
*config
,
671 struct lib_ring_buffer
*bufb
,
675 struct lttng_counter_ops
{
676 struct lib_counter
*(*counter_create
)(size_t nr_dimensions
,
677 const size_t *max_nr_elem
, /* for each dimension */
678 int64_t global_sum_step
);
679 void (*counter_destroy
)(struct lib_counter
*counter
);
680 int (*counter_add
)(struct lib_counter
*counter
, const size_t *dimension_indexes
,
683 * counter_read reads a specific cpu's counter if @cpu >= 0, or
684 * the global aggregation counter if @cpu == -1.
686 int (*counter_read
)(struct lib_counter
*counter
, const size_t *dimension_indexes
, int cpu
,
687 int64_t *value
, bool *overflow
, bool *underflow
);
689 * counter_aggregate returns the total sum of all per-cpu counters and
690 * the global aggregation counter.
692 int (*counter_aggregate
)(struct lib_counter
*counter
, const size_t *dimension_indexes
,
693 int64_t *value
, bool *overflow
, bool *underflow
);
694 int (*counter_clear
)(struct lib_counter
*counter
, const size_t *dimension_indexes
);
697 struct lttng_transport
{
699 struct module
*owner
;
700 struct list_head node
;
701 struct lttng_channel_ops ops
;
704 struct lttng_counter_transport
{
706 struct module
*owner
;
707 struct list_head node
;
708 struct lttng_counter_ops ops
;
711 struct lttng_syscall_filter
;
713 #define LTTNG_EVENT_HT_BITS 12
714 #define LTTNG_EVENT_HT_SIZE (1U << LTTNG_EVENT_HT_BITS)
716 struct lttng_event_ht
{
717 struct hlist_head table
[LTTNG_EVENT_HT_SIZE
];
720 #define LTTNG_EVENT_NOTIFIER_HT_BITS 12
721 #define LTTNG_EVENT_NOTIFIER_HT_SIZE (1U << LTTNG_EVENT_NOTIFIER_HT_BITS)
723 struct lttng_event_notifier_ht
{
724 struct hlist_head table
[LTTNG_EVENT_NOTIFIER_HT_SIZE
];
727 struct lttng_channel
{
729 struct channel
*chan
; /* Channel buffers */
731 struct lttng_kernel_ctx
*ctx
;
732 /* Event ID management */
733 struct lttng_session
*session
;
734 struct file
*file
; /* File associated to channel */
735 unsigned int free_event_id
; /* Next event ID to allocate */
736 struct list_head list
; /* Channel list */
737 struct lttng_channel_ops
*ops
;
738 struct lttng_transport
*transport
;
739 struct hlist_head
*sc_table
; /* for syscall tracing */
740 struct hlist_head
*compat_sc_table
;
741 struct hlist_head
*sc_exit_table
; /* for syscall exit tracing */
742 struct hlist_head
*compat_sc_exit_table
;
743 struct hlist_head sc_unknown
; /* for unknown syscalls */
744 struct hlist_head sc_compat_unknown
;
745 struct hlist_head sc_exit_unknown
;
746 struct hlist_head compat_sc_exit_unknown
;
747 struct lttng_syscall_filter
*sc_filter
;
748 int header_type
; /* 0: unset, 1: compact, 2: large */
749 enum channel_type channel_type
;
750 int syscall_all_entry
;
751 int syscall_all_exit
;
752 unsigned int metadata_dumped
:1,
753 sys_enter_registered
:1,
754 sys_exit_registered
:1,
755 tstate
:1; /* Transient enable state */
758 struct lttng_metadata_stream
{
759 void *priv
; /* Ring buffer private data */
760 struct lttng_metadata_cache
*metadata_cache
;
761 unsigned int metadata_in
; /* Bytes read from the cache */
762 unsigned int metadata_out
; /* Bytes consumed from stream */
763 int finalized
; /* Has channel been finalized */
764 wait_queue_head_t read_wait
; /* Reader buffer-level wait queue */
765 struct list_head list
; /* Stream list */
766 struct lttng_transport
*transport
;
767 uint64_t version
; /* Current version of the metadata cache */
768 bool coherent
; /* Stream in a coherent state */
771 #define LTTNG_DYNAMIC_LEN_STACK_SIZE 128
773 struct lttng_dynamic_len_stack
{
774 size_t stack
[LTTNG_DYNAMIC_LEN_STACK_SIZE
];
778 DECLARE_PER_CPU(struct lttng_dynamic_len_stack
, lttng_dynamic_len_stack
);
781 * struct lttng_id_tracker declared in header due to deferencing of *v
782 * in RCU_INITIALIZER(v).
784 #define LTTNG_ID_HASH_BITS 6
785 #define LTTNG_ID_TABLE_SIZE (1 << LTTNG_ID_HASH_BITS)
798 struct lttng_id_tracker_rcu
{
799 struct hlist_head id_hash
[LTTNG_ID_TABLE_SIZE
];
802 struct lttng_id_tracker
{
803 struct lttng_session
*session
;
804 enum tracker_type tracker_type
;
805 struct lttng_id_tracker_rcu
*p
; /* RCU dereferenced. */
808 struct lttng_id_hash_node
{
809 struct hlist_node hlist
;
813 struct lttng_session
{
814 int active
; /* Is trace session active ? */
815 int been_active
; /* Has trace session been active ? */
816 struct file
*file
; /* File associated to session */
817 struct list_head chan
; /* Channel list head */
818 struct list_head events
; /* Event list head */
819 struct list_head list
; /* Session list */
820 unsigned int free_chan_id
; /* Next chan ID to allocate */
821 uuid_le uuid
; /* Trace session unique ID */
822 struct lttng_metadata_cache
*metadata_cache
;
823 struct lttng_id_tracker pid_tracker
;
824 struct lttng_id_tracker vpid_tracker
;
825 struct lttng_id_tracker uid_tracker
;
826 struct lttng_id_tracker vuid_tracker
;
827 struct lttng_id_tracker gid_tracker
;
828 struct lttng_id_tracker vgid_tracker
;
829 unsigned int metadata_dumped
:1,
830 tstate
:1; /* Transient enable state */
831 /* List of event enablers */
832 struct list_head enablers_head
;
833 /* Hash table of events */
834 struct lttng_event_ht events_ht
;
835 char name
[LTTNG_KERNEL_ABI_SESSION_NAME_LEN
];
836 char creation_time
[LTTNG_KERNEL_ABI_SESSION_CREATION_TIME_ISO8601_LEN
];
839 struct lttng_counter
{
840 struct file
*file
; /* File associated to counter. */
842 struct lttng_counter_transport
*transport
;
843 struct lib_counter
*counter
;
844 struct lttng_counter_ops
*ops
;
847 struct lttng_event_notifier_group
{
848 struct file
*file
; /* File associated to event notifier group */
849 struct file
*notif_file
; /* File used to expose notifications to userspace. */
850 struct list_head node
; /* event notifier group list */
851 struct list_head enablers_head
; /* List of enablers */
852 struct list_head event_notifiers_head
; /* List of event notifier */
853 struct lttng_event_notifier_ht event_notifiers_ht
; /* Hash table of event notifiers */
854 struct lttng_channel_ops
*ops
;
855 struct lttng_transport
*transport
;
856 struct channel
*chan
; /* Ring buffer channel for event notifier group. */
857 struct lib_ring_buffer
*buf
; /* Ring buffer for event notifier group. */
858 wait_queue_head_t read_wait
;
859 struct irq_work wakeup_pending
; /* Pending wakeup irq work. */
860 struct lttng_event_notifier
*sc_unknown
; /* for unknown syscalls */
861 struct lttng_event_notifier
*sc_compat_unknown
;
863 struct lttng_syscall_filter
*sc_filter
;
865 struct hlist_head
*event_notifier_syscall_dispatch
;
866 struct hlist_head
*event_notifier_compat_syscall_dispatch
;
867 struct hlist_head
*event_notifier_exit_syscall_dispatch
;
868 struct hlist_head
*event_notifier_exit_compat_syscall_dispatch
;
870 struct hlist_head event_notifier_unknown_syscall_dispatch
;
871 struct hlist_head event_notifier_compat_unknown_syscall_dispatch
;
872 struct hlist_head event_notifier_exit_unknown_syscall_dispatch
;
873 struct hlist_head event_notifier_exit_compat_unknown_syscall_dispatch
;
875 int syscall_all_entry
;
876 int syscall_all_exit
;
878 unsigned int sys_enter_registered
:1, sys_exit_registered
:1;
880 struct lttng_counter
*error_counter
;
881 size_t error_counter_len
;
884 struct lttng_metadata_cache
{
885 char *data
; /* Metadata cache */
886 unsigned int cache_alloc
; /* Metadata allocated size (bytes) */
887 unsigned int metadata_written
; /* Number of bytes written in metadata cache */
888 atomic_t producing
; /* Metadata being produced (incomplete) */
889 struct kref refcount
; /* Metadata cache usage */
890 struct list_head metadata_stream
; /* Metadata stream list */
891 uuid_le uuid
; /* Trace session unique ID (copy) */
892 struct mutex lock
; /* Produce/consume lock */
893 uint64_t version
; /* Current version of the metadata */
896 void lttng_lock_sessions(void);
897 void lttng_unlock_sessions(void);
899 struct list_head
*lttng_get_probe_list_head(void);
901 struct lttng_event_enabler
*lttng_event_enabler_create(
902 enum lttng_enabler_format_type format_type
,
903 struct lttng_kernel_abi_event
*event_param
,
904 struct lttng_channel
*chan
);
906 int lttng_event_enabler_enable(struct lttng_event_enabler
*event_enabler
);
907 int lttng_event_enabler_disable(struct lttng_event_enabler
*event_enabler
);
908 struct lttng_event_notifier_enabler
*lttng_event_notifier_enabler_create(
909 struct lttng_event_notifier_group
*event_notifier_group
,
910 enum lttng_enabler_format_type format_type
,
911 struct lttng_kernel_abi_event_notifier
*event_notifier_param
);
913 int lttng_event_notifier_enabler_enable(
914 struct lttng_event_notifier_enabler
*event_notifier_enabler
);
915 int lttng_event_notifier_enabler_disable(
916 struct lttng_event_notifier_enabler
*event_notifier_enabler
);
917 int lttng_fix_pending_events(void);
918 int lttng_fix_pending_event_notifiers(void);
919 int lttng_session_active(void);
920 bool lttng_event_notifier_active(void);
922 struct lttng_session
*lttng_session_create(void);
923 int lttng_session_enable(struct lttng_session
*session
);
924 int lttng_session_disable(struct lttng_session
*session
);
925 void lttng_session_destroy(struct lttng_session
*session
);
926 int lttng_session_metadata_regenerate(struct lttng_session
*session
);
927 int lttng_session_statedump(struct lttng_session
*session
);
928 void metadata_cache_destroy(struct kref
*kref
);
930 struct lttng_counter
*lttng_kernel_counter_create(
931 const char *counter_transport_name
, size_t number_dimensions
,
932 const size_t *dimensions_sizes
);
933 int lttng_kernel_counter_read(struct lttng_counter
*counter
,
934 const size_t *dimension_indexes
, int32_t cpu
,
935 int64_t *val
, bool *overflow
, bool *underflow
);
936 int lttng_kernel_counter_aggregate(struct lttng_counter
*counter
,
937 const size_t *dimension_indexes
, int64_t *val
,
938 bool *overflow
, bool *underflow
);
939 int lttng_kernel_counter_clear(struct lttng_counter
*counter
,
940 const size_t *dimension_indexes
);
943 struct lttng_event_notifier_group
*lttng_event_notifier_group_create(void);
944 int lttng_event_notifier_group_create_error_counter(
945 struct file
*event_notifier_group_file
,
946 const struct lttng_kernel_abi_counter_conf
*error_counter_conf
);
947 void lttng_event_notifier_group_destroy(
948 struct lttng_event_notifier_group
*event_notifier_group
);
950 struct lttng_channel
*lttng_channel_create(struct lttng_session
*session
,
951 const char *transport_name
,
953 size_t subbuf_size
, size_t num_subbuf
,
954 unsigned int switch_timer_interval
,
955 unsigned int read_timer_interval
,
956 enum channel_type channel_type
);
957 struct lttng_channel
*lttng_global_channel_create(struct lttng_session
*session
,
958 int overwrite
, void *buf_addr
,
959 size_t subbuf_size
, size_t num_subbuf
,
960 unsigned int switch_timer_interval
,
961 unsigned int read_timer_interval
);
963 void lttng_metadata_channel_destroy(struct lttng_channel
*chan
);
964 struct lttng_event
*lttng_event_create(struct lttng_channel
*chan
,
965 struct lttng_kernel_abi_event
*event_param
,
967 const struct lttng_kernel_event_desc
*event_desc
,
968 enum lttng_kernel_abi_instrumentation itype
);
969 struct lttng_event
*_lttng_event_create(struct lttng_channel
*chan
,
970 struct lttng_kernel_abi_event
*event_param
,
972 const struct lttng_kernel_event_desc
*event_desc
,
973 enum lttng_kernel_abi_instrumentation itype
);
974 struct lttng_event
*lttng_event_compat_old_create(struct lttng_channel
*chan
,
975 struct lttng_kernel_abi_old_event
*old_event_param
,
977 const struct lttng_kernel_event_desc
*internal_desc
);
979 struct lttng_event_notifier
*lttng_event_notifier_create(
980 const struct lttng_kernel_event_desc
*event_notifier_desc
,
982 uint64_t error_counter_idx
,
983 struct lttng_event_notifier_group
*event_notifier_group
,
984 struct lttng_kernel_abi_event_notifier
*event_notifier_param
,
986 enum lttng_kernel_abi_instrumentation itype
);
987 struct lttng_event_notifier
*_lttng_event_notifier_create(
988 const struct lttng_kernel_event_desc
*event_notifier_desc
,
990 uint64_t error_counter_idx
,
991 struct lttng_event_notifier_group
*event_notifier_group
,
992 struct lttng_kernel_abi_event_notifier
*event_notifier_param
,
994 enum lttng_kernel_abi_instrumentation itype
);
996 int lttng_channel_enable(struct lttng_channel
*channel
);
997 int lttng_channel_disable(struct lttng_channel
*channel
);
998 int lttng_event_enable(struct lttng_event
*event
);
999 int lttng_event_disable(struct lttng_event
*event
);
1001 int lttng_event_notifier_enable(struct lttng_event_notifier
*event_notifier
);
1002 int lttng_event_notifier_disable(struct lttng_event_notifier
*event_notifier
);
1004 void lttng_transport_register(struct lttng_transport
*transport
);
1005 void lttng_transport_unregister(struct lttng_transport
*transport
);
1007 void lttng_counter_transport_register(struct lttng_counter_transport
*transport
);
1008 void lttng_counter_transport_unregister(struct lttng_counter_transport
*transport
);
1010 void synchronize_trace(void);
1011 int lttng_abi_init(void);
1012 int lttng_abi_compat_old_init(void);
1013 void lttng_abi_exit(void);
1014 void lttng_abi_compat_old_exit(void);
1016 int lttng_probe_register(struct lttng_kernel_probe_desc
*desc
);
1017 void lttng_probe_unregister(struct lttng_kernel_probe_desc
*desc
);
1018 const struct lttng_kernel_event_desc
*lttng_event_desc_get(const char *name
);
1019 void lttng_event_desc_put(const struct lttng_kernel_event_desc
*desc
);
1020 int lttng_probes_init(void);
1021 void lttng_probes_exit(void);
1023 int lttng_metadata_output_channel(struct lttng_metadata_stream
*stream
,
1024 struct channel
*chan
, bool *coherent
);
1026 int lttng_id_tracker_get_node_id(const struct lttng_id_hash_node
*node
);
1027 int lttng_id_tracker_empty_set(struct lttng_id_tracker
*lf
);
1028 void lttng_id_tracker_destroy(struct lttng_id_tracker
*lf
, bool rcu
);
1029 bool lttng_id_tracker_lookup(struct lttng_id_tracker_rcu
*p
, int id
);
1030 int lttng_id_tracker_add(struct lttng_id_tracker
*lf
, int id
);
1031 int lttng_id_tracker_del(struct lttng_id_tracker
*lf
, int id
);
1033 int lttng_session_track_id(struct lttng_session
*session
,
1034 enum tracker_type tracker_type
, int id
);
1035 int lttng_session_untrack_id(struct lttng_session
*session
,
1036 enum tracker_type tracker_type
, int id
);
1038 int lttng_session_list_tracker_ids(struct lttng_session
*session
,
1039 enum tracker_type tracker_type
);
1041 void lttng_clock_ref(void);
1042 void lttng_clock_unref(void);
1044 int lttng_desc_match_enabler(const struct lttng_kernel_event_desc
*desc
,
1045 struct lttng_enabler
*enabler
);
1047 #if defined(CONFIG_HAVE_SYSCALL_TRACEPOINTS)
1048 int lttng_syscalls_register_event(struct lttng_event_enabler
*event_enabler
, void *filter
);
1049 int lttng_syscalls_unregister_channel(struct lttng_channel
*chan
);
1050 int lttng_syscalls_destroy_event(struct lttng_channel
*chan
);
1051 int lttng_syscall_filter_enable_event(
1052 struct lttng_channel
*chan
,
1053 struct lttng_event
*event
);
1054 int lttng_syscall_filter_disable_event(
1055 struct lttng_channel
*chan
,
1056 struct lttng_event
*event
);
1058 long lttng_channel_syscall_mask(struct lttng_channel
*channel
,
1059 struct lttng_kernel_abi_syscall_mask __user
*usyscall_mask
);
1061 int lttng_syscalls_register_event_notifier(
1062 struct lttng_event_notifier_enabler
*event_notifier_enabler
,
1064 int lttng_syscals_create_matching_event_notifiers(
1065 struct lttng_event_notifier_enabler
*event_notifier_enabler
, void *filter
);
1066 int lttng_syscalls_unregister_event_notifier_group(struct lttng_event_notifier_group
*group
);
1067 int lttng_syscall_filter_enable_event_notifier(struct lttng_event_notifier
*event_notifier
);
1068 int lttng_syscall_filter_disable_event_notifier(struct lttng_event_notifier
*event_notifier
);
1070 static inline int lttng_syscalls_register_event(
1071 struct lttng_event_enabler
*event_enabler
, void *filter
)
1076 static inline int lttng_syscalls_unregister_channel(struct lttng_channel
*chan
)
1081 static inline int lttng_syscalls_destroy(struct lttng_channel
*chan
)
1086 static inline int lttng_syscall_filter_enable_event(struct lttng_channel
*chan
,
1087 struct lttng_event
*event
);
1092 static inline int lttng_syscall_filter_disable_event(struct lttng_channel
*chan
,
1093 struct lttng_event
*event
);
1098 static inline long lttng_channel_syscall_mask(struct lttng_channel
*channel
,
1099 struct lttng_kernel_syscall_mask __user
*usyscall_mask
)
1104 static inline int lttng_syscalls_register_event_notifier(
1105 struct lttng_event_notifier_group
*group
, void *filter
)
1110 static inline int lttng_syscalls_unregister_event_notifier_group(
1111 struct lttng_event_notifier_group
*group
)
1116 static inline int lttng_syscall_filter_enable_event_notifier(
1117 struct lttng_event_notifier_group
*group
,
1123 static inline int lttng_syscall_filter_disable_event_notifier(
1124 struct lttng_event_notifier_group
*group
,
1132 int lttng_event_enabler_attach_filter_bytecode(struct lttng_event_enabler
*event_enabler
,
1133 struct lttng_kernel_abi_filter_bytecode __user
*bytecode
);
1134 int lttng_event_notifier_enabler_attach_filter_bytecode(
1135 struct lttng_event_notifier_enabler
*event_notifier_enabler
,
1136 struct lttng_kernel_abi_filter_bytecode __user
*bytecode
);
1137 int lttng_event_notifier_enabler_attach_capture_bytecode(
1138 struct lttng_event_notifier_enabler
*event_notifier_enabler
,
1139 struct lttng_kernel_abi_capture_bytecode __user
*bytecode
);
1141 void lttng_enabler_link_bytecode(const struct lttng_kernel_event_desc
*event_desc
,
1142 struct lttng_kernel_ctx
*ctx
,
1143 struct list_head
*instance_bytecode_runtime_head
,
1144 struct list_head
*enabler_bytecode_runtime_head
);
1145 void lttng_free_event_filter_runtime(struct lttng_event
*event
);
1146 void lttng_free_event_notifier_filter_runtime(struct lttng_event_notifier
*event_notifier
);
1148 int lttng_probes_init(void);
1150 extern struct lttng_kernel_ctx
*lttng_static_ctx
;
1152 int lttng_context_init(void);
1153 void lttng_context_exit(void);
1154 int lttng_kernel_context_append(struct lttng_kernel_ctx
**ctx_p
,
1155 const struct lttng_kernel_ctx_field
*f
);
1156 void lttng_kernel_context_remove_last(struct lttng_kernel_ctx
**ctx_p
);
1157 struct lttng_kernel_ctx_field
*lttng_kernel_get_context_field_from_index(struct lttng_kernel_ctx
*ctx
,
1159 int lttng_kernel_find_context(struct lttng_kernel_ctx
*ctx
, const char *name
);
1160 int lttng_kernel_get_context_index(struct lttng_kernel_ctx
*ctx
, const char *name
);
1161 void lttng_kernel_destroy_context(struct lttng_kernel_ctx
*ctx
);
1162 int lttng_add_pid_to_ctx(struct lttng_kernel_ctx
**ctx
);
1163 int lttng_add_cpu_id_to_ctx(struct lttng_kernel_ctx
**ctx
);
1164 int lttng_add_procname_to_ctx(struct lttng_kernel_ctx
**ctx
);
1165 int lttng_add_prio_to_ctx(struct lttng_kernel_ctx
**ctx
);
1166 int lttng_add_nice_to_ctx(struct lttng_kernel_ctx
**ctx
);
1167 int lttng_add_vpid_to_ctx(struct lttng_kernel_ctx
**ctx
);
1168 int lttng_add_tid_to_ctx(struct lttng_kernel_ctx
**ctx
);
1169 int lttng_add_vtid_to_ctx(struct lttng_kernel_ctx
**ctx
);
1170 int lttng_add_ppid_to_ctx(struct lttng_kernel_ctx
**ctx
);
1171 int lttng_add_vppid_to_ctx(struct lttng_kernel_ctx
**ctx
);
1172 int lttng_add_hostname_to_ctx(struct lttng_kernel_ctx
**ctx
);
1173 int lttng_add_interruptible_to_ctx(struct lttng_kernel_ctx
**ctx
);
1174 int lttng_add_need_reschedule_to_ctx(struct lttng_kernel_ctx
**ctx
);
1175 #if defined(CONFIG_PREEMPT_RT_FULL) || defined(CONFIG_PREEMPT)
1176 int lttng_add_preemptible_to_ctx(struct lttng_kernel_ctx
**ctx
);
1179 int lttng_add_preemptible_to_ctx(struct lttng_kernel_ctx
**ctx
)
1184 #ifdef CONFIG_PREEMPT_RT_FULL
1185 int lttng_add_migratable_to_ctx(struct lttng_kernel_ctx
**ctx
);
1188 int lttng_add_migratable_to_ctx(struct lttng_kernel_ctx
**ctx
)
1194 int lttng_add_callstack_to_ctx(struct lttng_kernel_ctx
**ctx
, int type
);
1196 #if defined(CONFIG_CGROUPS) && \
1197 ((LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,6,0)) || \
1198 LTTNG_UBUNTU_KERNEL_RANGE(4,4,0,0, 4,5,0,0))
1199 int lttng_add_cgroup_ns_to_ctx(struct lttng_kernel_ctx
**ctx
);
1202 int lttng_add_cgroup_ns_to_ctx(struct lttng_kernel_ctx
**ctx
)
1208 #if defined(CONFIG_IPC_NS) && \
1209 (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,8,0))
1210 int lttng_add_ipc_ns_to_ctx(struct lttng_kernel_ctx
**ctx
);
1213 int lttng_add_ipc_ns_to_ctx(struct lttng_kernel_ctx
**ctx
)
1219 #if !defined(LTTNG_MNT_NS_MISSING_HEADER) && \
1220 (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,8,0))
1221 int lttng_add_mnt_ns_to_ctx(struct lttng_kernel_ctx
**ctx
);
1224 int lttng_add_mnt_ns_to_ctx(struct lttng_kernel_ctx
**ctx
)
1230 #if defined(CONFIG_NET_NS) && \
1231 (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,8,0))
1232 int lttng_add_net_ns_to_ctx(struct lttng_kernel_ctx
**ctx
);
1235 int lttng_add_net_ns_to_ctx(struct lttng_kernel_ctx
**ctx
)
1241 #if defined(CONFIG_PID_NS) && \
1242 (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,8,0))
1243 int lttng_add_pid_ns_to_ctx(struct lttng_kernel_ctx
**ctx
);
1246 int lttng_add_pid_ns_to_ctx(struct lttng_kernel_ctx
**ctx
)
1252 #if defined(CONFIG_USER_NS) && \
1253 (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,8,0))
1254 int lttng_add_user_ns_to_ctx(struct lttng_kernel_ctx
**ctx
);
1257 int lttng_add_user_ns_to_ctx(struct lttng_kernel_ctx
**ctx
)
1263 #if defined(CONFIG_UTS_NS) && \
1264 (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,8,0))
1265 int lttng_add_uts_ns_to_ctx(struct lttng_kernel_ctx
**ctx
);
1268 int lttng_add_uts_ns_to_ctx(struct lttng_kernel_ctx
**ctx
)
1274 #if defined(CONFIG_TIME_NS) && \
1275 (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,6,0))
1276 int lttng_add_time_ns_to_ctx(struct lttng_kernel_ctx
**ctx
);
1279 int lttng_add_time_ns_to_ctx(struct lttng_kernel_ctx
**ctx
)
1285 int lttng_add_uid_to_ctx(struct lttng_kernel_ctx
**ctx
);
1286 int lttng_add_euid_to_ctx(struct lttng_kernel_ctx
**ctx
);
1287 int lttng_add_suid_to_ctx(struct lttng_kernel_ctx
**ctx
);
1288 int lttng_add_gid_to_ctx(struct lttng_kernel_ctx
**ctx
);
1289 int lttng_add_egid_to_ctx(struct lttng_kernel_ctx
**ctx
);
1290 int lttng_add_sgid_to_ctx(struct lttng_kernel_ctx
**ctx
);
1291 int lttng_add_vuid_to_ctx(struct lttng_kernel_ctx
**ctx
);
1292 int lttng_add_veuid_to_ctx(struct lttng_kernel_ctx
**ctx
);
1293 int lttng_add_vsuid_to_ctx(struct lttng_kernel_ctx
**ctx
);
1294 int lttng_add_vgid_to_ctx(struct lttng_kernel_ctx
**ctx
);
1295 int lttng_add_vegid_to_ctx(struct lttng_kernel_ctx
**ctx
);
1296 int lttng_add_vsgid_to_ctx(struct lttng_kernel_ctx
**ctx
);
1298 #if defined(CONFIG_PERF_EVENTS)
1299 int lttng_add_perf_counter_to_ctx(uint32_t type
,
1302 struct lttng_kernel_ctx
**ctx
);
1303 int lttng_cpuhp_perf_counter_online(unsigned int cpu
,
1304 struct lttng_cpuhp_node
*node
);
1305 int lttng_cpuhp_perf_counter_dead(unsigned int cpu
,
1306 struct lttng_cpuhp_node
*node
);
1309 int lttng_add_perf_counter_to_ctx(uint32_t type
,
1312 struct lttng_kernel_ctx
**ctx
)
1317 int lttng_cpuhp_perf_counter_online(unsigned int cpu
,
1318 struct lttng_cpuhp_node
*node
)
1323 int lttng_cpuhp_perf_counter_dead(unsigned int cpu
,
1324 struct lttng_cpuhp_node
*node
)
1330 int lttng_logger_init(void);
1331 void lttng_logger_exit(void);
1333 extern int lttng_statedump_start(struct lttng_session
*session
);
1335 #ifdef CONFIG_KPROBES
1336 int lttng_kprobes_register_event(const char *name
,
1337 const char *symbol_name
,
1340 struct lttng_event
*event
);
1341 void lttng_kprobes_unregister_event(struct lttng_event
*event
);
1342 void lttng_kprobes_destroy_event_private(struct lttng_event
*event
);
1343 int lttng_kprobes_register_event_notifier(const char *symbol_name
,
1346 struct lttng_event_notifier
*event_notifier
);
1347 void lttng_kprobes_unregister_event_notifier(struct lttng_event_notifier
*event_notifier
);
1348 void lttng_kprobes_destroy_event_notifier_private(struct lttng_event_notifier
*event_notifier
);
1351 int lttng_kprobes_register_event(const char *name
,
1352 const char *symbol_name
,
1355 struct lttng_event
*event
)
1361 void lttng_kprobes_unregister_event(struct lttng_event
*event
)
1366 void lttng_kprobes_destroy_event_private(struct lttng_event
*event
)
1371 int lttng_kprobes_register_event_notifier(const char *symbol_name
,
1374 struct lttng_event_notifier
*event_notifier
)
1380 void lttng_kprobes_unregister_event_notifier(struct lttng_event_notifier
*event_notifier
)
1385 void lttng_kprobes_destroy_event_notifier_private(struct lttng_event_notifier
*event_notifier
)
1390 int lttng_event_add_callsite(struct lttng_event
*event
,
1391 struct lttng_kernel_abi_event_callsite __user
*callsite
);
1393 int lttng_event_notifier_add_callsite(struct lttng_event_notifier
*event_notifier
,
1394 struct lttng_kernel_abi_event_callsite __user
*callsite
);
1396 #ifdef CONFIG_UPROBES
1397 int lttng_uprobes_register_event(const char *name
,
1398 int fd
, struct lttng_event
*event
);
1399 int lttng_uprobes_event_add_callsite(struct lttng_event
*event
,
1400 struct lttng_kernel_abi_event_callsite __user
*callsite
);
1401 void lttng_uprobes_unregister_event(struct lttng_event
*event
);
1402 void lttng_uprobes_destroy_event_private(struct lttng_event
*event
);
1403 int lttng_uprobes_register_event_notifier(const char *name
,
1404 int fd
, struct lttng_event_notifier
*event_notifier
);
1405 int lttng_uprobes_event_notifier_add_callsite(struct lttng_event_notifier
*event_notifier
,
1406 struct lttng_kernel_abi_event_callsite __user
*callsite
);
1407 void lttng_uprobes_unregister_event_notifier(struct lttng_event_notifier
*event_notifier
);
1408 void lttng_uprobes_destroy_event_notifier_private(struct lttng_event_notifier
*event_notifier
);
1411 int lttng_uprobes_register_event(const char *name
,
1412 int fd
, struct lttng_event
*event
)
1418 int lttng_uprobes_event_add_callsite(struct lttng_event
*event
,
1419 struct lttng_kernel_abi_event_callsite __user
*callsite
)
1425 void lttng_uprobes_unregister_event(struct lttng_event
*event
)
1430 void lttng_uprobes_destroy_event_private(struct lttng_event
*event
)
1435 int lttng_uprobes_register_event_notifier(const char *name
,
1436 int fd
, struct lttng_event_notifier
*event_notifier
)
1442 int lttng_uprobes_event_notifier_add_callsite(struct lttng_event_notifier
*event_notifier
,
1443 struct lttng_kernel_abi_event_callsite __user
*callsite
)
1449 void lttng_uprobes_unregister_event_notifier(struct lttng_event_notifier
*event_notifier
)
1454 void lttng_uprobes_destroy_event_notifier_private(struct lttng_event_notifier
*event_notifier
)
1459 #ifdef CONFIG_KRETPROBES
1460 int lttng_kretprobes_register(const char *name
,
1461 const char *symbol_name
,
1464 struct lttng_event
*event_entry
,
1465 struct lttng_event
*event_exit
);
1466 void lttng_kretprobes_unregister(struct lttng_event
*event
);
1467 void lttng_kretprobes_destroy_private(struct lttng_event
*event
);
1468 int lttng_kretprobes_event_enable_state(struct lttng_event
*event
,
1472 int lttng_kretprobes_register(const char *name
,
1473 const char *symbol_name
,
1476 struct lttng_event
*event_entry
,
1477 struct lttng_event
*event_exit
)
1483 void lttng_kretprobes_unregister(struct lttng_event
*event
)
1488 void lttng_kretprobes_destroy_private(struct lttng_event
*event
)
1493 int lttng_kretprobes_event_enable_state(struct lttng_event
*event
,
1500 int lttng_calibrate(struct lttng_kernel_abi_calibrate
*calibrate
);
1502 extern const struct file_operations lttng_tracepoint_list_fops
;
1503 extern const struct file_operations lttng_syscall_list_fops
;
1505 #define TRACEPOINT_HAS_DATA_ARG
1507 #endif /* _LTTNG_EVENTS_H */