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. If NULL, use previous field. */
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
; /* Tag field name. If NULL, use previous field. */
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_kernel_event_common
*event
;
332 uint8_t interruptible
;
335 struct lttng_kernel_ctx_field
{
336 const struct lttng_kernel_event_field
*event_field
;
337 size_t (*get_size
)(size_t offset
);
338 size_t (*get_size_arg
)(size_t offset
, struct lttng_kernel_ctx_field
*field
,
339 struct lib_ring_buffer_ctx
*ctx
,
340 struct lttng_channel
*chan
);
341 void (*record
)(struct lttng_kernel_ctx_field
*field
,
342 struct lib_ring_buffer_ctx
*ctx
,
343 struct lttng_channel
*chan
);
344 void (*get_value
)(struct lttng_kernel_ctx_field
*field
,
345 struct lttng_probe_ctx
*lttng_probe_ctx
,
346 union lttng_ctx_value
*value
);
347 void (*destroy
)(struct lttng_kernel_ctx_field
*field
);
351 struct lttng_kernel_ctx
{
352 struct lttng_kernel_ctx_field
*fields
;
353 unsigned int nr_fields
;
354 unsigned int allocated_fields
;
355 size_t largest_align
; /* in bytes */
358 struct lttng_kernel_event_desc
{
359 const char *event_name
; /* lttng-modules name */
360 const char *event_kname
; /* Linux kernel name (tracepoints) */
361 const struct lttng_kernel_probe_desc
*probe_desc
;
362 void (*probe_callback
)(void);
363 const struct lttng_kernel_event_field
**fields
; /* event payload */
364 unsigned int nr_fields
;
365 struct module
*owner
;
368 struct lttng_kernel_probe_desc
{
369 const char *provider_name
;
370 const struct lttng_kernel_event_desc
**event_desc
;
371 unsigned int nr_events
;
372 struct list_head head
; /* chain registered probes */
373 struct list_head lazy_init_head
;
374 int lazy
; /* lazy registration */
377 struct lttng_krp
; /* Kretprobe handling */
379 enum lttng_kernel_bytecode_type
{
380 LTTNG_KERNEL_BYTECODE_TYPE_FILTER
,
381 LTTNG_KERNEL_BYTECODE_TYPE_CAPTURE
,
384 struct lttng_bytecode_node
{
385 enum lttng_kernel_bytecode_type type
;
386 struct list_head node
;
387 struct lttng_enabler
*enabler
;
390 uint32_t reloc_offset
;
396 struct lttng_interpreter_output
;
398 struct lttng_bytecode_runtime
{
399 /* Associated bytecode */
400 enum lttng_kernel_bytecode_type type
;
401 struct lttng_bytecode_node
*bc
;
402 int (*interpreter_func
)(struct lttng_bytecode_runtime
*kernel_bytecode
,
403 const char *interpreter_stack_data
,
404 struct lttng_probe_ctx
*lttng_probe_ctx
,
407 struct list_head node
; /* list of bytecode runtime in event */
408 struct lttng_kernel_ctx
*ctx
;
412 * Objects in a linked-list of enablers, owned by an event.
414 struct lttng_enabler_ref
{
415 struct list_head node
; /* enabler ref list */
416 struct lttng_enabler
*ref
; /* backward ref */
419 struct lttng_uprobe_handler
{
420 struct lttng_kernel_event_common
*event
;
422 struct uprobe_consumer up_consumer
;
423 struct list_head node
;
426 struct lttng_kprobe
{
431 struct lttng_uprobe
{
433 struct list_head head
;
436 enum lttng_syscall_entryexit
{
441 enum lttng_syscall_abi
{
442 LTTNG_SYSCALL_ABI_NATIVE
,
443 LTTNG_SYSCALL_ABI_COMPAT
,
447 * Result of the run_filter() callback.
449 enum lttng_kernel_event_filter_result
{
450 LTTNG_KERNEL_EVENT_FILTER_ACCEPT
= 0,
451 LTTNG_KERNEL_EVENT_FILTER_REJECT
= 1,
454 struct lttng_kernel_event_common_private
;
456 enum lttng_kernel_event_type
{
457 LTTNG_KERNEL_EVENT_TYPE_RECORDER
= 0,
458 LTTNG_KERNEL_EVENT_TYPE_NOTIFIER
= 1,
461 struct lttng_kernel_event_common
{
462 struct lttng_kernel_event_common_private
*priv
; /* Private event interface */
464 enum lttng_kernel_event_type type
;
465 /* Get child with container_of(). */
468 int eval_filter
; /* Need to evaluate filters */
469 int (*run_filter
)(const struct lttng_kernel_event_common
*event
,
470 const char *stack_data
,
471 struct lttng_probe_ctx
*probe_ctx
,
475 struct lttng_kernel_event_recorder_private
;
477 struct lttng_kernel_event_recorder
{
478 struct lttng_kernel_event_common parent
;
479 struct lttng_kernel_event_recorder_private
*priv
; /* Private event record interface */
481 struct lttng_channel
*chan
;
484 struct lttng_kernel_notification_ctx
{
485 int eval_capture
; /* Capture evaluation available. */
488 struct lttng_kernel_event_notifier_private
;
490 struct lttng_kernel_event_notifier
{
491 struct lttng_kernel_event_common parent
;
492 struct lttng_kernel_event_notifier_private
*priv
; /* Private event notifier interface */
494 int eval_capture
; /* Need to evaluate capture */
495 void (*notification_send
)(struct lttng_kernel_event_notifier
*event_notifier
,
496 const char *stack_data
,
497 struct lttng_probe_ctx
*probe_ctx
,
498 struct lttng_kernel_notification_ctx
*notif_ctx
);
501 enum lttng_enabler_format_type
{
502 LTTNG_ENABLER_FORMAT_STAR_GLOB
,
503 LTTNG_ENABLER_FORMAT_NAME
,
507 * Enabler field, within whatever object is enabling an event. Target of
508 * backward reference.
510 struct lttng_enabler
{
511 enum lttng_enabler_format_type format_type
;
513 /* head list of struct lttng_bytecode_node */
514 struct list_head filter_bytecode_head
;
516 struct lttng_kernel_abi_event event_param
;
517 unsigned int enabled
:1;
519 uint64_t user_token
; /* User-provided token. */
522 struct lttng_event_enabler
{
523 struct lttng_enabler base
;
524 struct list_head node
; /* per-session list of enablers */
525 struct lttng_channel
*chan
;
528 struct lttng_event_notifier_enabler
{
529 struct lttng_enabler base
;
530 uint64_t error_counter_index
;
531 struct list_head node
; /* List of event_notifier enablers */
532 struct lttng_event_notifier_group
*group
;
534 /* head list of struct lttng_bytecode_node */
535 struct list_head capture_bytecode_head
;
536 uint64_t num_captures
;
541 struct lttng_enabler
*lttng_event_enabler_as_enabler(
542 struct lttng_event_enabler
*event_enabler
)
544 return &event_enabler
->base
;
548 struct lttng_enabler
*lttng_event_notifier_enabler_as_enabler(
549 struct lttng_event_notifier_enabler
*event_notifier_enabler
)
551 return &event_notifier_enabler
->base
;
554 struct lttng_channel_ops
{
555 struct channel
*(*channel_create
)(const char *name
,
558 size_t subbuf_size
, size_t num_subbuf
,
559 unsigned int switch_timer_interval
,
560 unsigned int read_timer_interval
);
561 void (*channel_destroy
)(struct channel
*chan
);
562 struct lib_ring_buffer
*(*buffer_read_open
)(struct channel
*chan
);
563 int (*buffer_has_read_closed_stream
)(struct channel
*chan
);
564 void (*buffer_read_close
)(struct lib_ring_buffer
*buf
);
565 int (*event_reserve
)(struct lib_ring_buffer_ctx
*ctx
,
567 void (*event_commit
)(struct lib_ring_buffer_ctx
*ctx
);
568 void (*event_write
)(struct lib_ring_buffer_ctx
*ctx
, const void *src
,
570 void (*event_write_from_user
)(struct lib_ring_buffer_ctx
*ctx
,
571 const void *src
, size_t len
);
572 void (*event_memset
)(struct lib_ring_buffer_ctx
*ctx
,
574 void (*event_strcpy
)(struct lib_ring_buffer_ctx
*ctx
, const char *src
,
576 void (*event_strcpy_from_user
)(struct lib_ring_buffer_ctx
*ctx
,
577 const char __user
*src
, size_t len
);
579 * packet_avail_size returns the available size in the current
580 * packet. Note that the size returned is only a hint, since it
581 * may change due to concurrent writes.
583 size_t (*packet_avail_size
)(struct channel
*chan
);
584 wait_queue_head_t
*(*get_writer_buf_wait_queue
)(struct channel
*chan
, int cpu
);
585 wait_queue_head_t
*(*get_hp_wait_queue
)(struct channel
*chan
);
586 int (*is_finalized
)(struct channel
*chan
);
587 int (*is_disabled
)(struct channel
*chan
);
588 int (*timestamp_begin
) (const struct lib_ring_buffer_config
*config
,
589 struct lib_ring_buffer
*bufb
,
590 uint64_t *timestamp_begin
);
591 int (*timestamp_end
) (const struct lib_ring_buffer_config
*config
,
592 struct lib_ring_buffer
*bufb
,
593 uint64_t *timestamp_end
);
594 int (*events_discarded
) (const struct lib_ring_buffer_config
*config
,
595 struct lib_ring_buffer
*bufb
,
596 uint64_t *events_discarded
);
597 int (*content_size
) (const struct lib_ring_buffer_config
*config
,
598 struct lib_ring_buffer
*bufb
,
599 uint64_t *content_size
);
600 int (*packet_size
) (const struct lib_ring_buffer_config
*config
,
601 struct lib_ring_buffer
*bufb
,
602 uint64_t *packet_size
);
603 int (*stream_id
) (const struct lib_ring_buffer_config
*config
,
604 struct lib_ring_buffer
*bufb
,
605 uint64_t *stream_id
);
606 int (*current_timestamp
) (const struct lib_ring_buffer_config
*config
,
607 struct lib_ring_buffer
*bufb
,
609 int (*sequence_number
) (const struct lib_ring_buffer_config
*config
,
610 struct lib_ring_buffer
*bufb
,
612 int (*instance_id
) (const struct lib_ring_buffer_config
*config
,
613 struct lib_ring_buffer
*bufb
,
617 struct lttng_counter_ops
{
618 struct lib_counter
*(*counter_create
)(size_t nr_dimensions
,
619 const size_t *max_nr_elem
, /* for each dimension */
620 int64_t global_sum_step
);
621 void (*counter_destroy
)(struct lib_counter
*counter
);
622 int (*counter_add
)(struct lib_counter
*counter
, const size_t *dimension_indexes
,
625 * counter_read reads a specific cpu's counter if @cpu >= 0, or
626 * the global aggregation counter if @cpu == -1.
628 int (*counter_read
)(struct lib_counter
*counter
, const size_t *dimension_indexes
, int cpu
,
629 int64_t *value
, bool *overflow
, bool *underflow
);
631 * counter_aggregate returns the total sum of all per-cpu counters and
632 * the global aggregation counter.
634 int (*counter_aggregate
)(struct lib_counter
*counter
, const size_t *dimension_indexes
,
635 int64_t *value
, bool *overflow
, bool *underflow
);
636 int (*counter_clear
)(struct lib_counter
*counter
, const size_t *dimension_indexes
);
639 struct lttng_transport
{
641 struct module
*owner
;
642 struct list_head node
;
643 struct lttng_channel_ops ops
;
646 struct lttng_counter_transport
{
648 struct module
*owner
;
649 struct list_head node
;
650 struct lttng_counter_ops ops
;
653 struct lttng_syscall_filter
;
655 #define LTTNG_EVENT_HT_BITS 12
656 #define LTTNG_EVENT_HT_SIZE (1U << LTTNG_EVENT_HT_BITS)
658 struct lttng_event_ht
{
659 struct hlist_head table
[LTTNG_EVENT_HT_SIZE
];
662 #define LTTNG_EVENT_NOTIFIER_HT_BITS 12
663 #define LTTNG_EVENT_NOTIFIER_HT_SIZE (1U << LTTNG_EVENT_NOTIFIER_HT_BITS)
665 struct lttng_event_notifier_ht
{
666 struct hlist_head table
[LTTNG_EVENT_NOTIFIER_HT_SIZE
];
669 struct lttng_channel
{
671 struct channel
*chan
; /* Channel buffers */
673 struct lttng_kernel_ctx
*ctx
;
674 /* Event ID management */
675 struct lttng_session
*session
;
676 struct file
*file
; /* File associated to channel */
677 unsigned int free_event_id
; /* Next event ID to allocate */
678 struct list_head list
; /* Channel list */
679 struct lttng_channel_ops
*ops
;
680 struct lttng_transport
*transport
;
681 struct hlist_head
*sc_table
; /* for syscall tracing */
682 struct hlist_head
*compat_sc_table
;
683 struct hlist_head
*sc_exit_table
; /* for syscall exit tracing */
684 struct hlist_head
*compat_sc_exit_table
;
685 struct hlist_head sc_unknown
; /* for unknown syscalls */
686 struct hlist_head sc_compat_unknown
;
687 struct hlist_head sc_exit_unknown
;
688 struct hlist_head compat_sc_exit_unknown
;
689 struct lttng_syscall_filter
*sc_filter
;
690 int header_type
; /* 0: unset, 1: compact, 2: large */
691 enum channel_type channel_type
;
692 int syscall_all_entry
;
693 int syscall_all_exit
;
694 unsigned int metadata_dumped
:1,
695 sys_enter_registered
:1,
696 sys_exit_registered
:1,
697 tstate
:1; /* Transient enable state */
700 struct lttng_metadata_stream
{
701 void *priv
; /* Ring buffer private data */
702 struct lttng_metadata_cache
*metadata_cache
;
703 unsigned int metadata_in
; /* Bytes read from the cache */
704 unsigned int metadata_out
; /* Bytes consumed from stream */
705 int finalized
; /* Has channel been finalized */
706 wait_queue_head_t read_wait
; /* Reader buffer-level wait queue */
707 struct list_head list
; /* Stream list */
708 struct lttng_transport
*transport
;
709 uint64_t version
; /* Current version of the metadata cache */
710 bool coherent
; /* Stream in a coherent state */
713 #define LTTNG_DYNAMIC_LEN_STACK_SIZE 128
715 struct lttng_dynamic_len_stack
{
716 size_t stack
[LTTNG_DYNAMIC_LEN_STACK_SIZE
];
720 DECLARE_PER_CPU(struct lttng_dynamic_len_stack
, lttng_dynamic_len_stack
);
723 * struct lttng_id_tracker declared in header due to deferencing of *v
724 * in RCU_INITIALIZER(v).
726 #define LTTNG_ID_HASH_BITS 6
727 #define LTTNG_ID_TABLE_SIZE (1 << LTTNG_ID_HASH_BITS)
740 struct lttng_id_tracker_rcu
{
741 struct hlist_head id_hash
[LTTNG_ID_TABLE_SIZE
];
744 struct lttng_id_tracker
{
745 struct lttng_session
*session
;
746 enum tracker_type tracker_type
;
747 struct lttng_id_tracker_rcu
*p
; /* RCU dereferenced. */
750 struct lttng_id_hash_node
{
751 struct hlist_node hlist
;
755 struct lttng_session
{
756 int active
; /* Is trace session active ? */
757 int been_active
; /* Has trace session been active ? */
758 struct file
*file
; /* File associated to session */
759 struct list_head chan
; /* Channel list head */
760 struct list_head events
; /* Event list head */
761 struct list_head list
; /* Session list */
762 unsigned int free_chan_id
; /* Next chan ID to allocate */
763 uuid_le uuid
; /* Trace session unique ID */
764 struct lttng_metadata_cache
*metadata_cache
;
765 struct lttng_id_tracker pid_tracker
;
766 struct lttng_id_tracker vpid_tracker
;
767 struct lttng_id_tracker uid_tracker
;
768 struct lttng_id_tracker vuid_tracker
;
769 struct lttng_id_tracker gid_tracker
;
770 struct lttng_id_tracker vgid_tracker
;
771 unsigned int metadata_dumped
:1,
772 tstate
:1; /* Transient enable state */
773 /* List of event enablers */
774 struct list_head enablers_head
;
775 /* Hash table of events */
776 struct lttng_event_ht events_ht
;
777 char name
[LTTNG_KERNEL_ABI_SESSION_NAME_LEN
];
778 char creation_time
[LTTNG_KERNEL_ABI_SESSION_CREATION_TIME_ISO8601_LEN
];
781 struct lttng_counter
{
782 struct file
*file
; /* File associated to counter. */
784 struct lttng_counter_transport
*transport
;
785 struct lib_counter
*counter
;
786 struct lttng_counter_ops
*ops
;
789 struct lttng_event_notifier_group
{
790 struct file
*file
; /* File associated to event notifier group */
791 struct file
*notif_file
; /* File used to expose notifications to userspace. */
792 struct list_head node
; /* event notifier group list */
793 struct list_head enablers_head
; /* List of enablers */
794 struct list_head event_notifiers_head
; /* List of event notifier */
795 struct lttng_event_notifier_ht event_notifiers_ht
; /* Hash table of event notifiers */
796 struct lttng_channel_ops
*ops
;
797 struct lttng_transport
*transport
;
798 struct channel
*chan
; /* Ring buffer channel for event notifier group. */
799 struct lib_ring_buffer
*buf
; /* Ring buffer for event notifier group. */
800 wait_queue_head_t read_wait
;
801 struct irq_work wakeup_pending
; /* Pending wakeup irq work. */
802 struct lttng_kernel_event_notifier
*sc_unknown
; /* for unknown syscalls */
803 struct lttng_kernel_event_notifier
*sc_compat_unknown
;
805 struct lttng_syscall_filter
*sc_filter
;
807 struct hlist_head
*event_notifier_syscall_dispatch
;
808 struct hlist_head
*event_notifier_compat_syscall_dispatch
;
809 struct hlist_head
*event_notifier_exit_syscall_dispatch
;
810 struct hlist_head
*event_notifier_exit_compat_syscall_dispatch
;
812 struct hlist_head event_notifier_unknown_syscall_dispatch
;
813 struct hlist_head event_notifier_compat_unknown_syscall_dispatch
;
814 struct hlist_head event_notifier_exit_unknown_syscall_dispatch
;
815 struct hlist_head event_notifier_exit_compat_unknown_syscall_dispatch
;
817 int syscall_all_entry
;
818 int syscall_all_exit
;
820 unsigned int sys_enter_registered
:1, sys_exit_registered
:1;
822 struct lttng_counter
*error_counter
;
823 size_t error_counter_len
;
826 struct lttng_metadata_cache
{
827 char *data
; /* Metadata cache */
828 unsigned int cache_alloc
; /* Metadata allocated size (bytes) */
829 unsigned int metadata_written
; /* Number of bytes written in metadata cache */
830 atomic_t producing
; /* Metadata being produced (incomplete) */
831 struct kref refcount
; /* Metadata cache usage */
832 struct list_head metadata_stream
; /* Metadata stream list */
833 uuid_le uuid
; /* Trace session unique ID (copy) */
834 struct mutex lock
; /* Produce/consume lock */
835 uint64_t version
; /* Current version of the metadata */
838 void lttng_lock_sessions(void);
839 void lttng_unlock_sessions(void);
841 struct list_head
*lttng_get_probe_list_head(void);
843 struct lttng_event_enabler
*lttng_event_enabler_create(
844 enum lttng_enabler_format_type format_type
,
845 struct lttng_kernel_abi_event
*event_param
,
846 struct lttng_channel
*chan
);
848 int lttng_event_enabler_enable(struct lttng_event_enabler
*event_enabler
);
849 int lttng_event_enabler_disable(struct lttng_event_enabler
*event_enabler
);
850 struct lttng_event_notifier_enabler
*lttng_event_notifier_enabler_create(
851 struct lttng_event_notifier_group
*event_notifier_group
,
852 enum lttng_enabler_format_type format_type
,
853 struct lttng_kernel_abi_event_notifier
*event_notifier_param
);
855 int lttng_event_notifier_enabler_enable(
856 struct lttng_event_notifier_enabler
*event_notifier_enabler
);
857 int lttng_event_notifier_enabler_disable(
858 struct lttng_event_notifier_enabler
*event_notifier_enabler
);
859 int lttng_fix_pending_events(void);
860 int lttng_fix_pending_event_notifiers(void);
861 int lttng_session_active(void);
862 bool lttng_event_notifier_active(void);
864 struct lttng_session
*lttng_session_create(void);
865 int lttng_session_enable(struct lttng_session
*session
);
866 int lttng_session_disable(struct lttng_session
*session
);
867 void lttng_session_destroy(struct lttng_session
*session
);
868 int lttng_session_metadata_regenerate(struct lttng_session
*session
);
869 int lttng_session_statedump(struct lttng_session
*session
);
870 void metadata_cache_destroy(struct kref
*kref
);
872 struct lttng_counter
*lttng_kernel_counter_create(
873 const char *counter_transport_name
, size_t number_dimensions
,
874 const size_t *dimensions_sizes
);
875 int lttng_kernel_counter_read(struct lttng_counter
*counter
,
876 const size_t *dimension_indexes
, int32_t cpu
,
877 int64_t *val
, bool *overflow
, bool *underflow
);
878 int lttng_kernel_counter_aggregate(struct lttng_counter
*counter
,
879 const size_t *dimension_indexes
, int64_t *val
,
880 bool *overflow
, bool *underflow
);
881 int lttng_kernel_counter_clear(struct lttng_counter
*counter
,
882 const size_t *dimension_indexes
);
885 struct lttng_event_notifier_group
*lttng_event_notifier_group_create(void);
886 int lttng_event_notifier_group_create_error_counter(
887 struct file
*event_notifier_group_file
,
888 const struct lttng_kernel_abi_counter_conf
*error_counter_conf
);
889 void lttng_event_notifier_group_destroy(
890 struct lttng_event_notifier_group
*event_notifier_group
);
892 struct lttng_channel
*lttng_channel_create(struct lttng_session
*session
,
893 const char *transport_name
,
895 size_t subbuf_size
, size_t num_subbuf
,
896 unsigned int switch_timer_interval
,
897 unsigned int read_timer_interval
,
898 enum channel_type channel_type
);
899 struct lttng_channel
*lttng_global_channel_create(struct lttng_session
*session
,
900 int overwrite
, void *buf_addr
,
901 size_t subbuf_size
, size_t num_subbuf
,
902 unsigned int switch_timer_interval
,
903 unsigned int read_timer_interval
);
905 void lttng_metadata_channel_destroy(struct lttng_channel
*chan
);
906 struct lttng_kernel_event_recorder
*lttng_kernel_event_recorder_create(struct lttng_channel
*chan
,
907 struct lttng_kernel_abi_event
*event_param
,
908 const struct lttng_kernel_event_desc
*event_desc
,
909 enum lttng_kernel_abi_instrumentation itype
);
910 struct lttng_kernel_event_recorder
*_lttng_kernel_event_recorder_create(struct lttng_channel
*chan
,
911 struct lttng_kernel_abi_event
*event_param
,
912 const struct lttng_kernel_event_desc
*event_desc
,
913 enum lttng_kernel_abi_instrumentation itype
);
914 struct lttng_kernel_event_recorder
*lttng_event_compat_old_create(struct lttng_channel
*chan
,
915 struct lttng_kernel_abi_old_event
*old_event_param
,
916 const struct lttng_kernel_event_desc
*internal_desc
);
918 struct lttng_kernel_event_notifier
*lttng_event_notifier_create(
919 const struct lttng_kernel_event_desc
*event_notifier_desc
,
921 uint64_t error_counter_idx
,
922 struct lttng_event_notifier_group
*event_notifier_group
,
923 struct lttng_kernel_abi_event_notifier
*event_notifier_param
,
924 enum lttng_kernel_abi_instrumentation itype
);
925 struct lttng_kernel_event_notifier
*_lttng_event_notifier_create(
926 const struct lttng_kernel_event_desc
*event_notifier_desc
,
928 uint64_t error_counter_idx
,
929 struct lttng_event_notifier_group
*event_notifier_group
,
930 struct lttng_kernel_abi_event_notifier
*event_notifier_param
,
931 enum lttng_kernel_abi_instrumentation itype
);
933 int lttng_channel_enable(struct lttng_channel
*channel
);
934 int lttng_channel_disable(struct lttng_channel
*channel
);
935 int lttng_event_enable(struct lttng_kernel_event_common
*event
);
936 int lttng_event_disable(struct lttng_kernel_event_common
*event
);
938 void lttng_transport_register(struct lttng_transport
*transport
);
939 void lttng_transport_unregister(struct lttng_transport
*transport
);
941 void lttng_counter_transport_register(struct lttng_counter_transport
*transport
);
942 void lttng_counter_transport_unregister(struct lttng_counter_transport
*transport
);
944 void synchronize_trace(void);
945 int lttng_abi_init(void);
946 int lttng_abi_compat_old_init(void);
947 void lttng_abi_exit(void);
948 void lttng_abi_compat_old_exit(void);
950 int lttng_probe_register(struct lttng_kernel_probe_desc
*desc
);
951 void lttng_probe_unregister(struct lttng_kernel_probe_desc
*desc
);
952 const struct lttng_kernel_event_desc
*lttng_event_desc_get(const char *name
);
953 void lttng_event_desc_put(const struct lttng_kernel_event_desc
*desc
);
954 int lttng_probes_init(void);
955 void lttng_probes_exit(void);
957 int lttng_metadata_output_channel(struct lttng_metadata_stream
*stream
,
958 struct channel
*chan
, bool *coherent
);
960 int lttng_id_tracker_get_node_id(const struct lttng_id_hash_node
*node
);
961 int lttng_id_tracker_empty_set(struct lttng_id_tracker
*lf
);
962 void lttng_id_tracker_destroy(struct lttng_id_tracker
*lf
, bool rcu
);
963 bool lttng_id_tracker_lookup(struct lttng_id_tracker_rcu
*p
, int id
);
964 int lttng_id_tracker_add(struct lttng_id_tracker
*lf
, int id
);
965 int lttng_id_tracker_del(struct lttng_id_tracker
*lf
, int id
);
967 int lttng_session_track_id(struct lttng_session
*session
,
968 enum tracker_type tracker_type
, int id
);
969 int lttng_session_untrack_id(struct lttng_session
*session
,
970 enum tracker_type tracker_type
, int id
);
972 int lttng_session_list_tracker_ids(struct lttng_session
*session
,
973 enum tracker_type tracker_type
);
975 void lttng_clock_ref(void);
976 void lttng_clock_unref(void);
978 int lttng_desc_match_enabler(const struct lttng_kernel_event_desc
*desc
,
979 struct lttng_enabler
*enabler
);
981 #if defined(CONFIG_HAVE_SYSCALL_TRACEPOINTS)
982 int lttng_syscalls_register_event(struct lttng_event_enabler
*event_enabler
);
983 int lttng_syscalls_unregister_channel(struct lttng_channel
*chan
);
984 int lttng_syscalls_destroy_event(struct lttng_channel
*chan
);
985 int lttng_syscall_filter_enable_event(
986 struct lttng_channel
*chan
,
987 struct lttng_kernel_event_recorder
*event
);
988 int lttng_syscall_filter_disable_event(
989 struct lttng_channel
*chan
,
990 struct lttng_kernel_event_recorder
*event
);
992 long lttng_channel_syscall_mask(struct lttng_channel
*channel
,
993 struct lttng_kernel_abi_syscall_mask __user
*usyscall_mask
);
995 int lttng_syscalls_register_event_notifier(
996 struct lttng_event_notifier_enabler
*event_notifier_enabler
);
997 int lttng_syscalls_create_matching_event_notifiers(
998 struct lttng_event_notifier_enabler
*event_notifier_enabler
);
999 int lttng_syscalls_unregister_event_notifier_group(struct lttng_event_notifier_group
*group
);
1000 int lttng_syscall_filter_enable_event_notifier(struct lttng_kernel_event_notifier
*event_notifier
);
1001 int lttng_syscall_filter_disable_event_notifier(struct lttng_kernel_event_notifier
*event_notifier
);
1003 static inline int lttng_syscalls_register_event(
1004 struct lttng_event_enabler
*event_enabler
)
1009 static inline int lttng_syscalls_unregister_channel(struct lttng_channel
*chan
)
1014 static inline int lttng_syscalls_destroy(struct lttng_channel
*chan
)
1019 static inline int lttng_syscall_filter_enable_event(struct lttng_channel
*chan
,
1020 struct lttng_kernel_event_recorder
*event
);
1025 static inline int lttng_syscall_filter_disable_event(struct lttng_channel
*chan
,
1026 struct lttng_kernel_event_recorder
*event
);
1031 static inline long lttng_channel_syscall_mask(struct lttng_channel
*channel
,
1032 struct lttng_kernel_syscall_mask __user
*usyscall_mask
)
1037 static inline int lttng_syscalls_register_event_notifier(
1038 struct lttng_event_notifier_group
*group
)
1043 static inline int lttng_syscalls_unregister_event_notifier_group(
1044 struct lttng_event_notifier_group
*group
)
1049 static inline int lttng_syscall_filter_enable_event_notifier(
1050 struct lttng_event_notifier_group
*group
,
1056 static inline int lttng_syscall_filter_disable_event_notifier(
1057 struct lttng_event_notifier_group
*group
,
1065 int lttng_event_enabler_attach_filter_bytecode(struct lttng_event_enabler
*event_enabler
,
1066 struct lttng_kernel_abi_filter_bytecode __user
*bytecode
);
1067 int lttng_event_notifier_enabler_attach_filter_bytecode(
1068 struct lttng_event_notifier_enabler
*event_notifier_enabler
,
1069 struct lttng_kernel_abi_filter_bytecode __user
*bytecode
);
1070 int lttng_event_notifier_enabler_attach_capture_bytecode(
1071 struct lttng_event_notifier_enabler
*event_notifier_enabler
,
1072 struct lttng_kernel_abi_capture_bytecode __user
*bytecode
);
1074 void lttng_enabler_link_bytecode(const struct lttng_kernel_event_desc
*event_desc
,
1075 struct lttng_kernel_ctx
*ctx
,
1076 struct list_head
*instance_bytecode_runtime_head
,
1077 struct list_head
*enabler_bytecode_runtime_head
);
1078 void lttng_free_event_filter_runtime(struct lttng_kernel_event_common
*event
);
1080 int lttng_probes_init(void);
1082 extern struct lttng_kernel_ctx
*lttng_static_ctx
;
1084 int lttng_context_init(void);
1085 void lttng_context_exit(void);
1086 int lttng_kernel_context_append(struct lttng_kernel_ctx
**ctx_p
,
1087 const struct lttng_kernel_ctx_field
*f
);
1088 void lttng_kernel_context_remove_last(struct lttng_kernel_ctx
**ctx_p
);
1089 struct lttng_kernel_ctx_field
*lttng_kernel_get_context_field_from_index(struct lttng_kernel_ctx
*ctx
,
1091 int lttng_kernel_find_context(struct lttng_kernel_ctx
*ctx
, const char *name
);
1092 int lttng_kernel_get_context_index(struct lttng_kernel_ctx
*ctx
, const char *name
);
1093 void lttng_kernel_destroy_context(struct lttng_kernel_ctx
*ctx
);
1094 int lttng_add_pid_to_ctx(struct lttng_kernel_ctx
**ctx
);
1095 int lttng_add_cpu_id_to_ctx(struct lttng_kernel_ctx
**ctx
);
1096 int lttng_add_procname_to_ctx(struct lttng_kernel_ctx
**ctx
);
1097 int lttng_add_prio_to_ctx(struct lttng_kernel_ctx
**ctx
);
1098 int lttng_add_nice_to_ctx(struct lttng_kernel_ctx
**ctx
);
1099 int lttng_add_vpid_to_ctx(struct lttng_kernel_ctx
**ctx
);
1100 int lttng_add_tid_to_ctx(struct lttng_kernel_ctx
**ctx
);
1101 int lttng_add_vtid_to_ctx(struct lttng_kernel_ctx
**ctx
);
1102 int lttng_add_ppid_to_ctx(struct lttng_kernel_ctx
**ctx
);
1103 int lttng_add_vppid_to_ctx(struct lttng_kernel_ctx
**ctx
);
1104 int lttng_add_hostname_to_ctx(struct lttng_kernel_ctx
**ctx
);
1105 int lttng_add_interruptible_to_ctx(struct lttng_kernel_ctx
**ctx
);
1106 int lttng_add_need_reschedule_to_ctx(struct lttng_kernel_ctx
**ctx
);
1107 #if defined(CONFIG_PREEMPT_RT_FULL) || defined(CONFIG_PREEMPT)
1108 int lttng_add_preemptible_to_ctx(struct lttng_kernel_ctx
**ctx
);
1111 int lttng_add_preemptible_to_ctx(struct lttng_kernel_ctx
**ctx
)
1116 #ifdef CONFIG_PREEMPT_RT_FULL
1117 int lttng_add_migratable_to_ctx(struct lttng_kernel_ctx
**ctx
);
1120 int lttng_add_migratable_to_ctx(struct lttng_kernel_ctx
**ctx
)
1126 int lttng_add_callstack_to_ctx(struct lttng_kernel_ctx
**ctx
, int type
);
1128 #if defined(CONFIG_CGROUPS) && \
1129 ((LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,6,0)) || \
1130 LTTNG_UBUNTU_KERNEL_RANGE(4,4,0,0, 4,5,0,0))
1131 int lttng_add_cgroup_ns_to_ctx(struct lttng_kernel_ctx
**ctx
);
1134 int lttng_add_cgroup_ns_to_ctx(struct lttng_kernel_ctx
**ctx
)
1140 #if defined(CONFIG_IPC_NS) && \
1141 (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,8,0))
1142 int lttng_add_ipc_ns_to_ctx(struct lttng_kernel_ctx
**ctx
);
1145 int lttng_add_ipc_ns_to_ctx(struct lttng_kernel_ctx
**ctx
)
1151 #if !defined(LTTNG_MNT_NS_MISSING_HEADER) && \
1152 (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,8,0))
1153 int lttng_add_mnt_ns_to_ctx(struct lttng_kernel_ctx
**ctx
);
1156 int lttng_add_mnt_ns_to_ctx(struct lttng_kernel_ctx
**ctx
)
1162 #if defined(CONFIG_NET_NS) && \
1163 (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,8,0))
1164 int lttng_add_net_ns_to_ctx(struct lttng_kernel_ctx
**ctx
);
1167 int lttng_add_net_ns_to_ctx(struct lttng_kernel_ctx
**ctx
)
1173 #if defined(CONFIG_PID_NS) && \
1174 (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,8,0))
1175 int lttng_add_pid_ns_to_ctx(struct lttng_kernel_ctx
**ctx
);
1178 int lttng_add_pid_ns_to_ctx(struct lttng_kernel_ctx
**ctx
)
1184 #if defined(CONFIG_USER_NS) && \
1185 (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,8,0))
1186 int lttng_add_user_ns_to_ctx(struct lttng_kernel_ctx
**ctx
);
1189 int lttng_add_user_ns_to_ctx(struct lttng_kernel_ctx
**ctx
)
1195 #if defined(CONFIG_UTS_NS) && \
1196 (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,8,0))
1197 int lttng_add_uts_ns_to_ctx(struct lttng_kernel_ctx
**ctx
);
1200 int lttng_add_uts_ns_to_ctx(struct lttng_kernel_ctx
**ctx
)
1206 #if defined(CONFIG_TIME_NS) && \
1207 (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,6,0))
1208 int lttng_add_time_ns_to_ctx(struct lttng_kernel_ctx
**ctx
);
1211 int lttng_add_time_ns_to_ctx(struct lttng_kernel_ctx
**ctx
)
1217 int lttng_add_uid_to_ctx(struct lttng_kernel_ctx
**ctx
);
1218 int lttng_add_euid_to_ctx(struct lttng_kernel_ctx
**ctx
);
1219 int lttng_add_suid_to_ctx(struct lttng_kernel_ctx
**ctx
);
1220 int lttng_add_gid_to_ctx(struct lttng_kernel_ctx
**ctx
);
1221 int lttng_add_egid_to_ctx(struct lttng_kernel_ctx
**ctx
);
1222 int lttng_add_sgid_to_ctx(struct lttng_kernel_ctx
**ctx
);
1223 int lttng_add_vuid_to_ctx(struct lttng_kernel_ctx
**ctx
);
1224 int lttng_add_veuid_to_ctx(struct lttng_kernel_ctx
**ctx
);
1225 int lttng_add_vsuid_to_ctx(struct lttng_kernel_ctx
**ctx
);
1226 int lttng_add_vgid_to_ctx(struct lttng_kernel_ctx
**ctx
);
1227 int lttng_add_vegid_to_ctx(struct lttng_kernel_ctx
**ctx
);
1228 int lttng_add_vsgid_to_ctx(struct lttng_kernel_ctx
**ctx
);
1230 #if defined(CONFIG_PERF_EVENTS)
1231 int lttng_add_perf_counter_to_ctx(uint32_t type
,
1234 struct lttng_kernel_ctx
**ctx
);
1235 int lttng_cpuhp_perf_counter_online(unsigned int cpu
,
1236 struct lttng_cpuhp_node
*node
);
1237 int lttng_cpuhp_perf_counter_dead(unsigned int cpu
,
1238 struct lttng_cpuhp_node
*node
);
1241 int lttng_add_perf_counter_to_ctx(uint32_t type
,
1244 struct lttng_kernel_ctx
**ctx
)
1249 int lttng_cpuhp_perf_counter_online(unsigned int cpu
,
1250 struct lttng_cpuhp_node
*node
)
1255 int lttng_cpuhp_perf_counter_dead(unsigned int cpu
,
1256 struct lttng_cpuhp_node
*node
)
1262 int lttng_logger_init(void);
1263 void lttng_logger_exit(void);
1265 extern int lttng_statedump_start(struct lttng_session
*session
);
1267 #ifdef CONFIG_KPROBES
1268 int lttng_kprobes_register_event(const char *name
,
1269 const char *symbol_name
,
1272 struct lttng_kernel_event_recorder
*event
);
1273 void lttng_kprobes_unregister_event(struct lttng_kernel_event_recorder
*event
);
1274 void lttng_kprobes_destroy_event_private(struct lttng_kernel_event_recorder
*event
);
1275 int lttng_kprobes_register_event_notifier(const char *symbol_name
,
1278 struct lttng_kernel_event_notifier
*event_notifier
);
1279 void lttng_kprobes_unregister_event_notifier(struct lttng_kernel_event_notifier
*event_notifier
);
1280 void lttng_kprobes_destroy_event_notifier_private(struct lttng_kernel_event_notifier
*event_notifier
);
1283 int lttng_kprobes_register_event(const char *name
,
1284 const char *symbol_name
,
1287 struct lttng_kernel_event_recorder
*event
)
1293 void lttng_kprobes_unregister_event(struct lttng_kernel_event_recorder
*event
)
1298 void lttng_kprobes_destroy_event_private(struct lttng_kernel_event_recorder
*event
)
1303 int lttng_kprobes_register_event_notifier(const char *symbol_name
,
1306 struct lttng_kernel_event_notifier
*event_notifier
)
1312 void lttng_kprobes_unregister_event_notifier(struct lttng_kernel_event_notifier
*event_notifier
)
1317 void lttng_kprobes_destroy_event_notifier_private(struct lttng_kernel_event_notifier
*event_notifier
)
1322 int lttng_event_add_callsite(struct lttng_kernel_event_common
*event
,
1323 struct lttng_kernel_abi_event_callsite __user
*callsite
);
1325 #ifdef CONFIG_UPROBES
1326 int lttng_uprobes_register_event(const char *name
,
1327 int fd
, struct lttng_kernel_event_recorder
*event
);
1328 int lttng_uprobes_event_add_callsite(struct lttng_kernel_event_common
*event
,
1329 struct lttng_kernel_abi_event_callsite __user
*callsite
);
1330 void lttng_uprobes_unregister_event(struct lttng_kernel_event_recorder
*event
);
1331 void lttng_uprobes_destroy_event_private(struct lttng_kernel_event_recorder
*event
);
1332 int lttng_uprobes_register_event_notifier(const char *name
,
1333 int fd
, struct lttng_kernel_event_notifier
*event_notifier
);
1334 void lttng_uprobes_unregister_event_notifier(struct lttng_kernel_event_notifier
*event_notifier
);
1335 void lttng_uprobes_destroy_event_notifier_private(struct lttng_kernel_event_notifier
*event_notifier
);
1338 int lttng_uprobes_register_event(const char *name
,
1339 int fd
, struct lttng_kernel_event_recorder
*event
)
1345 int lttng_uprobes_event_add_callsite(struct lttng_kernel_event_common
*event
,
1346 struct lttng_kernel_abi_event_callsite __user
*callsite
)
1352 void lttng_uprobes_unregister_event(struct lttng_kernel_event_recorder
*event
)
1357 void lttng_uprobes_destroy_event_private(struct lttng_kernel_event_recorder
*event
)
1362 int lttng_uprobes_register_event_notifier(const char *name
,
1363 int fd
, struct lttng_kernel_event_notifier
*event_notifier
)
1369 void lttng_uprobes_unregister_event_notifier(struct lttng_kernel_event_notifier
*event_notifier
)
1374 void lttng_uprobes_destroy_event_notifier_private(struct lttng_kernel_event_notifier
*event_notifier
)
1379 #ifdef CONFIG_KRETPROBES
1380 int lttng_kretprobes_register(const char *name
,
1381 const char *symbol_name
,
1384 struct lttng_kernel_event_recorder
*event_entry
,
1385 struct lttng_kernel_event_recorder
*event_exit
);
1386 void lttng_kretprobes_unregister(struct lttng_kernel_event_recorder
*event
);
1387 void lttng_kretprobes_destroy_private(struct lttng_kernel_event_recorder
*event
);
1388 int lttng_kretprobes_event_enable_state(struct lttng_kernel_event_common
*event
,
1392 int lttng_kretprobes_register(const char *name
,
1393 const char *symbol_name
,
1396 struct lttng_kernel_event_recorder
*event_entry
,
1397 struct lttng_kernel_event_recorder
*event_exit
)
1403 void lttng_kretprobes_unregister(struct lttng_kernel_event_recorder
*event
)
1408 void lttng_kretprobes_destroy_private(struct lttng_kernel_event_recorder
*event
)
1413 int lttng_kretprobes_event_enable_state(struct lttng_kernel_event_common
*event
,
1420 int lttng_calibrate(struct lttng_kernel_abi_calibrate
*calibrate
);
1422 extern const struct file_operations lttng_tracepoint_list_fops
;
1423 extern const struct file_operations lttng_syscall_list_fops
;
1425 #define TRACEPOINT_HAS_DATA_ARG
1427 #endif /* _LTTNG_EVENTS_H */