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 <linux/version.h>
14 #include <linux/list.h>
15 #include <linux/kprobes.h>
16 #include <linux/kref.h>
17 #include <lttng-cpuhotplug.h>
18 #include <linux/uuid.h>
19 #include <linux/uprobes.h>
20 #include <lttng-tracer.h>
21 #include <lttng-abi.h>
22 #include <lttng-abi-old.h>
23 #include <lttng-endian.h>
25 #define lttng_is_signed_type(type) (((type)(-1)) < 0)
29 struct lttng_metadata_cache
;
30 struct lib_ring_buffer_ctx
;
32 struct perf_event_attr
;
33 struct lib_ring_buffer_config
;
35 /* Type description */
42 atype_sequence_nestable
,
43 atype_struct_nestable
,
44 atype_variant_nestable
,
48 enum lttng_string_encodings
{
49 lttng_encode_none
= 0,
50 lttng_encode_UTF8
= 1,
51 lttng_encode_ASCII
= 2,
60 struct lttng_enum_value
{
61 unsigned long long value
;
62 unsigned int signedness
:1;
65 struct lttng_enum_entry
{
66 struct lttng_enum_value start
, end
; /* start and end are inclusive */
69 unsigned int is_auto
:1;
73 #define __type_integer(_type, _size, _alignment, _signedness, \
74 _byte_order, _base, _encoding) \
76 .atype = atype_integer, \
79 .size = (_size) ? : sizeof(_type) * CHAR_BIT, \
80 .alignment = (_alignment) ? : lttng_alignof(_type) * CHAR_BIT, \
81 .signedness = (_signedness) >= 0 ? (_signedness) : lttng_is_signed_type(_type), \
82 .reverse_byte_order = _byte_order != __BYTE_ORDER, \
84 .encoding = lttng_encode_##_encoding, \
88 struct lttng_integer_type {
89 unsigned int size
; /* in bits */
90 unsigned short alignment
; /* in bits */
91 unsigned int signedness
:1,
93 unsigned int base
; /* 2, 8, 10, 16, for pretty print */
94 enum lttng_string_encodings encoding
;
98 enum abstract_types atype
;
100 struct lttng_integer_type integer
;
102 enum lttng_string_encodings encoding
;
105 const struct lttng_enum_desc
*desc
; /* Enumeration mapping */
106 const struct lttng_type
*container_type
;
109 const struct lttng_type
*elem_type
;
110 unsigned int length
; /* Num. elems. */
111 unsigned int alignment
;
114 const char *length_name
; /* Length field name. */
115 const struct lttng_type
*elem_type
;
116 unsigned int alignment
; /* Alignment before elements. */
119 unsigned int nr_fields
;
120 const struct lttng_event_field
*fields
; /* Array of fields. */
121 unsigned int alignment
;
124 const char *tag_name
;
125 const struct lttng_event_field
*choices
; /* Array of fields. */
126 unsigned int nr_choices
;
127 unsigned int alignment
;
132 struct lttng_enum_desc
{
134 const struct lttng_enum_entry
*entries
;
135 unsigned int nr_entries
;
138 /* Event field description */
140 struct lttng_event_field
{
142 struct lttng_type type
;
143 unsigned int nowrite
:1, /* do not write into trace */
144 user
:1, /* fetch from user-space */
145 nofilter
:1; /* do not consider for filter */
148 union lttng_ctx_value
{
155 * We need to keep this perf counter field separately from struct
156 * lttng_ctx_field because cpu hotplug needs fixed-location addresses.
158 struct lttng_perf_counter_field
{
159 struct lttng_cpuhp_node cpuhp_prepare
;
160 struct lttng_cpuhp_node cpuhp_online
;
161 struct perf_event_attr
*attr
;
162 struct perf_event
**e
; /* per-cpu array */
165 struct lttng_probe_ctx
{
166 struct lttng_event
*event
;
167 uint8_t interruptible
;
170 struct lttng_ctx_field
{
171 struct lttng_event_field event_field
;
172 size_t (*get_size
)(size_t offset
);
173 size_t (*get_size_arg
)(size_t offset
, struct lttng_ctx_field
*field
,
174 struct lib_ring_buffer_ctx
*ctx
,
175 struct lttng_channel
*chan
);
176 void (*record
)(struct lttng_ctx_field
*field
,
177 struct lib_ring_buffer_ctx
*ctx
,
178 struct lttng_channel
*chan
);
179 void (*get_value
)(struct lttng_ctx_field
*field
,
180 struct lttng_probe_ctx
*lttng_probe_ctx
,
181 union lttng_ctx_value
*value
);
183 struct lttng_perf_counter_field
*perf_counter
;
185 void (*destroy
)(struct lttng_ctx_field
*field
);
187 * Private data to keep state between get_size and record.
188 * User must perform its own synchronization to protect against
189 * concurrent and reentrant contexts.
195 struct lttng_ctx_field
*fields
;
196 unsigned int nr_fields
;
197 unsigned int allocated_fields
;
198 size_t largest_align
; /* in bytes */
201 struct lttng_event_desc
{
202 const char *name
; /* lttng-modules name */
203 const char *kname
; /* Linux kernel name (tracepoints) */
204 void *probe_callback
;
205 const struct lttng_event_ctx
*ctx
; /* context */
206 const struct lttng_event_field
*fields
; /* event payload */
207 unsigned int nr_fields
;
208 struct module
*owner
;
211 struct lttng_probe_desc
{
212 const char *provider
;
213 const struct lttng_event_desc
**event_desc
;
214 unsigned int nr_events
;
215 struct list_head head
; /* chain registered probes */
216 struct list_head lazy_init_head
;
217 int lazy
; /* lazy registration */
220 struct lttng_krp
; /* Kretprobe handling */
222 enum lttng_event_type
{
223 LTTNG_TYPE_EVENT
= 0,
224 LTTNG_TYPE_ENABLER
= 1,
227 struct lttng_filter_bytecode_node
{
228 struct list_head node
;
229 struct lttng_enabler
*enabler
;
231 * struct lttng_kernel_filter_bytecode has var. sized array, must be
234 struct lttng_kernel_filter_bytecode bc
;
238 * Filter return value masks.
240 enum lttng_filter_ret
{
241 LTTNG_FILTER_DISCARD
= 0,
242 LTTNG_FILTER_RECORD_FLAG
= (1ULL << 0),
243 /* Other bits are kept for future use. */
246 struct lttng_bytecode_runtime
{
247 /* Associated bytecode */
248 struct lttng_filter_bytecode_node
*bc
;
249 uint64_t (*filter
)(void *filter_data
, struct lttng_probe_ctx
*lttng_probe_ctx
,
250 const char *filter_stack_data
);
252 struct list_head node
; /* list of bytecode runtime in event */
253 struct lttng_event
*event
;
257 * Objects in a linked-list of enablers, owned by an event.
259 struct lttng_enabler_ref
{
260 struct list_head node
; /* enabler ref list */
261 struct lttng_enabler
*ref
; /* backward ref */
264 struct lttng_uprobe_handler
{
265 struct lttng_event
*event
;
267 struct uprobe_consumer up_consumer
;
268 struct list_head node
;
272 * lttng_event structure is referred to by the tracing fast path. It must be
276 enum lttng_event_type evtype
; /* First field. */
278 struct lttng_channel
*chan
;
280 const struct lttng_event_desc
*desc
;
282 struct lttng_ctx
*ctx
;
283 enum lttng_kernel_instrumentation instrumentation
;
290 struct lttng_krp
*lttng_krp
;
295 struct list_head head
;
298 struct list_head list
; /* Event list in session */
299 unsigned int metadata_dumped
:1;
301 /* Backward references: list of lttng_enabler_ref (ref to enablers) */
302 struct list_head enablers_ref_head
;
303 struct hlist_node hlist
; /* session ht of events */
304 int registered
; /* has reg'd tracepoint probe */
305 /* list of struct lttng_bytecode_runtime, sorted by seqnum */
306 struct list_head bytecode_runtime_head
;
307 int has_enablers_without_bytecode
;
310 enum lttng_enabler_type
{
311 LTTNG_ENABLER_STAR_GLOB
,
316 * Enabler field, within whatever object is enabling an event. Target of
317 * backward reference.
319 struct lttng_enabler
{
320 enum lttng_event_type evtype
; /* First field. */
322 enum lttng_enabler_type type
;
324 struct list_head node
; /* per-session list of enablers */
325 /* head list of struct lttng_ust_filter_bytecode_node */
326 struct list_head filter_bytecode_head
;
328 struct lttng_kernel_event event_param
;
329 struct lttng_channel
*chan
;
330 struct lttng_ctx
*ctx
;
331 unsigned int enabled
:1;
334 struct lttng_channel_ops
{
335 struct channel
*(*channel_create
)(const char *name
,
336 struct lttng_channel
*lttng_chan
,
338 size_t subbuf_size
, size_t num_subbuf
,
339 unsigned int switch_timer_interval
,
340 unsigned int read_timer_interval
);
341 void (*channel_destroy
)(struct channel
*chan
);
342 struct lib_ring_buffer
*(*buffer_read_open
)(struct channel
*chan
);
343 int (*buffer_has_read_closed_stream
)(struct channel
*chan
);
344 void (*buffer_read_close
)(struct lib_ring_buffer
*buf
);
345 int (*event_reserve
)(struct lib_ring_buffer_ctx
*ctx
,
347 void (*event_commit
)(struct lib_ring_buffer_ctx
*ctx
);
348 void (*event_write
)(struct lib_ring_buffer_ctx
*ctx
, const void *src
,
350 void (*event_write_from_user
)(struct lib_ring_buffer_ctx
*ctx
,
351 const void *src
, size_t len
);
352 void (*event_memset
)(struct lib_ring_buffer_ctx
*ctx
,
354 void (*event_strcpy
)(struct lib_ring_buffer_ctx
*ctx
, const char *src
,
356 void (*event_strcpy_from_user
)(struct lib_ring_buffer_ctx
*ctx
,
357 const char __user
*src
, size_t len
);
359 * packet_avail_size returns the available size in the current
360 * packet. Note that the size returned is only a hint, since it
361 * may change due to concurrent writes.
363 size_t (*packet_avail_size
)(struct channel
*chan
);
364 wait_queue_head_t
*(*get_writer_buf_wait_queue
)(struct channel
*chan
, int cpu
);
365 wait_queue_head_t
*(*get_hp_wait_queue
)(struct channel
*chan
);
366 int (*is_finalized
)(struct channel
*chan
);
367 int (*is_disabled
)(struct channel
*chan
);
368 int (*timestamp_begin
) (const struct lib_ring_buffer_config
*config
,
369 struct lib_ring_buffer
*bufb
,
370 uint64_t *timestamp_begin
);
371 int (*timestamp_end
) (const struct lib_ring_buffer_config
*config
,
372 struct lib_ring_buffer
*bufb
,
373 uint64_t *timestamp_end
);
374 int (*events_discarded
) (const struct lib_ring_buffer_config
*config
,
375 struct lib_ring_buffer
*bufb
,
376 uint64_t *events_discarded
);
377 int (*content_size
) (const struct lib_ring_buffer_config
*config
,
378 struct lib_ring_buffer
*bufb
,
379 uint64_t *content_size
);
380 int (*packet_size
) (const struct lib_ring_buffer_config
*config
,
381 struct lib_ring_buffer
*bufb
,
382 uint64_t *packet_size
);
383 int (*stream_id
) (const struct lib_ring_buffer_config
*config
,
384 struct lib_ring_buffer
*bufb
,
385 uint64_t *stream_id
);
386 int (*current_timestamp
) (const struct lib_ring_buffer_config
*config
,
387 struct lib_ring_buffer
*bufb
,
389 int (*sequence_number
) (const struct lib_ring_buffer_config
*config
,
390 struct lib_ring_buffer
*bufb
,
392 int (*instance_id
) (const struct lib_ring_buffer_config
*config
,
393 struct lib_ring_buffer
*bufb
,
397 struct lttng_transport
{
399 struct module
*owner
;
400 struct list_head node
;
401 struct lttng_channel_ops ops
;
404 struct lttng_syscall_filter
;
406 #define LTTNG_EVENT_HT_BITS 12
407 #define LTTNG_EVENT_HT_SIZE (1U << LTTNG_EVENT_HT_BITS)
409 struct lttng_event_ht
{
410 struct hlist_head table
[LTTNG_EVENT_HT_SIZE
];
413 struct lttng_channel
{
415 struct channel
*chan
; /* Channel buffers */
417 struct lttng_ctx
*ctx
;
418 /* Event ID management */
419 struct lttng_session
*session
;
420 struct file
*file
; /* File associated to channel */
421 unsigned int free_event_id
; /* Next event ID to allocate */
422 struct list_head list
; /* Channel list */
423 struct lttng_channel_ops
*ops
;
424 struct lttng_transport
*transport
;
425 struct lttng_event
**sc_table
; /* for syscall tracing */
426 struct lttng_event
**compat_sc_table
;
427 struct lttng_event
**sc_exit_table
; /* for syscall exit tracing */
428 struct lttng_event
**compat_sc_exit_table
;
429 struct lttng_event
*sc_unknown
; /* for unknown syscalls */
430 struct lttng_event
*sc_compat_unknown
;
431 struct lttng_event
*sc_exit_unknown
;
432 struct lttng_event
*compat_sc_exit_unknown
;
433 struct lttng_syscall_filter
*sc_filter
;
434 int header_type
; /* 0: unset, 1: compact, 2: large */
435 enum channel_type channel_type
;
436 unsigned int metadata_dumped
:1,
437 sys_enter_registered
:1,
438 sys_exit_registered
:1,
440 tstate
:1; /* Transient enable state */
443 struct lttng_metadata_stream
{
444 void *priv
; /* Ring buffer private data */
445 struct lttng_metadata_cache
*metadata_cache
;
446 unsigned int metadata_in
; /* Bytes read from the cache */
447 unsigned int metadata_out
; /* Bytes consumed from stream */
448 int finalized
; /* Has channel been finalized */
449 wait_queue_head_t read_wait
; /* Reader buffer-level wait queue */
450 struct list_head list
; /* Stream list */
451 struct lttng_transport
*transport
;
452 uint64_t version
; /* Current version of the metadata cache */
455 #define LTTNG_DYNAMIC_LEN_STACK_SIZE 128
457 struct lttng_dynamic_len_stack
{
458 size_t stack
[LTTNG_DYNAMIC_LEN_STACK_SIZE
];
462 DECLARE_PER_CPU(struct lttng_dynamic_len_stack
, lttng_dynamic_len_stack
);
465 * struct lttng_id_tracker declared in header due to deferencing of *v
466 * in RCU_INITIALIZER(v).
468 #define LTTNG_ID_HASH_BITS 6
469 #define LTTNG_ID_TABLE_SIZE (1 << LTTNG_ID_HASH_BITS)
482 struct lttng_id_tracker_rcu
{
483 struct hlist_head id_hash
[LTTNG_ID_TABLE_SIZE
];
486 struct lttng_id_tracker
{
487 struct lttng_session
*session
;
488 enum tracker_type tracker_type
;
489 struct lttng_id_tracker_rcu
*p
; /* RCU dereferenced. */
492 struct lttng_id_hash_node
{
493 struct hlist_node hlist
;
497 struct lttng_session
{
498 int active
; /* Is trace session active ? */
499 int been_active
; /* Has trace session been active ? */
500 struct file
*file
; /* File associated to session */
501 struct list_head chan
; /* Channel list head */
502 struct list_head events
; /* Event list head */
503 struct list_head list
; /* Session list */
504 unsigned int free_chan_id
; /* Next chan ID to allocate */
505 uuid_le uuid
; /* Trace session unique ID */
506 struct lttng_metadata_cache
*metadata_cache
;
507 struct lttng_id_tracker pid_tracker
;
508 struct lttng_id_tracker vpid_tracker
;
509 struct lttng_id_tracker uid_tracker
;
510 struct lttng_id_tracker vuid_tracker
;
511 struct lttng_id_tracker gid_tracker
;
512 struct lttng_id_tracker vgid_tracker
;
513 unsigned int metadata_dumped
:1,
514 tstate
:1; /* Transient enable state */
515 /* List of enablers */
516 struct list_head enablers_head
;
517 /* Hash table of events */
518 struct lttng_event_ht events_ht
;
519 char name
[LTTNG_KERNEL_SESSION_NAME_LEN
];
520 char creation_time
[LTTNG_KERNEL_SESSION_CREATION_TIME_ISO8601_LEN
];
523 struct lttng_metadata_cache
{
524 char *data
; /* Metadata cache */
525 unsigned int cache_alloc
; /* Metadata allocated size (bytes) */
526 unsigned int metadata_written
; /* Number of bytes written in metadata cache */
527 struct kref refcount
; /* Metadata cache usage */
528 struct list_head metadata_stream
; /* Metadata stream list */
529 uuid_le uuid
; /* Trace session unique ID (copy) */
530 struct mutex lock
; /* Produce/consume lock */
531 uint64_t version
; /* Current version of the metadata */
534 void lttng_lock_sessions(void);
535 void lttng_unlock_sessions(void);
537 struct list_head
*lttng_get_probe_list_head(void);
539 struct lttng_enabler
*lttng_enabler_create(enum lttng_enabler_type type
,
540 struct lttng_kernel_event
*event_param
,
541 struct lttng_channel
*chan
);
543 int lttng_enabler_enable(struct lttng_enabler
*enabler
);
544 int lttng_enabler_disable(struct lttng_enabler
*enabler
);
545 int lttng_fix_pending_events(void);
546 int lttng_session_active(void);
548 struct lttng_session
*lttng_session_create(void);
549 int lttng_session_enable(struct lttng_session
*session
);
550 int lttng_session_disable(struct lttng_session
*session
);
551 void lttng_session_destroy(struct lttng_session
*session
);
552 int lttng_session_metadata_regenerate(struct lttng_session
*session
);
553 int lttng_session_statedump(struct lttng_session
*session
);
554 void metadata_cache_destroy(struct kref
*kref
);
556 struct lttng_channel
*lttng_channel_create(struct lttng_session
*session
,
557 const char *transport_name
,
559 size_t subbuf_size
, size_t num_subbuf
,
560 unsigned int switch_timer_interval
,
561 unsigned int read_timer_interval
,
562 enum channel_type channel_type
);
563 struct lttng_channel
*lttng_global_channel_create(struct lttng_session
*session
,
564 int overwrite
, void *buf_addr
,
565 size_t subbuf_size
, size_t num_subbuf
,
566 unsigned int switch_timer_interval
,
567 unsigned int read_timer_interval
);
569 void lttng_metadata_channel_destroy(struct lttng_channel
*chan
);
570 struct lttng_event
*lttng_event_create(struct lttng_channel
*chan
,
571 struct lttng_kernel_event
*event_param
,
573 const struct lttng_event_desc
*event_desc
,
574 enum lttng_kernel_instrumentation itype
);
575 struct lttng_event
*_lttng_event_create(struct lttng_channel
*chan
,
576 struct lttng_kernel_event
*event_param
,
578 const struct lttng_event_desc
*event_desc
,
579 enum lttng_kernel_instrumentation itype
);
580 struct lttng_event
*lttng_event_compat_old_create(struct lttng_channel
*chan
,
581 struct lttng_kernel_old_event
*old_event_param
,
583 const struct lttng_event_desc
*internal_desc
);
585 int lttng_channel_enable(struct lttng_channel
*channel
);
586 int lttng_channel_disable(struct lttng_channel
*channel
);
587 int lttng_event_enable(struct lttng_event
*event
);
588 int lttng_event_disable(struct lttng_event
*event
);
590 void lttng_transport_register(struct lttng_transport
*transport
);
591 void lttng_transport_unregister(struct lttng_transport
*transport
);
593 void synchronize_trace(void);
594 int lttng_abi_init(void);
595 int lttng_abi_compat_old_init(void);
596 void lttng_abi_exit(void);
597 void lttng_abi_compat_old_exit(void);
599 int lttng_probe_register(struct lttng_probe_desc
*desc
);
600 void lttng_probe_unregister(struct lttng_probe_desc
*desc
);
601 const struct lttng_event_desc
*lttng_event_get(const char *name
);
602 void lttng_event_put(const struct lttng_event_desc
*desc
);
603 int lttng_probes_init(void);
604 void lttng_probes_exit(void);
606 int lttng_metadata_output_channel(struct lttng_metadata_stream
*stream
,
607 struct channel
*chan
);
609 int lttng_id_tracker_get_node_id(const struct lttng_id_hash_node
*node
);
610 int lttng_id_tracker_empty_set(struct lttng_id_tracker
*lf
);
611 void lttng_id_tracker_destroy(struct lttng_id_tracker
*lf
, bool rcu
);
612 bool lttng_id_tracker_lookup(struct lttng_id_tracker_rcu
*p
, int id
);
613 int lttng_id_tracker_add(struct lttng_id_tracker
*lf
, int id
);
614 int lttng_id_tracker_del(struct lttng_id_tracker
*lf
, int id
);
616 int lttng_session_track_id(struct lttng_session
*session
,
617 enum tracker_type tracker_type
, int id
);
618 int lttng_session_untrack_id(struct lttng_session
*session
,
619 enum tracker_type tracker_type
, int id
);
621 int lttng_session_list_tracker_ids(struct lttng_session
*session
,
622 enum tracker_type tracker_type
);
624 void lttng_clock_ref(void);
625 void lttng_clock_unref(void);
627 #if defined(CONFIG_HAVE_SYSCALL_TRACEPOINTS)
628 int lttng_syscalls_register(struct lttng_channel
*chan
, void *filter
);
629 int lttng_syscalls_unregister(struct lttng_channel
*chan
);
630 int lttng_syscall_filter_enable(struct lttng_channel
*chan
,
632 int lttng_syscall_filter_disable(struct lttng_channel
*chan
,
634 long lttng_channel_syscall_mask(struct lttng_channel
*channel
,
635 struct lttng_kernel_syscall_mask __user
*usyscall_mask
);
637 static inline int lttng_syscalls_register(struct lttng_channel
*chan
, void *filter
)
642 static inline int lttng_syscalls_unregister(struct lttng_channel
*chan
)
647 static inline int lttng_syscall_filter_enable(struct lttng_channel
*chan
,
653 static inline int lttng_syscall_filter_disable(struct lttng_channel
*chan
,
659 static inline long lttng_channel_syscall_mask(struct lttng_channel
*channel
,
660 struct lttng_kernel_syscall_mask __user
*usyscall_mask
)
666 void lttng_filter_sync_state(struct lttng_bytecode_runtime
*runtime
);
667 int lttng_enabler_attach_bytecode(struct lttng_enabler
*enabler
,
668 struct lttng_kernel_filter_bytecode __user
*bytecode
);
669 void lttng_enabler_event_link_bytecode(struct lttng_event
*event
,
670 struct lttng_enabler
*enabler
);
672 int lttng_probes_init(void);
674 extern struct lttng_ctx
*lttng_static_ctx
;
676 int lttng_context_init(void);
677 void lttng_context_exit(void);
678 struct lttng_ctx_field
*lttng_append_context(struct lttng_ctx
**ctx
);
679 void lttng_context_update(struct lttng_ctx
*ctx
);
680 int lttng_find_context(struct lttng_ctx
*ctx
, const char *name
);
681 int lttng_get_context_index(struct lttng_ctx
*ctx
, const char *name
);
682 void lttng_remove_context_field(struct lttng_ctx
**ctx
,
683 struct lttng_ctx_field
*field
);
684 void lttng_destroy_context(struct lttng_ctx
*ctx
);
685 int lttng_add_pid_to_ctx(struct lttng_ctx
**ctx
);
686 int lttng_add_cpu_id_to_ctx(struct lttng_ctx
**ctx
);
687 int lttng_add_procname_to_ctx(struct lttng_ctx
**ctx
);
688 int lttng_add_prio_to_ctx(struct lttng_ctx
**ctx
);
689 int lttng_add_nice_to_ctx(struct lttng_ctx
**ctx
);
690 int lttng_add_vpid_to_ctx(struct lttng_ctx
**ctx
);
691 int lttng_add_tid_to_ctx(struct lttng_ctx
**ctx
);
692 int lttng_add_vtid_to_ctx(struct lttng_ctx
**ctx
);
693 int lttng_add_ppid_to_ctx(struct lttng_ctx
**ctx
);
694 int lttng_add_vppid_to_ctx(struct lttng_ctx
**ctx
);
695 int lttng_add_hostname_to_ctx(struct lttng_ctx
**ctx
);
696 int lttng_add_interruptible_to_ctx(struct lttng_ctx
**ctx
);
697 int lttng_add_need_reschedule_to_ctx(struct lttng_ctx
**ctx
);
698 #if defined(CONFIG_PREEMPT_RT_FULL) || defined(CONFIG_PREEMPT)
699 int lttng_add_preemptible_to_ctx(struct lttng_ctx
**ctx
);
702 int lttng_add_preemptible_to_ctx(struct lttng_ctx
**ctx
)
707 #ifdef CONFIG_PREEMPT_RT_FULL
708 int lttng_add_migratable_to_ctx(struct lttng_ctx
**ctx
);
711 int lttng_add_migratable_to_ctx(struct lttng_ctx
**ctx
)
717 int lttng_add_callstack_to_ctx(struct lttng_ctx
**ctx
, int type
);
719 #if defined(CONFIG_CGROUPS)
720 int lttng_add_cgroup_ns_to_ctx(struct lttng_ctx
**ctx
);
723 int lttng_add_cgroup_ns_to_ctx(struct lttng_ctx
**ctx
)
729 #if defined(CONFIG_IPC_NS)
730 int lttng_add_ipc_ns_to_ctx(struct lttng_ctx
**ctx
);
733 int lttng_add_ipc_ns_to_ctx(struct lttng_ctx
**ctx
)
739 #if !defined(LTTNG_MNT_NS_MISSING_HEADER)
740 int lttng_add_mnt_ns_to_ctx(struct lttng_ctx
**ctx
);
743 int lttng_add_mnt_ns_to_ctx(struct lttng_ctx
**ctx
)
749 #if defined(CONFIG_NET_NS)
750 int lttng_add_net_ns_to_ctx(struct lttng_ctx
**ctx
);
753 int lttng_add_net_ns_to_ctx(struct lttng_ctx
**ctx
)
759 #if defined(CONFIG_PID_NS)
760 int lttng_add_pid_ns_to_ctx(struct lttng_ctx
**ctx
);
763 int lttng_add_pid_ns_to_ctx(struct lttng_ctx
**ctx
)
769 #if defined(CONFIG_USER_NS)
770 int lttng_add_user_ns_to_ctx(struct lttng_ctx
**ctx
);
773 int lttng_add_user_ns_to_ctx(struct lttng_ctx
**ctx
)
779 #if defined(CONFIG_UTS_NS)
780 int lttng_add_uts_ns_to_ctx(struct lttng_ctx
**ctx
);
783 int lttng_add_uts_ns_to_ctx(struct lttng_ctx
**ctx
)
789 int lttng_add_uid_to_ctx(struct lttng_ctx
**ctx
);
790 int lttng_add_euid_to_ctx(struct lttng_ctx
**ctx
);
791 int lttng_add_suid_to_ctx(struct lttng_ctx
**ctx
);
792 int lttng_add_gid_to_ctx(struct lttng_ctx
**ctx
);
793 int lttng_add_egid_to_ctx(struct lttng_ctx
**ctx
);
794 int lttng_add_sgid_to_ctx(struct lttng_ctx
**ctx
);
795 int lttng_add_vuid_to_ctx(struct lttng_ctx
**ctx
);
796 int lttng_add_veuid_to_ctx(struct lttng_ctx
**ctx
);
797 int lttng_add_vsuid_to_ctx(struct lttng_ctx
**ctx
);
798 int lttng_add_vgid_to_ctx(struct lttng_ctx
**ctx
);
799 int lttng_add_vegid_to_ctx(struct lttng_ctx
**ctx
);
800 int lttng_add_vsgid_to_ctx(struct lttng_ctx
**ctx
);
802 #if defined(CONFIG_PERF_EVENTS)
803 int lttng_add_perf_counter_to_ctx(uint32_t type
,
806 struct lttng_ctx
**ctx
);
807 int lttng_cpuhp_perf_counter_online(unsigned int cpu
,
808 struct lttng_cpuhp_node
*node
);
809 int lttng_cpuhp_perf_counter_dead(unsigned int cpu
,
810 struct lttng_cpuhp_node
*node
);
813 int lttng_add_perf_counter_to_ctx(uint32_t type
,
816 struct lttng_ctx
**ctx
)
821 int lttng_cpuhp_perf_counter_online(unsigned int cpu
,
822 struct lttng_cpuhp_node
*node
)
827 int lttng_cpuhp_perf_counter_dead(unsigned int cpu
,
828 struct lttng_cpuhp_node
*node
)
834 int lttng_logger_init(void);
835 void lttng_logger_exit(void);
837 extern int lttng_statedump_start(struct lttng_session
*session
);
839 #ifdef CONFIG_KPROBES
840 int lttng_kprobes_register(const char *name
,
841 const char *symbol_name
,
844 struct lttng_event
*event
);
845 void lttng_kprobes_unregister(struct lttng_event
*event
);
846 void lttng_kprobes_destroy_private(struct lttng_event
*event
);
849 int lttng_kprobes_register(const char *name
,
850 const char *symbol_name
,
853 struct lttng_event
*event
)
859 void lttng_kprobes_unregister(struct lttng_event
*event
)
864 void lttng_kprobes_destroy_private(struct lttng_event
*event
)
869 int lttng_event_add_callsite(struct lttng_event
*event
,
870 struct lttng_kernel_event_callsite
*callsite
);
872 #ifdef CONFIG_UPROBES
873 int lttng_uprobes_register(const char *name
,
874 int fd
, struct lttng_event
*event
);
875 int lttng_uprobes_add_callsite(struct lttng_event
*event
,
876 struct lttng_kernel_event_callsite
*callsite
);
877 void lttng_uprobes_unregister(struct lttng_event
*event
);
878 void lttng_uprobes_destroy_private(struct lttng_event
*event
);
881 int lttng_uprobes_register(const char *name
,
882 int fd
, struct lttng_event
*event
)
888 int lttng_uprobes_add_callsite(struct lttng_event
*event
,
889 struct lttng_kernel_event_callsite
*callsite
)
895 void lttng_uprobes_unregister(struct lttng_event
*event
)
900 void lttng_uprobes_destroy_private(struct lttng_event
*event
)
905 #ifdef CONFIG_KRETPROBES
906 int lttng_kretprobes_register(const char *name
,
907 const char *symbol_name
,
910 struct lttng_event
*event_entry
,
911 struct lttng_event
*event_exit
);
912 void lttng_kretprobes_unregister(struct lttng_event
*event
);
913 void lttng_kretprobes_destroy_private(struct lttng_event
*event
);
914 int lttng_kretprobes_event_enable_state(struct lttng_event
*event
,
918 int lttng_kretprobes_register(const char *name
,
919 const char *symbol_name
,
922 struct lttng_event
*event_entry
,
923 struct lttng_event
*event_exit
)
929 void lttng_kretprobes_unregister(struct lttng_event
*event
)
934 void lttng_kretprobes_destroy_private(struct lttng_event
*event
)
939 int lttng_kretprobes_event_enable_state(struct lttng_event
*event
,
946 int lttng_calibrate(struct lttng_kernel_calibrate
*calibrate
);
948 extern const struct file_operations lttng_tracepoint_list_fops
;
949 extern const struct file_operations lttng_syscall_list_fops
;
951 #define TRACEPOINT_HAS_DATA_ARG
953 static inline bool lttng_is_bytewise_integer(const struct lttng_type
*type
)
955 if (type
->atype
!= atype_integer
)
957 switch (type
->u
.integer
.size
) {
958 case 8: /* Fall-through. */
959 case 16: /* Fall-through. */
960 case 32: /* Fall-through. */
969 #endif /* _LTTNG_EVENTS_H */