From: Mathieu Desnoyers Date: Thu, 6 May 2021 18:07:56 +0000 (-0400) Subject: Refactoring: struct lttng_channel X-Git-Tag: v2.13.0-rc2~27 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=ac847066a7e106d38fd18587044622d050dc86a1;p=lttng-modules.git Refactoring: struct lttng_channel Split lttng_channel into public/private structures, and introduce inheritance for common fields which will be shared between the channel buffer and upcoming channel counter. Signed-off-by: Mathieu Desnoyers Change-Id: I932231c4af9ed1066d010b5be4f75f34842e8484 --- diff --git a/include/lttng/events-internal.h b/include/lttng/events-internal.h index defea840..1108cf27 100644 --- a/include/lttng/events-internal.h +++ b/include/lttng/events-internal.h @@ -21,6 +21,11 @@ enum lttng_enabler_format_type { LTTNG_ENABLER_FORMAT_NAME, }; +enum channel_type { + PER_CPU_CHANNEL, + METADATA_CHANNEL, +}; + /* * Objects in a linked-list of enablers, owned by an event. */ @@ -112,6 +117,44 @@ struct lttng_kernel_event_notifier_private { }; +struct lttng_kernel_channel_common_private { + struct lttng_kernel_channel_common *pub; + + struct file *file; /* File associated to channel */ + unsigned int sys_enter_registered:1, + sys_exit_registered:1, + tstate:1; /* Transient enable state */ + + struct hlist_head *sc_table; /* for syscall tracing */ + struct hlist_head *compat_sc_table; + struct hlist_head *sc_exit_table; /* for syscall exit tracing */ + struct hlist_head *compat_sc_exit_table; + struct hlist_head sc_unknown; /* for unknown syscalls */ + struct hlist_head sc_compat_unknown; + struct hlist_head sc_exit_unknown; + struct hlist_head compat_sc_exit_unknown; + struct lttng_syscall_filter *sc_filter; + int syscall_all_entry; + int syscall_all_exit; +}; + +struct lttng_kernel_channel_buffer_private { + struct lttng_kernel_channel_common_private parent; + + struct lttng_kernel_channel_buffer *pub; + + unsigned int id; /* Channel ID */ + unsigned int free_event_id; /* Next event ID to allocate */ + int header_type; /* 0: unset, 1: compact, 2: large */ + + enum channel_type channel_type; + struct lttng_kernel_ctx *ctx; + struct channel *rb_chan; /* Ring buffer channel */ + unsigned int metadata_dumped:1; + struct list_head node; /* Channel list in session */ + struct lttng_transport *transport; +}; + enum lttng_kernel_bytecode_interpreter_ret { LTTNG_KERNEL_BYTECODE_INTERPRETER_ERROR = -1, LTTNG_KERNEL_BYTECODE_INTERPRETER_OK = 0, @@ -177,7 +220,7 @@ struct lttng_enabler { struct lttng_event_enabler { struct lttng_enabler base; struct list_head node; /* per-session list of enablers */ - struct lttng_channel *chan; + struct lttng_kernel_channel_buffer *chan; }; struct lttng_event_notifier_enabler { @@ -223,7 +266,7 @@ struct lttng_kernel_ctx_field { size_t offset); void (*record)(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, struct lttng_kernel_ring_buffer_ctx *ctx, - struct lttng_channel *chan); + struct lttng_kernel_channel_buffer *chan); void (*get_value)(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, struct lttng_ctx_value *value); void (*destroy)(void *priv); @@ -729,7 +772,7 @@ int lttng_cpuhp_perf_counter_dead(unsigned int cpu, struct lttng_event_enabler *lttng_event_enabler_create( enum lttng_enabler_format_type format_type, struct lttng_kernel_abi_event *event_param, - struct lttng_channel *chan); + struct lttng_kernel_channel_buffer *chan); int lttng_event_enabler_enable(struct lttng_event_enabler *event_enabler); int lttng_event_enabler_disable(struct lttng_event_enabler *event_enabler); @@ -762,16 +805,16 @@ void lttng_enabler_link_bytecode(const struct lttng_kernel_event_desc *event_des #if defined(CONFIG_HAVE_SYSCALL_TRACEPOINTS) int lttng_syscalls_register_event(struct lttng_event_enabler *event_enabler); -int lttng_syscalls_unregister_channel(struct lttng_channel *chan); -int lttng_syscalls_destroy_event(struct lttng_channel *chan); +int lttng_syscalls_unregister_channel(struct lttng_kernel_channel_buffer *chan); +int lttng_syscalls_destroy_event(struct lttng_kernel_channel_buffer *chan); int lttng_syscall_filter_enable_event( - struct lttng_channel *chan, + struct lttng_kernel_channel_buffer *chan, struct lttng_kernel_event_recorder *event); int lttng_syscall_filter_disable_event( - struct lttng_channel *chan, + struct lttng_kernel_channel_buffer *chan, struct lttng_kernel_event_recorder *event); -long lttng_channel_syscall_mask(struct lttng_channel *channel, +long lttng_channel_syscall_mask(struct lttng_kernel_channel_buffer *channel, struct lttng_kernel_abi_syscall_mask __user *usyscall_mask); int lttng_syscalls_register_event_notifier( @@ -788,29 +831,29 @@ static inline int lttng_syscalls_register_event( return -ENOSYS; } -static inline int lttng_syscalls_unregister_channel(struct lttng_channel *chan) +static inline int lttng_syscalls_unregister_channel(struct lttng_kernel_channel_buffer *chan) { return 0; } -static inline int lttng_syscalls_destroy(struct lttng_channel *chan) +static inline int lttng_syscalls_destroy(struct lttng_kernel_channel_buffer *chan) { return 0; } -static inline int lttng_syscall_filter_enable_event(struct lttng_channel *chan, +static inline int lttng_syscall_filter_enable_event(struct lttng_kernel_channel_buffer *chan, struct lttng_kernel_event_recorder *event); { return -ENOSYS; } -static inline int lttng_syscall_filter_disable_event(struct lttng_channel *chan, +static inline int lttng_syscall_filter_disable_event(struct lttng_kernel_channel_buffer *chan, struct lttng_kernel_event_recorder *event); { return -ENOSYS; } -static inline long lttng_channel_syscall_mask(struct lttng_channel *channel, +static inline long lttng_channel_syscall_mask(struct lttng_kernel_channel_buffer *channel, struct lttng_kernel_syscall_mask __user *usyscall_mask) { return -ENOSYS; @@ -1033,29 +1076,29 @@ int lttng_event_notifier_group_create_error_counter( void lttng_event_notifier_group_destroy( struct lttng_event_notifier_group *event_notifier_group); -struct lttng_channel *lttng_channel_create(struct lttng_kernel_session *session, +struct lttng_kernel_channel_buffer *lttng_channel_create(struct lttng_kernel_session *session, const char *transport_name, void *buf_addr, size_t subbuf_size, size_t num_subbuf, unsigned int switch_timer_interval, unsigned int read_timer_interval, enum channel_type channel_type); -struct lttng_channel *lttng_global_channel_create(struct lttng_kernel_session *session, +struct lttng_kernel_channel_buffer *lttng_global_channel_create(struct lttng_kernel_session *session, int overwrite, void *buf_addr, size_t subbuf_size, size_t num_subbuf, unsigned int switch_timer_interval, unsigned int read_timer_interval); -void lttng_metadata_channel_destroy(struct lttng_channel *chan); -struct lttng_kernel_event_recorder *lttng_kernel_event_recorder_create(struct lttng_channel *chan, +void lttng_metadata_channel_destroy(struct lttng_kernel_channel_buffer *chan); +struct lttng_kernel_event_recorder *lttng_kernel_event_recorder_create(struct lttng_kernel_channel_buffer *chan, struct lttng_kernel_abi_event *event_param, const struct lttng_kernel_event_desc *event_desc, enum lttng_kernel_abi_instrumentation itype); -struct lttng_kernel_event_recorder *_lttng_kernel_event_recorder_create(struct lttng_channel *chan, +struct lttng_kernel_event_recorder *_lttng_kernel_event_recorder_create(struct lttng_kernel_channel_buffer *chan, struct lttng_kernel_abi_event *event_param, const struct lttng_kernel_event_desc *event_desc, enum lttng_kernel_abi_instrumentation itype); -struct lttng_kernel_event_recorder *lttng_event_compat_old_create(struct lttng_channel *chan, +struct lttng_kernel_event_recorder *lttng_event_compat_old_create(struct lttng_kernel_channel_buffer *chan, struct lttng_kernel_abi_old_event *old_event_param, const struct lttng_kernel_event_desc *internal_desc); @@ -1074,8 +1117,8 @@ struct lttng_kernel_event_notifier *_lttng_event_notifier_create( struct lttng_kernel_abi_event_notifier *event_notifier_param, enum lttng_kernel_abi_instrumentation itype); -int lttng_channel_enable(struct lttng_channel *channel); -int lttng_channel_disable(struct lttng_channel *channel); +int lttng_channel_enable(struct lttng_kernel_channel_buffer *channel); +int lttng_channel_disable(struct lttng_kernel_channel_buffer *channel); int lttng_event_enable(struct lttng_kernel_event_common *event); int lttng_event_disable(struct lttng_kernel_event_common *event); diff --git a/include/lttng/events.h b/include/lttng/events.h index 09b4c672..1eda3aca 100644 --- a/include/lttng/events.h +++ b/include/lttng/events.h @@ -25,7 +25,7 @@ #define lttng_is_signed_type(type) (((type) -1) < (type) 1) -struct lttng_channel; +struct lttng_kernel_channel_buffer; struct lttng_kernel_session; struct lttng_kernel_ring_buffer_ctx; @@ -49,11 +49,6 @@ enum lttng_kernel_string_encoding { NR_LTTNG_KERNEL_STRING_ENCODING, }; -enum channel_type { - PER_CPU_CHANNEL, - METADATA_CHANNEL, -}; - struct lttng_kernel_enum_value { unsigned long long value; unsigned int signedness:1; @@ -362,7 +357,7 @@ struct lttng_kernel_event_recorder { struct lttng_kernel_event_common parent; struct lttng_kernel_event_recorder_private *priv; /* Private event record interface */ - struct lttng_channel *chan; + struct lttng_kernel_channel_buffer *chan; }; struct lttng_kernel_notification_ctx { @@ -397,37 +392,32 @@ struct lttng_kernel_channel_buffer_ops { size_t len); void (*event_strcpy_from_user)(struct lttng_kernel_ring_buffer_ctx *ctx, const char __user *src, size_t len); + void (*lost_event_too_big)(struct lttng_kernel_channel_buffer *lttng_channel); +}; + +enum lttng_kernel_channel_type { + LTTNG_KERNEL_CHANNEL_TYPE_BUFFER = 0, }; -struct lttng_channel { - unsigned int id; - struct channel *chan; /* Channel buffers */ +struct lttng_kernel_channel_common_private; + +/* Use container_of() to get child. */ +struct lttng_kernel_channel_common { + struct lttng_kernel_channel_common_private *priv; /* Private channel interface. */ + + enum lttng_kernel_channel_type type; + int enabled; - struct lttng_kernel_ctx *ctx; - /* Event ID management */ struct lttng_kernel_session *session; - struct file *file; /* File associated to channel */ - unsigned int free_event_id; /* Next event ID to allocate */ - struct list_head list; /* Channel list */ +}; + +struct lttng_kernel_channel_buffer_private; + +struct lttng_kernel_channel_buffer { + struct lttng_kernel_channel_common parent; + struct lttng_kernel_channel_buffer_private *priv; + struct lttng_kernel_channel_buffer_ops *ops; - struct lttng_transport *transport; - struct hlist_head *sc_table; /* for syscall tracing */ - struct hlist_head *compat_sc_table; - struct hlist_head *sc_exit_table; /* for syscall exit tracing */ - struct hlist_head *compat_sc_exit_table; - struct hlist_head sc_unknown; /* for unknown syscalls */ - struct hlist_head sc_compat_unknown; - struct hlist_head sc_exit_unknown; - struct hlist_head compat_sc_exit_unknown; - struct lttng_syscall_filter *sc_filter; - int header_type; /* 0: unset, 1: compact, 2: large */ - enum channel_type channel_type; - int syscall_all_entry; - int syscall_all_exit; - unsigned int metadata_dumped:1, - sys_enter_registered:1, - sys_exit_registered:1, - tstate:1; /* Transient enable state */ }; #define LTTNG_DYNAMIC_LEN_STACK_SIZE 128 diff --git a/include/lttng/tracepoint-event-impl.h b/include/lttng/tracepoint-event-impl.h index 35b0059b..fdc3d5cf 100644 --- a/include/lttng/tracepoint-event-impl.h +++ b/include/lttng/tracepoint-event-impl.h @@ -1074,15 +1074,15 @@ static void __event_probe__##_name(_data_proto) \ { \ struct lttng_kernel_event_recorder *__event_recorder = \ container_of(__event, struct lttng_kernel_event_recorder, parent); \ - struct lttng_channel *__chan = __event_recorder->chan; \ - struct lttng_kernel_session *__session = __chan->session; \ + struct lttng_kernel_channel_buffer *__chan = __event_recorder->chan; \ + struct lttng_kernel_session *__session = __chan->parent.session; \ struct lttng_kernel_id_tracker_rcu *__lf; \ \ if (!_TP_SESSION_CHECK(session, __session)) \ return; \ if (unlikely(!LTTNG_READ_ONCE(__session->active))) \ return; \ - if (unlikely(!LTTNG_READ_ONCE(__chan->enabled))) \ + if (unlikely(!LTTNG_READ_ONCE(__chan->parent.enabled))) \ return; \ __lf = lttng_rcu_dereference(__session->pid_tracker.p); \ if (__lf && likely(!lttng_id_tracker_lookup(__lf, current->tgid))) \ @@ -1131,7 +1131,7 @@ static void __event_probe__##_name(_data_proto) \ { \ struct lttng_kernel_event_recorder *__event_recorder = \ container_of(__event, struct lttng_kernel_event_recorder, parent); \ - struct lttng_channel *__chan = __event_recorder->chan; \ + struct lttng_kernel_channel_buffer *__chan = __event_recorder->chan; \ struct lttng_kernel_ring_buffer_ctx __ctx; \ ssize_t __event_len; \ size_t __event_align; \ @@ -1139,7 +1139,7 @@ static void __event_probe__##_name(_data_proto) \ \ __event_len = __event_get_size__##_name(_locvar_args); \ if (unlikely(__event_len < 0)) { \ - lib_ring_buffer_lost_event_too_big(__chan->chan); \ + __chan->ops->lost_event_too_big(__chan); \ goto __post; \ } \ __event_align = __event_get_align__##_name(_locvar_args); \ diff --git a/include/lttng/tracer-core.h b/include/lttng/tracer-core.h index e04f5a72..32ff442c 100644 --- a/include/lttng/tracer-core.h +++ b/include/lttng/tracer-core.h @@ -22,7 +22,5 @@ #include struct lttng_kernel_session; -struct lttng_channel; -struct lttng_event; #endif /* LTTNG_TRACER_CORE_H */ diff --git a/src/lttng-abi.c b/src/lttng-abi.c index aa1b0195..a78f2e33 100644 --- a/src/lttng-abi.c +++ b/src/lttng-abi.c @@ -491,7 +491,7 @@ int lttng_abi_create_channel(struct file *session_file, struct lttng_kernel_session *session = session_file->private_data; const struct file_operations *fops = NULL; const char *transport_name; - struct lttng_channel *chan; + struct lttng_kernel_channel_buffer *chan; struct file *chan_file; int chan_fd; int ret = 0; @@ -559,7 +559,7 @@ int lttng_abi_create_channel(struct file *session_file, ret = -EINVAL; goto chan_error; } - chan->file = chan_file; + chan->priv->parent.file = chan_file; chan_file->private_data = chan; fd_install(chan_fd, chan_file); @@ -1627,12 +1627,12 @@ fd_error: static int lttng_abi_open_stream(struct file *channel_file) { - struct lttng_channel *channel = channel_file->private_data; + struct lttng_kernel_channel_buffer *channel = channel_file->private_data; struct lib_ring_buffer *buf; int ret; void *stream_priv; - buf = channel->ops->priv->buffer_read_open(channel->chan); + buf = channel->ops->priv->buffer_read_open(channel->priv->rb_chan); if (!buf) return -ENOENT; @@ -1653,14 +1653,14 @@ fd_error: static int lttng_abi_open_metadata_stream(struct file *channel_file) { - struct lttng_channel *channel = channel_file->private_data; - struct lttng_kernel_session *session = channel->session; + struct lttng_kernel_channel_buffer *channel = channel_file->private_data; + struct lttng_kernel_session *session = channel->parent.session; struct lib_ring_buffer *buf; int ret; struct lttng_metadata_stream *metadata_stream; void *stream_priv; - buf = channel->ops->priv->buffer_read_open(channel->chan); + buf = channel->ops->priv->buffer_read_open(channel->priv->rb_chan); if (!buf) return -ENOENT; @@ -1674,7 +1674,7 @@ int lttng_abi_open_metadata_stream(struct file *channel_file) init_waitqueue_head(&metadata_stream->read_wait); metadata_stream->priv = buf; stream_priv = metadata_stream; - metadata_stream->transport = channel->transport; + metadata_stream->transport = channel->priv->transport; /* Initial state is an empty metadata, considered as incoherent. */ metadata_stream->coherent = false; @@ -1808,7 +1808,7 @@ int lttng_abi_create_event(struct file *channel_file, struct lttng_kernel_abi_event *event_param) { const struct file_operations *fops; - struct lttng_channel *channel = channel_file->private_data; + struct lttng_kernel_channel_buffer *channel = channel_file->private_data; int event_fd, ret; struct file *event_file; void *priv; @@ -2342,7 +2342,7 @@ static const struct file_operations lttng_event_notifier_group_fops = { static long lttng_channel_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { - struct lttng_channel *channel = file->private_data; + struct lttng_kernel_channel_buffer *channel = file->private_data; switch (cmd) { case LTTNG_KERNEL_ABI_OLD_STREAM: @@ -2465,7 +2465,7 @@ old_event_end: ret = lttng_abi_add_context(file, ucontext_param, - &channel->ctx, channel->session); + &channel->priv->ctx, channel->parent.session); old_ctx_error_free_old_param: kfree(old_ucontext_param); @@ -2484,7 +2484,7 @@ old_ctx_end: return -EFAULT; return lttng_abi_add_context(file, &ucontext_param, - &channel->ctx, channel->session); + &channel->priv->ctx, channel->parent.session); } case LTTNG_KERNEL_ABI_OLD_ENABLE: case LTTNG_KERNEL_ABI_ENABLE: @@ -2533,19 +2533,19 @@ long lttng_metadata_ioctl(struct file *file, unsigned int cmd, unsigned long arg */ unsigned int lttng_channel_poll(struct file *file, poll_table *wait) { - struct lttng_channel *channel = file->private_data; + struct lttng_kernel_channel_buffer *channel = file->private_data; unsigned int mask = 0; if (file->f_mode & FMODE_READ) { poll_wait_set_exclusive(wait); - poll_wait(file, channel->ops->priv->get_hp_wait_queue(channel->chan), + poll_wait(file, channel->ops->priv->get_hp_wait_queue(channel->priv->rb_chan), wait); - if (channel->ops->priv->is_disabled(channel->chan)) + if (channel->ops->priv->is_disabled(channel->priv->rb_chan)) return POLLERR; - if (channel->ops->priv->is_finalized(channel->chan)) + if (channel->ops->priv->is_finalized(channel->priv->rb_chan)) return POLLHUP; - if (channel->ops->priv->buffer_has_read_closed_stream(channel->chan)) + if (channel->ops->priv->buffer_has_read_closed_stream(channel->priv->rb_chan)) return POLLIN | POLLRDNORM; return 0; } @@ -2556,20 +2556,20 @@ unsigned int lttng_channel_poll(struct file *file, poll_table *wait) static int lttng_channel_release(struct inode *inode, struct file *file) { - struct lttng_channel *channel = file->private_data; + struct lttng_kernel_channel_buffer *channel = file->private_data; if (channel) - fput(channel->session->priv->file); + fput(channel->parent.session->priv->file); return 0; } static int lttng_metadata_channel_release(struct inode *inode, struct file *file) { - struct lttng_channel *channel = file->private_data; + struct lttng_kernel_channel_buffer *channel = file->private_data; if (channel) { - fput(channel->session->priv->file); + fput(channel->parent.session->priv->file); lttng_metadata_channel_destroy(channel); } @@ -2696,7 +2696,7 @@ int lttng_event_recorder_event_release(struct inode *inode, struct file *file) struct lttng_kernel_event_recorder *event = file->private_data; if (event) - fput(event->chan->file); + fput(event->chan->priv->parent.file); return 0; } @@ -2706,7 +2706,7 @@ int lttng_event_recorder_enabler_release(struct inode *inode, struct file *file) struct lttng_event_enabler *event_enabler = file->private_data; if (event_enabler) - fput(event_enabler->chan->file); + fput(event_enabler->chan->priv->parent.file); return 0; } diff --git a/src/lttng-context-callstack-legacy-impl.h b/src/lttng-context-callstack-legacy-impl.h index 0e59aa6d..03409291 100644 --- a/src/lttng-context-callstack-legacy-impl.h +++ b/src/lttng-context-callstack-legacy-impl.h @@ -190,7 +190,7 @@ size_t lttng_callstack_sequence_get_size(void *priv, struct lttng_kernel_probe_c static void lttng_callstack_length_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, struct lttng_kernel_ring_buffer_ctx *ctx, - struct lttng_channel *chan) + struct lttng_kernel_channel_buffer *chan) { int cpu = ctx->priv.reserve_cpu; struct field_data *fdata = (struct field_data *) priv; @@ -210,7 +210,7 @@ void lttng_callstack_length_record(void *priv, struct lttng_kernel_probe_ctx *pr static void lttng_callstack_sequence_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, struct lttng_kernel_ring_buffer_ctx *ctx, - struct lttng_channel *chan) + struct lttng_kernel_channel_buffer *chan) { int cpu = ctx->priv.reserve_cpu; struct field_data *fdata = (struct field_data *) priv; diff --git a/src/lttng-context-callstack-stackwalk-impl.h b/src/lttng-context-callstack-stackwalk-impl.h index d3a57d86..2452804d 100644 --- a/src/lttng-context-callstack-stackwalk-impl.h +++ b/src/lttng-context-callstack-stackwalk-impl.h @@ -195,7 +195,7 @@ size_t lttng_callstack_sequence_get_size(void *priv, struct lttng_kernel_probe_c static void lttng_callstack_length_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, struct lttng_kernel_ring_buffer_ctx *ctx, - struct lttng_channel *chan) + struct lttng_kernel_channel_buffer *chan) { int cpu = ctx->priv.reserve_cpu; struct field_data *fdata = (struct field_data *) priv; @@ -216,7 +216,7 @@ void lttng_callstack_length_record(void *priv, struct lttng_kernel_probe_ctx *pr static void lttng_callstack_sequence_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, struct lttng_kernel_ring_buffer_ctx *ctx, - struct lttng_channel *chan) + struct lttng_kernel_channel_buffer *chan) { int cpu = ctx->priv.reserve_cpu; struct field_data *fdata = (struct field_data *) priv; diff --git a/src/lttng-context-cgroup-ns.c b/src/lttng-context-cgroup-ns.c index 3588d9cd..6cab3153 100644 --- a/src/lttng-context-cgroup-ns.c +++ b/src/lttng-context-cgroup-ns.c @@ -37,7 +37,7 @@ size_t cgroup_ns_get_size(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, static void cgroup_ns_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, struct lttng_kernel_ring_buffer_ctx *ctx, - struct lttng_channel *chan) + struct lttng_kernel_channel_buffer *chan) { unsigned int cgroup_ns_inum = 0; diff --git a/src/lttng-context-cpu-id.c b/src/lttng-context-cpu-id.c index 467aef95..24241dee 100644 --- a/src/lttng-context-cpu-id.c +++ b/src/lttng-context-cpu-id.c @@ -29,7 +29,7 @@ size_t cpu_id_get_size(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, siz static void cpu_id_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, struct lttng_kernel_ring_buffer_ctx *ctx, - struct lttng_channel *chan) + struct lttng_kernel_channel_buffer *chan) { int cpu; diff --git a/src/lttng-context-egid.c b/src/lttng-context-egid.c index 902a5701..6eaa758e 100644 --- a/src/lttng-context-egid.c +++ b/src/lttng-context-egid.c @@ -31,7 +31,7 @@ size_t egid_get_size(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, size_ static void egid_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, struct lttng_kernel_ring_buffer_ctx *ctx, - struct lttng_channel *chan) + struct lttng_kernel_channel_buffer *chan) { gid_t egid; diff --git a/src/lttng-context-euid.c b/src/lttng-context-euid.c index 6076a316..90a6dd3c 100644 --- a/src/lttng-context-euid.c +++ b/src/lttng-context-euid.c @@ -31,7 +31,7 @@ size_t euid_get_size(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, size_ static void euid_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, struct lttng_kernel_ring_buffer_ctx *ctx, - struct lttng_channel *chan) + struct lttng_kernel_channel_buffer *chan) { uid_t euid; diff --git a/src/lttng-context-gid.c b/src/lttng-context-gid.c index c1906e25..f0084079 100644 --- a/src/lttng-context-gid.c +++ b/src/lttng-context-gid.c @@ -31,7 +31,7 @@ size_t gid_get_size(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, size_t static void gid_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, struct lttng_kernel_ring_buffer_ctx *ctx, - struct lttng_channel *chan) + struct lttng_kernel_channel_buffer *chan) { gid_t gid; diff --git a/src/lttng-context-hostname.c b/src/lttng-context-hostname.c index c34ed5cd..8956e540 100644 --- a/src/lttng-context-hostname.c +++ b/src/lttng-context-hostname.c @@ -31,7 +31,7 @@ size_t hostname_get_size(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, s static void hostname_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, struct lttng_kernel_ring_buffer_ctx *ctx, - struct lttng_channel *chan) + struct lttng_kernel_channel_buffer *chan) { struct nsproxy *nsproxy; struct uts_namespace *ns; diff --git a/src/lttng-context-interruptible.c b/src/lttng-context-interruptible.c index 933b4d1f..bf2589da 100644 --- a/src/lttng-context-interruptible.c +++ b/src/lttng-context-interruptible.c @@ -34,7 +34,7 @@ size_t interruptible_get_size(void *priv, struct lttng_kernel_probe_ctx *probe_c static void interruptible_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, struct lttng_kernel_ring_buffer_ctx *ctx, - struct lttng_channel *chan) + struct lttng_kernel_channel_buffer *chan) { struct lttng_kernel_probe_ctx *lttng_probe_ctx = ctx->probe_ctx; int8_t interruptible = lttng_probe_ctx->interruptible; diff --git a/src/lttng-context-ipc-ns.c b/src/lttng-context-ipc-ns.c index 5a805f1e..c578fea8 100644 --- a/src/lttng-context-ipc-ns.c +++ b/src/lttng-context-ipc-ns.c @@ -36,7 +36,7 @@ size_t ipc_ns_get_size(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, siz static void ipc_ns_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, struct lttng_kernel_ring_buffer_ctx *ctx, - struct lttng_channel *chan) + struct lttng_kernel_channel_buffer *chan) { unsigned int ipc_ns_inum = 0; diff --git a/src/lttng-context-migratable.c b/src/lttng-context-migratable.c index ed5200ea..e2f6bfd9 100644 --- a/src/lttng-context-migratable.c +++ b/src/lttng-context-migratable.c @@ -30,7 +30,7 @@ size_t migratable_get_size(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, static void migratable_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, struct lttng_kernel_ring_buffer_ctx *ctx, - struct lttng_channel *chan) + struct lttng_kernel_channel_buffer *chan) { uint8_t migratable = !current->migrate_disable; diff --git a/src/lttng-context-mnt-ns.c b/src/lttng-context-mnt-ns.c index b58a151e..030a7f25 100644 --- a/src/lttng-context-mnt-ns.c +++ b/src/lttng-context-mnt-ns.c @@ -38,7 +38,7 @@ size_t mnt_ns_get_size(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, siz static void mnt_ns_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, struct lttng_kernel_ring_buffer_ctx *ctx, - struct lttng_channel *chan) + struct lttng_kernel_channel_buffer *chan) { unsigned int mnt_ns_inum = 0; diff --git a/src/lttng-context-need-reschedule.c b/src/lttng-context-need-reschedule.c index 0ceb6a5d..42cf11db 100644 --- a/src/lttng-context-need-reschedule.c +++ b/src/lttng-context-need-reschedule.c @@ -30,7 +30,7 @@ size_t need_reschedule_get_size(void *priv, struct lttng_kernel_probe_ctx *probe static void need_reschedule_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, struct lttng_kernel_ring_buffer_ctx *ctx, - struct lttng_channel *chan) + struct lttng_kernel_channel_buffer *chan) { uint8_t need_reschedule = test_tsk_need_resched(current); diff --git a/src/lttng-context-net-ns.c b/src/lttng-context-net-ns.c index 54c28e0f..1262178b 100644 --- a/src/lttng-context-net-ns.c +++ b/src/lttng-context-net-ns.c @@ -37,7 +37,7 @@ size_t net_ns_get_size(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, siz static void net_ns_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, struct lttng_kernel_ring_buffer_ctx *ctx, - struct lttng_channel *chan) + struct lttng_kernel_channel_buffer *chan) { unsigned int net_ns_inum = 0; diff --git a/src/lttng-context-nice.c b/src/lttng-context-nice.c index fb698648..a6847705 100644 --- a/src/lttng-context-nice.c +++ b/src/lttng-context-nice.c @@ -29,7 +29,7 @@ size_t nice_get_size(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, size_ static void nice_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, struct lttng_kernel_ring_buffer_ctx *ctx, - struct lttng_channel *chan) + struct lttng_kernel_channel_buffer *chan) { int nice; diff --git a/src/lttng-context-perf-counters.c b/src/lttng-context-perf-counters.c index 72e920af..0b466363 100644 --- a/src/lttng-context-perf-counters.c +++ b/src/lttng-context-perf-counters.c @@ -33,7 +33,7 @@ size_t perf_counter_get_size(void *priv, struct lttng_kernel_probe_ctx *probe_ct static void perf_counter_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, struct lttng_kernel_ring_buffer_ctx *ctx, - struct lttng_channel *chan) + struct lttng_kernel_channel_buffer *chan) { struct lttng_perf_counter_field *perf_field = (struct lttng_perf_counter_field *) priv; struct perf_event *event; diff --git a/src/lttng-context-pid-ns.c b/src/lttng-context-pid-ns.c index 4c5a3e19..f99fec9a 100644 --- a/src/lttng-context-pid-ns.c +++ b/src/lttng-context-pid-ns.c @@ -36,7 +36,7 @@ size_t pid_ns_get_size(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, siz static void pid_ns_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, struct lttng_kernel_ring_buffer_ctx *ctx, - struct lttng_channel *chan) + struct lttng_kernel_channel_buffer *chan) { struct pid_namespace *ns; unsigned int pid_ns_inum = 0; diff --git a/src/lttng-context-pid.c b/src/lttng-context-pid.c index 5f5a65a7..5bf9dfd1 100644 --- a/src/lttng-context-pid.c +++ b/src/lttng-context-pid.c @@ -29,7 +29,7 @@ size_t pid_get_size(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, size_t static void pid_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, struct lttng_kernel_ring_buffer_ctx *ctx, - struct lttng_channel *chan) + struct lttng_kernel_channel_buffer *chan) { pid_t pid; diff --git a/src/lttng-context-ppid.c b/src/lttng-context-ppid.c index 93cbc03c..8d359390 100644 --- a/src/lttng-context-ppid.c +++ b/src/lttng-context-ppid.c @@ -30,7 +30,7 @@ size_t ppid_get_size(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, size_ static void ppid_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, struct lttng_kernel_ring_buffer_ctx *ctx, - struct lttng_channel *chan) + struct lttng_kernel_channel_buffer *chan) { pid_t ppid; diff --git a/src/lttng-context-preemptible.c b/src/lttng-context-preemptible.c index ac9aab59..548e79f4 100644 --- a/src/lttng-context-preemptible.c +++ b/src/lttng-context-preemptible.c @@ -38,7 +38,7 @@ size_t preemptible_get_size(void *priv, struct lttng_kernel_probe_ctx *probe_ctx static void preemptible_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, struct lttng_kernel_ring_buffer_ctx *ctx, - struct lttng_channel *chan) + struct lttng_kernel_channel_buffer *chan) { int pc = preempt_count(); uint8_t preemptible = 0; diff --git a/src/lttng-context-prio.c b/src/lttng-context-prio.c index 97c0672c..27a0ab8a 100644 --- a/src/lttng-context-prio.c +++ b/src/lttng-context-prio.c @@ -56,7 +56,7 @@ size_t prio_get_size(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, size_ static void prio_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, struct lttng_kernel_ring_buffer_ctx *ctx, - struct lttng_channel *chan) + struct lttng_kernel_channel_buffer *chan) { int prio; diff --git a/src/lttng-context-procname.c b/src/lttng-context-procname.c index e2517bc6..aaefef84 100644 --- a/src/lttng-context-procname.c +++ b/src/lttng-context-procname.c @@ -35,7 +35,7 @@ size_t procname_get_size(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, s static void procname_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, struct lttng_kernel_ring_buffer_ctx *ctx, - struct lttng_channel *chan) + struct lttng_kernel_channel_buffer *chan) { chan->ops->event_write(ctx, current->comm, sizeof(current->comm)); } diff --git a/src/lttng-context-sgid.c b/src/lttng-context-sgid.c index 23c594f0..bffe9308 100644 --- a/src/lttng-context-sgid.c +++ b/src/lttng-context-sgid.c @@ -31,7 +31,7 @@ size_t sgid_get_size(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, size_ static void sgid_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, struct lttng_kernel_ring_buffer_ctx *ctx, - struct lttng_channel *chan) + struct lttng_kernel_channel_buffer *chan) { gid_t sgid; diff --git a/src/lttng-context-suid.c b/src/lttng-context-suid.c index 4d9b5af3..37ef7c3b 100644 --- a/src/lttng-context-suid.c +++ b/src/lttng-context-suid.c @@ -31,7 +31,7 @@ size_t suid_get_size(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, size_ static void suid_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, struct lttng_kernel_ring_buffer_ctx *ctx, - struct lttng_channel *chan) + struct lttng_kernel_channel_buffer *chan) { uid_t suid; diff --git a/src/lttng-context-tid.c b/src/lttng-context-tid.c index 9438cb63..538a2a58 100644 --- a/src/lttng-context-tid.c +++ b/src/lttng-context-tid.c @@ -29,7 +29,7 @@ size_t tid_get_size(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, size_t static void tid_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, struct lttng_kernel_ring_buffer_ctx *ctx, - struct lttng_channel *chan) + struct lttng_kernel_channel_buffer *chan) { pid_t tid; diff --git a/src/lttng-context-time-ns.c b/src/lttng-context-time-ns.c index e6300b52..72f0f1c4 100644 --- a/src/lttng-context-time-ns.c +++ b/src/lttng-context-time-ns.c @@ -36,7 +36,7 @@ size_t time_ns_get_size(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, si static void time_ns_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, struct lttng_kernel_ring_buffer_ctx *ctx, - struct lttng_channel *chan) + struct lttng_kernel_channel_buffer *chan) { unsigned int time_ns_inum = 0; diff --git a/src/lttng-context-uid.c b/src/lttng-context-uid.c index 434f7199..0bdc2ece 100644 --- a/src/lttng-context-uid.c +++ b/src/lttng-context-uid.c @@ -31,7 +31,7 @@ size_t uid_get_size(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, size_t static void uid_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, struct lttng_kernel_ring_buffer_ctx *ctx, - struct lttng_channel *chan) + struct lttng_kernel_channel_buffer *chan) { uid_t uid; diff --git a/src/lttng-context-user-ns.c b/src/lttng-context-user-ns.c index ae674667..b497754b 100644 --- a/src/lttng-context-user-ns.c +++ b/src/lttng-context-user-ns.c @@ -36,7 +36,7 @@ size_t user_ns_get_size(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, si static void user_ns_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, struct lttng_kernel_ring_buffer_ctx *ctx, - struct lttng_channel *chan) + struct lttng_kernel_channel_buffer *chan) { unsigned int user_ns_inum = 0; diff --git a/src/lttng-context-uts-ns.c b/src/lttng-context-uts-ns.c index 35c4aded..afa61ab9 100644 --- a/src/lttng-context-uts-ns.c +++ b/src/lttng-context-uts-ns.c @@ -36,7 +36,7 @@ size_t uts_ns_get_size(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, siz static void uts_ns_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, struct lttng_kernel_ring_buffer_ctx *ctx, - struct lttng_channel *chan) + struct lttng_kernel_channel_buffer *chan) { unsigned int uts_ns_inum = 0; diff --git a/src/lttng-context-vegid.c b/src/lttng-context-vegid.c index 9c010824..9abd29b8 100644 --- a/src/lttng-context-vegid.c +++ b/src/lttng-context-vegid.c @@ -31,7 +31,7 @@ size_t vegid_get_size(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, size static void vegid_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, struct lttng_kernel_ring_buffer_ctx *ctx, - struct lttng_channel *chan) + struct lttng_kernel_channel_buffer *chan) { gid_t vegid; diff --git a/src/lttng-context-veuid.c b/src/lttng-context-veuid.c index 775c078b..9113578e 100644 --- a/src/lttng-context-veuid.c +++ b/src/lttng-context-veuid.c @@ -31,7 +31,7 @@ size_t veuid_get_size(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, size static void veuid_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, struct lttng_kernel_ring_buffer_ctx *ctx, - struct lttng_channel *chan) + struct lttng_kernel_channel_buffer *chan) { uid_t veuid; diff --git a/src/lttng-context-vgid.c b/src/lttng-context-vgid.c index 689f2708..0b7516e2 100644 --- a/src/lttng-context-vgid.c +++ b/src/lttng-context-vgid.c @@ -31,7 +31,7 @@ size_t vgid_get_size(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, size_ static void vgid_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, struct lttng_kernel_ring_buffer_ctx *ctx, - struct lttng_channel *chan) + struct lttng_kernel_channel_buffer *chan) { gid_t vgid; diff --git a/src/lttng-context-vpid.c b/src/lttng-context-vpid.c index 6a01e431..f631f6e0 100644 --- a/src/lttng-context-vpid.c +++ b/src/lttng-context-vpid.c @@ -29,7 +29,7 @@ size_t vpid_get_size(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, size_ static void vpid_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, struct lttng_kernel_ring_buffer_ctx *ctx, - struct lttng_channel *chan) + struct lttng_kernel_channel_buffer *chan) { pid_t vpid; diff --git a/src/lttng-context-vppid.c b/src/lttng-context-vppid.c index 4d61fef0..d6823643 100644 --- a/src/lttng-context-vppid.c +++ b/src/lttng-context-vppid.c @@ -30,7 +30,7 @@ size_t vppid_get_size(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, size static void vppid_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, struct lttng_kernel_ring_buffer_ctx *ctx, - struct lttng_channel *chan) + struct lttng_kernel_channel_buffer *chan) { struct task_struct *parent; pid_t vppid; diff --git a/src/lttng-context-vsgid.c b/src/lttng-context-vsgid.c index eb051f27..09c5c139 100644 --- a/src/lttng-context-vsgid.c +++ b/src/lttng-context-vsgid.c @@ -31,7 +31,7 @@ size_t vsgid_get_size(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, size static void vsgid_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, struct lttng_kernel_ring_buffer_ctx *ctx, - struct lttng_channel *chan) + struct lttng_kernel_channel_buffer *chan) { gid_t vsgid; diff --git a/src/lttng-context-vsuid.c b/src/lttng-context-vsuid.c index 8210e8f8..0f748983 100644 --- a/src/lttng-context-vsuid.c +++ b/src/lttng-context-vsuid.c @@ -31,7 +31,7 @@ size_t vsuid_get_size(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, size static void vsuid_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, struct lttng_kernel_ring_buffer_ctx *ctx, - struct lttng_channel *chan) + struct lttng_kernel_channel_buffer *chan) { uid_t vsuid; diff --git a/src/lttng-context-vtid.c b/src/lttng-context-vtid.c index 17c4bf6f..f4273463 100644 --- a/src/lttng-context-vtid.c +++ b/src/lttng-context-vtid.c @@ -29,7 +29,7 @@ size_t vtid_get_size(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, size_ static void vtid_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, struct lttng_kernel_ring_buffer_ctx *ctx, - struct lttng_channel *chan) + struct lttng_kernel_channel_buffer *chan) { pid_t vtid; diff --git a/src/lttng-context-vuid.c b/src/lttng-context-vuid.c index 2330991a..817800e4 100644 --- a/src/lttng-context-vuid.c +++ b/src/lttng-context-vuid.c @@ -31,7 +31,7 @@ size_t vuid_get_size(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, size_ static void vuid_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, struct lttng_kernel_ring_buffer_ctx *ctx, - struct lttng_channel *chan) + struct lttng_kernel_channel_buffer *chan) { uid_t vuid; diff --git a/src/lttng-events.c b/src/lttng-events.c index 78e50c87..999080bc 100644 --- a/src/lttng-events.c +++ b/src/lttng-events.c @@ -70,12 +70,12 @@ static void lttng_event_notifier_enabler_destroy(struct lttng_event_notifier_ena static void lttng_event_notifier_group_sync_enablers(struct lttng_event_notifier_group *event_notifier_group); static void _lttng_event_destroy(struct lttng_kernel_event_common *event); -static void _lttng_channel_destroy(struct lttng_channel *chan); +static void _lttng_channel_destroy(struct lttng_kernel_channel_buffer *chan); static int _lttng_event_unregister(struct lttng_kernel_event_recorder *event); static int _lttng_event_notifier_unregister(struct lttng_kernel_event_notifier *event_notifier); static int _lttng_event_metadata_statedump(struct lttng_kernel_session *session, - struct lttng_channel *chan, + struct lttng_kernel_channel_buffer *chan, struct lttng_kernel_event_recorder *event); static int _lttng_session_metadata_statedump(struct lttng_kernel_session *session); @@ -350,7 +350,7 @@ void metadata_cache_destroy(struct kref *kref) void lttng_session_destroy(struct lttng_kernel_session *session) { - struct lttng_channel *chan, *tmpchan; + struct lttng_kernel_channel_buffer_private *chan_priv, *tmpchan_priv; struct lttng_kernel_event_recorder_private *event_recorder_priv, *tmpevent_recorder_priv; struct lttng_metadata_stream *metadata_stream; struct lttng_event_enabler *event_enabler, *tmp_event_enabler; @@ -358,8 +358,8 @@ void lttng_session_destroy(struct lttng_kernel_session *session) mutex_lock(&sessions_mutex); WRITE_ONCE(session->active, 0); - list_for_each_entry(chan, &session->priv->chan, list) { - ret = lttng_syscalls_unregister_channel(chan); + list_for_each_entry(chan_priv, &session->priv->chan, node) { + ret = lttng_syscalls_unregister_channel(chan_priv->pub); WARN_ON(ret); } list_for_each_entry(event_recorder_priv, &session->priv->events, node) { @@ -367,8 +367,8 @@ void lttng_session_destroy(struct lttng_kernel_session *session) WARN_ON(ret); } synchronize_trace(); /* Wait for in-flight events to complete */ - list_for_each_entry(chan, &session->priv->chan, list) { - ret = lttng_syscalls_destroy_event(chan); + list_for_each_entry(chan_priv, &session->priv->chan, node) { + ret = lttng_syscalls_destroy_event(chan_priv->pub); WARN_ON(ret); } list_for_each_entry_safe(event_enabler, tmp_event_enabler, @@ -376,9 +376,9 @@ void lttng_session_destroy(struct lttng_kernel_session *session) lttng_event_enabler_destroy(event_enabler); list_for_each_entry_safe(event_recorder_priv, tmpevent_recorder_priv, &session->priv->events, node) _lttng_event_destroy(&event_recorder_priv->pub->parent); - list_for_each_entry_safe(chan, tmpchan, &session->priv->chan, list) { - BUG_ON(chan->channel_type == METADATA_CHANNEL); - _lttng_channel_destroy(chan); + list_for_each_entry_safe(chan_priv, tmpchan_priv, &session->priv->chan, node) { + BUG_ON(chan_priv->channel_type == METADATA_CHANNEL); + _lttng_channel_destroy(chan_priv->pub); } mutex_lock(&session->priv->metadata_cache->lock); list_for_each_entry(metadata_stream, &session->priv->metadata_cache->metadata_stream, list) @@ -463,7 +463,7 @@ int lttng_session_statedump(struct lttng_kernel_session *session) int lttng_session_enable(struct lttng_kernel_session *session) { int ret = 0; - struct lttng_channel *chan; + struct lttng_kernel_channel_buffer_private *chan_priv; mutex_lock(&sessions_mutex); if (session->active) { @@ -481,19 +481,19 @@ int lttng_session_enable(struct lttng_kernel_session *session) * Snapshot the number of events per channel to know the type of header * we need to use. */ - list_for_each_entry(chan, &session->priv->chan, list) { - if (chan->header_type) - continue; /* don't change it if session stop/restart */ - if (chan->free_event_id < 31) - chan->header_type = 1; /* compact */ + list_for_each_entry(chan_priv, &session->priv->chan, node) { + if (chan_priv->header_type) + continue; /* don't change it if session stop/restart */ + if (chan_priv->free_event_id < 31) + chan_priv->header_type = 1; /* compact */ else - chan->header_type = 2; /* large */ + chan_priv->header_type = 2; /* large */ } /* Clear each stream's quiescent state. */ - list_for_each_entry(chan, &session->priv->chan, list) { - if (chan->channel_type != METADATA_CHANNEL) - lib_ring_buffer_clear_quiescent_channel(chan->chan); + list_for_each_entry(chan_priv, &session->priv->chan, node) { + if (chan_priv->channel_type != METADATA_CHANNEL) + lib_ring_buffer_clear_quiescent_channel(chan_priv->rb_chan); } WRITE_ONCE(session->active, 1); @@ -514,7 +514,7 @@ end: int lttng_session_disable(struct lttng_kernel_session *session) { int ret = 0; - struct lttng_channel *chan; + struct lttng_kernel_channel_buffer_private *chan_priv; mutex_lock(&sessions_mutex); if (!session->active) { @@ -528,9 +528,9 @@ int lttng_session_disable(struct lttng_kernel_session *session) lttng_session_sync_event_enablers(session); /* Set each stream's quiescent state. */ - list_for_each_entry(chan, &session->priv->chan, list) { - if (chan->channel_type != METADATA_CHANNEL) - lib_ring_buffer_set_quiescent_channel(chan->chan); + list_for_each_entry(chan_priv, &session->priv->chan, node) { + if (chan_priv->channel_type != METADATA_CHANNEL) + lib_ring_buffer_set_quiescent_channel(chan_priv->rb_chan); } end: mutex_unlock(&sessions_mutex); @@ -540,7 +540,7 @@ end: int lttng_session_metadata_regenerate(struct lttng_kernel_session *session) { int ret = 0; - struct lttng_channel *chan; + struct lttng_kernel_channel_buffer_private *chan_priv; struct lttng_kernel_event_recorder_private *event_recorder_priv; struct lttng_metadata_cache *cache = session->priv->metadata_cache; struct lttng_metadata_stream *stream; @@ -562,8 +562,8 @@ int lttng_session_metadata_regenerate(struct lttng_kernel_session *session) mutex_unlock(&cache->lock); session->priv->metadata_dumped = 0; - list_for_each_entry(chan, &session->priv->chan, list) { - chan->metadata_dumped = 0; + list_for_each_entry(chan_priv, &session->priv->chan, node) { + chan_priv->metadata_dumped = 0; } list_for_each_entry(event_recorder_priv, &session->priv->events, node) { @@ -577,47 +577,47 @@ end: return ret; } -int lttng_channel_enable(struct lttng_channel *channel) +int lttng_channel_enable(struct lttng_kernel_channel_buffer *channel) { int ret = 0; mutex_lock(&sessions_mutex); - if (channel->channel_type == METADATA_CHANNEL) { + if (channel->priv->channel_type == METADATA_CHANNEL) { ret = -EPERM; goto end; } - if (channel->enabled) { + if (channel->parent.enabled) { ret = -EEXIST; goto end; } /* Set transient enabler state to "enabled" */ - channel->tstate = 1; - lttng_session_sync_event_enablers(channel->session); + channel->priv->parent.tstate = 1; + lttng_session_sync_event_enablers(channel->parent.session); /* Set atomically the state to "enabled" */ - WRITE_ONCE(channel->enabled, 1); + WRITE_ONCE(channel->parent.enabled, 1); end: mutex_unlock(&sessions_mutex); return ret; } -int lttng_channel_disable(struct lttng_channel *channel) +int lttng_channel_disable(struct lttng_kernel_channel_buffer *channel) { int ret = 0; mutex_lock(&sessions_mutex); - if (channel->channel_type == METADATA_CHANNEL) { + if (channel->priv->channel_type == METADATA_CHANNEL) { ret = -EPERM; goto end; } - if (!channel->enabled) { + if (!channel->parent.enabled) { ret = -EEXIST; goto end; } /* Set atomically the state to "disabled" */ - WRITE_ONCE(channel->enabled, 0); + WRITE_ONCE(channel->parent.enabled, 0); /* Set transient enabler state to "enabled" */ - channel->tstate = 0; - lttng_session_sync_event_enablers(channel->session); + channel->priv->parent.tstate = 0; + lttng_session_sync_event_enablers(channel->parent.session); end: mutex_unlock(&sessions_mutex); return ret; @@ -634,7 +634,7 @@ int lttng_event_enable(struct lttng_kernel_event_common *event) struct lttng_kernel_event_recorder *event_recorder = container_of(event, struct lttng_kernel_event_recorder, parent); - if (event_recorder->chan->channel_type == METADATA_CHANNEL) { + if (event_recorder->chan->priv->channel_type == METADATA_CHANNEL) { ret = -EPERM; goto end; } @@ -694,7 +694,7 @@ int lttng_event_disable(struct lttng_kernel_event_common *event) struct lttng_kernel_event_recorder *event_recorder = container_of(event, struct lttng_kernel_event_recorder, parent); - if (event_recorder->chan->channel_type == METADATA_CHANNEL) { + if (event_recorder->chan->priv->channel_type == METADATA_CHANNEL) { ret = -EPERM; goto end; } @@ -743,7 +743,7 @@ end: return ret; } -struct lttng_channel *lttng_channel_create(struct lttng_kernel_session *session, +struct lttng_kernel_channel_buffer *lttng_channel_create(struct lttng_kernel_session *session, const char *transport_name, void *buf_addr, size_t subbuf_size, size_t num_subbuf, @@ -751,7 +751,8 @@ struct lttng_channel *lttng_channel_create(struct lttng_kernel_session *session, unsigned int read_timer_interval, enum channel_type channel_type) { - struct lttng_channel *chan; + struct lttng_kernel_channel_buffer *chan; + struct lttng_kernel_channel_buffer_private *chan_priv; struct lttng_transport *transport = NULL; mutex_lock(&sessions_mutex); @@ -767,31 +768,39 @@ struct lttng_channel *lttng_channel_create(struct lttng_kernel_session *session, printk(KERN_WARNING "LTTng: Can't lock transport module.\n"); goto notransport; } - chan = kzalloc(sizeof(struct lttng_channel), GFP_KERNEL); + chan = kzalloc(sizeof(struct lttng_kernel_channel_buffer), GFP_KERNEL); if (!chan) goto nomem; - chan->session = session; - chan->id = session->priv->free_chan_id++; + chan_priv = kzalloc(sizeof(struct lttng_kernel_channel_buffer_private), GFP_KERNEL); + if (!chan_priv) + goto nomem_priv; + chan->priv = chan_priv; + chan_priv->pub = chan; + chan->parent.type = LTTNG_KERNEL_CHANNEL_TYPE_BUFFER; + chan->parent.session = session; + chan->priv->id = session->priv->free_chan_id++; chan->ops = &transport->ops; /* * Note: the channel creation op already writes into the packet * headers. Therefore the "chan" information used as input * should be already accessible. */ - chan->chan = transport->ops.priv->channel_create(transport_name, + chan->priv->rb_chan = transport->ops.priv->channel_create(transport_name, chan, buf_addr, subbuf_size, num_subbuf, switch_timer_interval, read_timer_interval); - if (!chan->chan) + if (!chan->priv->rb_chan) goto create_error; - chan->tstate = 1; - chan->enabled = 1; - chan->transport = transport; - chan->channel_type = channel_type; - list_add(&chan->list, &session->priv->chan); + chan->priv->parent.tstate = 1; + chan->parent.enabled = 1; + chan->priv->transport = transport; + chan->priv->channel_type = channel_type; + list_add(&chan->priv->node, &session->priv->chan); mutex_unlock(&sessions_mutex); return chan; create_error: + kfree(chan_priv); +nomem_priv: kfree(chan); nomem: if (transport) @@ -808,18 +817,19 @@ active: * Needs to be called with sessions mutex held. */ static -void _lttng_channel_destroy(struct lttng_channel *chan) +void _lttng_channel_destroy(struct lttng_kernel_channel_buffer *chan) { - chan->ops->priv->channel_destroy(chan->chan); - module_put(chan->transport->owner); - list_del(&chan->list); - lttng_kernel_destroy_context(chan->ctx); + chan->ops->priv->channel_destroy(chan->priv->rb_chan); + module_put(chan->priv->transport->owner); + list_del(&chan->priv->node); + lttng_kernel_destroy_context(chan->priv->ctx); + kfree(chan->priv); kfree(chan); } -void lttng_metadata_channel_destroy(struct lttng_channel *chan) +void lttng_metadata_channel_destroy(struct lttng_kernel_channel_buffer *chan) { - BUG_ON(chan->channel_type != METADATA_CHANNEL); + BUG_ON(chan->priv->channel_type != METADATA_CHANNEL); /* Protect the metadata cache with the sessions_mutex. */ mutex_lock(&sessions_mutex); @@ -840,19 +850,19 @@ void _lttng_metadata_channel_hangup(struct lttng_metadata_stream *stream) * Supports event creation while tracing session is active. * Needs to be called with sessions mutex held. */ -struct lttng_kernel_event_recorder *_lttng_kernel_event_recorder_create(struct lttng_channel *chan, +struct lttng_kernel_event_recorder *_lttng_kernel_event_recorder_create(struct lttng_kernel_channel_buffer *chan, struct lttng_kernel_abi_event *event_param, const struct lttng_kernel_event_desc *event_desc, enum lttng_kernel_abi_instrumentation itype) { - struct lttng_kernel_session *session = chan->session; + struct lttng_kernel_session *session = chan->parent.session; struct lttng_kernel_event_recorder *event_recorder; struct lttng_kernel_event_recorder_private *event_recorder_priv; const char *event_name; struct hlist_head *head; int ret; - if (chan->free_event_id == -1U) { + if (chan->priv->free_event_id == -1U) { ret = -EMFILE; goto full; } @@ -907,7 +917,7 @@ struct lttng_kernel_event_recorder *_lttng_kernel_event_recorder_create(struct l event_recorder->parent.run_filter = lttng_kernel_interpret_event_filter; event_recorder->chan = chan; - event_recorder->priv->id = chan->free_event_id++; + event_recorder->priv->id = chan->priv->free_event_id++; event_recorder->priv->parent.instrumentation = itype; INIT_LIST_HEAD(&event_recorder->priv->parent.filter_bytecode_runtime_head); INIT_LIST_HEAD(&event_recorder->priv->parent.enablers_ref_head); @@ -983,7 +993,7 @@ struct lttng_kernel_event_recorder *_lttng_kernel_event_recorder_create(struct l event_recorder_return->parent.run_filter = lttng_kernel_interpret_event_filter; event_recorder_return->chan = chan; - event_recorder_return->priv->id = chan->free_event_id++; + event_recorder_return->priv->id = chan->priv->free_event_id++; event_recorder_return->priv->parent.instrumentation = itype; event_recorder_return->parent.enabled = 0; event_recorder_return->priv->parent.registered = 1; @@ -1009,7 +1019,7 @@ struct lttng_kernel_event_recorder *_lttng_kernel_event_recorder_create(struct l WARN_ON_ONCE(!ret); ret = try_module_get(event_recorder_return->priv->parent.desc->owner); WARN_ON_ONCE(!ret); - ret = _lttng_event_metadata_statedump(chan->session, chan, + ret = _lttng_event_metadata_statedump(chan->parent.session, chan, event_recorder_return); WARN_ON_ONCE(ret > 0); if (ret) { @@ -1019,7 +1029,7 @@ struct lttng_kernel_event_recorder *_lttng_kernel_event_recorder_create(struct l module_put(event_recorder->priv->parent.desc->owner); goto statedump_error; } - list_add(&event_recorder_return->priv->node, &chan->session->priv->events); + list_add(&event_recorder_return->priv->node, &chan->parent.session->priv->events); break; } @@ -1089,13 +1099,13 @@ struct lttng_kernel_event_recorder *_lttng_kernel_event_recorder_create(struct l ret = -EINVAL; goto register_error; } - ret = _lttng_event_metadata_statedump(chan->session, chan, event_recorder); + ret = _lttng_event_metadata_statedump(chan->parent.session, chan, event_recorder); WARN_ON_ONCE(ret > 0); if (ret) { goto statedump_error; } hlist_add_head(&event_recorder->priv->hlist, head); - list_add(&event_recorder->priv->node, &chan->session->priv->events); + list_add(&event_recorder->priv->node, &chan->parent.session->priv->events); return event_recorder; statedump_error: @@ -1360,7 +1370,7 @@ int lttng_kernel_counter_clear(struct lttng_counter *counter, return counter->ops->counter_clear(counter->counter, dim_indexes); } -struct lttng_kernel_event_recorder *lttng_kernel_event_recorder_create(struct lttng_channel *chan, +struct lttng_kernel_event_recorder *lttng_kernel_event_recorder_create(struct lttng_kernel_channel_buffer *chan, struct lttng_kernel_abi_event *event_param, const struct lttng_kernel_event_desc *event_desc, enum lttng_kernel_abi_instrumentation itype) @@ -2066,7 +2076,7 @@ struct lttng_enabler_ref *lttng_enabler_ref( static void lttng_create_tracepoint_event_if_missing(struct lttng_event_enabler *event_enabler) { - struct lttng_kernel_session *session = event_enabler->chan->session; + struct lttng_kernel_session *session = event_enabler->chan->parent.session; struct lttng_kernel_probe_desc *probe_desc; const struct lttng_kernel_event_desc *desc; int i; @@ -2226,8 +2236,8 @@ void lttng_create_event_if_missing(struct lttng_event_enabler *event_enabler) static int lttng_event_enabler_ref_events(struct lttng_event_enabler *event_enabler) { - struct lttng_channel *chan = event_enabler->chan; - struct lttng_kernel_session *session = event_enabler->chan->session; + struct lttng_kernel_channel_buffer *chan = event_enabler->chan; + struct lttng_kernel_session *session = event_enabler->chan->parent.session; struct lttng_enabler *base_enabler = lttng_event_enabler_as_enabler(event_enabler); struct lttng_kernel_event_recorder_private *event_recorder_priv; @@ -2239,10 +2249,10 @@ int lttng_event_enabler_ref_events(struct lttng_event_enabler *event_enabler) enum lttng_kernel_abi_syscall_entryexit entryexit = base_enabler->event_param.u.syscall.entryexit; if (entryexit == LTTNG_KERNEL_ABI_SYSCALL_ENTRY || entryexit == LTTNG_KERNEL_ABI_SYSCALL_ENTRYEXIT) - WRITE_ONCE(chan->syscall_all_entry, enabled); + WRITE_ONCE(chan->priv->parent.syscall_all_entry, enabled); if (entryexit == LTTNG_KERNEL_ABI_SYSCALL_EXIT || entryexit == LTTNG_KERNEL_ABI_SYSCALL_ENTRYEXIT) - WRITE_ONCE(chan->syscall_all_exit, enabled); + WRITE_ONCE(chan->priv->parent.syscall_all_exit, enabled); } /* First ensure that probe events are created for this enabler. */ @@ -2426,7 +2436,7 @@ int lttng_fix_pending_event_notifiers(void) struct lttng_event_enabler *lttng_event_enabler_create( enum lttng_enabler_format_type format_type, struct lttng_kernel_abi_event *event_param, - struct lttng_channel *chan) + struct lttng_kernel_channel_buffer *chan) { struct lttng_event_enabler *event_enabler; @@ -2441,8 +2451,8 @@ struct lttng_event_enabler *lttng_event_enabler_create( /* ctx left NULL */ event_enabler->base.enabled = 0; mutex_lock(&sessions_mutex); - list_add(&event_enabler->node, &event_enabler->chan->session->priv->enablers_head); - lttng_session_lazy_sync_event_enablers(event_enabler->chan->session); + list_add(&event_enabler->node, &event_enabler->chan->parent.session->priv->enablers_head); + lttng_session_lazy_sync_event_enablers(event_enabler->chan->parent.session); mutex_unlock(&sessions_mutex); return event_enabler; } @@ -2451,7 +2461,7 @@ int lttng_event_enabler_enable(struct lttng_event_enabler *event_enabler) { mutex_lock(&sessions_mutex); lttng_event_enabler_as_enabler(event_enabler)->enabled = 1; - lttng_session_lazy_sync_event_enablers(event_enabler->chan->session); + lttng_session_lazy_sync_event_enablers(event_enabler->chan->parent.session); mutex_unlock(&sessions_mutex); return 0; } @@ -2460,7 +2470,7 @@ int lttng_event_enabler_disable(struct lttng_event_enabler *event_enabler) { mutex_lock(&sessions_mutex); lttng_event_enabler_as_enabler(event_enabler)->enabled = 0; - lttng_session_lazy_sync_event_enablers(event_enabler->chan->session); + lttng_session_lazy_sync_event_enablers(event_enabler->chan->parent.session); mutex_unlock(&sessions_mutex); return 0; } @@ -2507,7 +2517,7 @@ int lttng_event_enabler_attach_filter_bytecode(struct lttng_event_enabler *event if (ret) goto error; - lttng_session_lazy_sync_event_enablers(event_enabler->chan->session); + lttng_session_lazy_sync_event_enablers(event_enabler->chan->parent.session); return 0; error: @@ -2723,7 +2733,7 @@ void lttng_session_sync_event_enablers(struct lttng_kernel_session *session) * intesection of session and channel transient enable * states. */ - enabled = enabled && session->priv->tstate && event_recorder->chan->tstate; + enabled = enabled && session->priv->tstate && event_recorder->chan->priv->parent.tstate; WRITE_ONCE(event_recorder->parent.enabled, enabled); /* @@ -3627,14 +3637,14 @@ int _lttng_fields_metadata_statedump(struct lttng_kernel_session *session, */ static int _lttng_event_metadata_statedump(struct lttng_kernel_session *session, - struct lttng_channel *chan, + struct lttng_kernel_channel_buffer *chan, struct lttng_kernel_event_recorder *event_recorder) { int ret = 0; if (event_recorder->priv->metadata_dumped || !LTTNG_READ_ONCE(session->active)) return 0; - if (chan->channel_type == METADATA_CHANNEL) + if (chan->priv->channel_type == METADATA_CHANNEL) return 0; lttng_metadata_begin(session); @@ -3646,7 +3656,7 @@ int _lttng_event_metadata_statedump(struct lttng_kernel_session *session, " stream_id = %u;\n", event_recorder->priv->parent.desc->event_name, event_recorder->priv->id, - event_recorder->chan->id); + event_recorder->chan->priv->id); if (ret) goto end; @@ -3684,40 +3694,40 @@ end: */ static int _lttng_channel_metadata_statedump(struct lttng_kernel_session *session, - struct lttng_channel *chan) + struct lttng_kernel_channel_buffer *chan) { int ret = 0; - if (chan->metadata_dumped || !LTTNG_READ_ONCE(session->active)) + if (chan->priv->metadata_dumped || !LTTNG_READ_ONCE(session->active)) return 0; - if (chan->channel_type == METADATA_CHANNEL) + if (chan->priv->channel_type == METADATA_CHANNEL) return 0; lttng_metadata_begin(session); - WARN_ON_ONCE(!chan->header_type); + WARN_ON_ONCE(!chan->priv->header_type); ret = lttng_metadata_printf(session, "stream {\n" " id = %u;\n" " event.header := %s;\n" " packet.context := struct packet_context;\n", - chan->id, - chan->header_type == 1 ? "struct event_header_compact" : + chan->priv->id, + chan->priv->header_type == 1 ? "struct event_header_compact" : "struct event_header_large"); if (ret) goto end; - if (chan->ctx) { + if (chan->priv->ctx) { ret = lttng_metadata_printf(session, " event.context := struct {\n"); if (ret) goto end; } - ret = _lttng_context_metadata_statedump(session, chan->ctx); + ret = _lttng_context_metadata_statedump(session, chan->priv->ctx); if (ret) goto end; - if (chan->ctx) { + if (chan->priv->ctx) { ret = lttng_metadata_printf(session, " };\n"); if (ret) @@ -3727,7 +3737,7 @@ int _lttng_channel_metadata_statedump(struct lttng_kernel_session *session, ret = lttng_metadata_printf(session, "};\n\n"); - chan->metadata_dumped = 1; + chan->priv->metadata_dumped = 1; end: lttng_metadata_end(session); return ret; @@ -3911,7 +3921,7 @@ int _lttng_session_metadata_statedump(struct lttng_kernel_session *session) unsigned char *uuid_c = session->priv->uuid.b; unsigned char uuid_s[37], clock_uuid_s[BOOT_ID_LEN]; const char *product_uuid; - struct lttng_channel *chan; + struct lttng_kernel_channel_buffer_private *chan_priv; struct lttng_kernel_event_recorder_private *event_recorder_priv; int ret = 0; @@ -4079,8 +4089,8 @@ int _lttng_session_metadata_statedump(struct lttng_kernel_session *session) goto end; skip_session: - list_for_each_entry(chan, &session->priv->chan, list) { - ret = _lttng_channel_metadata_statedump(session, chan); + list_for_each_entry(chan_priv, &session->priv->chan, node) { + ret = _lttng_channel_metadata_statedump(session, chan_priv->pub); if (ret) goto end; } @@ -4285,7 +4295,6 @@ static void lttng_exit_cpu_hotplug(void) } #endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,10,0)) */ - static int __init lttng_events_init(void) { int ret; diff --git a/src/lttng-ring-buffer-client.h b/src/lttng-ring-buffer-client.h index ac6d5e41..e8f94e24 100644 --- a/src/lttng-ring-buffer-client.h +++ b/src/lttng-ring-buffer-client.h @@ -89,7 +89,8 @@ size_t ctx_get_aligned_size(size_t offset, struct lttng_kernel_ctx *ctx, static inline void ctx_get_struct_size(struct lttng_kernel_ctx *ctx, size_t *ctx_len, - struct lttng_channel *chan, struct lttng_kernel_ring_buffer_ctx *bufctx) + struct lttng_kernel_channel_buffer *lttng_chan, + struct lttng_kernel_ring_buffer_ctx *bufctx) { int i; size_t offset = 0; @@ -107,7 +108,7 @@ void ctx_get_struct_size(struct lttng_kernel_ctx *ctx, size_t *ctx_len, static inline void ctx_record(struct lttng_kernel_ring_buffer_ctx *bufctx, - struct lttng_channel *chan, + struct lttng_kernel_channel_buffer *lttng_chan, struct lttng_kernel_ctx *ctx) { int i; @@ -117,7 +118,7 @@ void ctx_record(struct lttng_kernel_ring_buffer_ctx *bufctx, lib_ring_buffer_align_ctx(bufctx, ctx->largest_align); for (i = 0; i < ctx->nr_fields; i++) ctx->fields[i].record(ctx->fields[i].priv, bufctx->probe_ctx, - bufctx, chan); + bufctx, lttng_chan); } /* @@ -140,11 +141,11 @@ size_t record_header_size(const struct lib_ring_buffer_config *config, struct lttng_kernel_ring_buffer_ctx *ctx, struct lttng_client_ctx *client_ctx) { - struct lttng_channel *lttng_chan = channel_get_private(chan); + struct lttng_kernel_channel_buffer *lttng_chan = channel_get_private(chan); size_t orig_offset = offset; size_t padding; - switch (lttng_chan->header_type) { + switch (lttng_chan->priv->header_type) { case 1: /* compact */ padding = lib_ring_buffer_align(offset, lttng_alignof(uint32_t)); offset += padding; @@ -179,7 +180,7 @@ size_t record_header_size(const struct lib_ring_buffer_config *config, padding = 0; WARN_ON_ONCE(1); } - offset += ctx_get_aligned_size(offset, lttng_chan->ctx, + offset += ctx_get_aligned_size(offset, lttng_chan->priv->ctx, client_ctx->packet_context_len); *pre_header_padding = padding; return offset - orig_offset; @@ -206,12 +207,12 @@ void lttng_write_event_header(const struct lib_ring_buffer_config *config, struct lttng_kernel_ring_buffer_ctx *ctx, uint32_t event_id) { - struct lttng_channel *lttng_chan = channel_get_private(ctx->priv.chan); + struct lttng_kernel_channel_buffer *lttng_chan = channel_get_private(ctx->priv.chan); if (unlikely(ctx->priv.rflags)) goto slow_path; - switch (lttng_chan->header_type) { + switch (lttng_chan->priv->header_type) { case 1: /* compact */ { uint32_t id_time = 0; @@ -241,7 +242,7 @@ void lttng_write_event_header(const struct lib_ring_buffer_config *config, WARN_ON_ONCE(1); } - ctx_record(ctx, lttng_chan, lttng_chan->ctx); + ctx_record(ctx, lttng_chan, lttng_chan->priv->ctx); lib_ring_buffer_align_ctx(ctx, ctx->largest_align); return; @@ -255,9 +256,9 @@ void lttng_write_event_header_slow(const struct lib_ring_buffer_config *config, struct lttng_kernel_ring_buffer_ctx *ctx, uint32_t event_id) { - struct lttng_channel *lttng_chan = channel_get_private(ctx->priv.chan); + struct lttng_kernel_channel_buffer *lttng_chan = channel_get_private(ctx->priv.chan); - switch (lttng_chan->header_type) { + switch (lttng_chan->priv->header_type) { case 1: /* compact */ if (!(ctx->priv.rflags & (RING_BUFFER_RFLAG_FULL_TSC | LTTNG_RFLAG_EXTENDED))) { uint32_t id_time = 0; @@ -311,7 +312,7 @@ void lttng_write_event_header_slow(const struct lib_ring_buffer_config *config, default: WARN_ON_ONCE(1); } - ctx_record(ctx, lttng_chan, lttng_chan->ctx); + ctx_record(ctx, lttng_chan, lttng_chan->priv->ctx); lib_ring_buffer_align_ctx(ctx, ctx->largest_align); } @@ -353,12 +354,12 @@ static void client_buffer_begin(struct lib_ring_buffer *buf, u64 tsc, (struct packet_header *) lib_ring_buffer_offset_address(&buf->backend, subbuf_idx * chan->backend.subbuf_size); - struct lttng_channel *lttng_chan = channel_get_private(chan); - struct lttng_kernel_session *session = lttng_chan->session; + struct lttng_kernel_channel_buffer *lttng_chan = channel_get_private(chan); + struct lttng_kernel_session *session = lttng_chan->parent.session; header->magic = CTF_MAGIC_NUMBER; memcpy(header->uuid, session->priv->uuid.b, sizeof(session->priv->uuid)); - header->stream_id = lttng_chan->id; + header->stream_id = lttng_chan->priv->id; header->stream_instance_id = buf->backend.cpu; header->ctx.timestamp_begin = tsc; header->ctx.timestamp_end = 0; @@ -468,9 +469,9 @@ static int client_stream_id(const struct lib_ring_buffer_config *config, uint64_t *stream_id) { struct channel *chan = buf->backend.chan; - struct lttng_channel *lttng_chan = channel_get_private(chan); + struct lttng_kernel_channel_buffer *lttng_chan = channel_get_private(chan); - *stream_id = lttng_chan->id; + *stream_id = lttng_chan->priv->id; return 0; } @@ -543,7 +544,7 @@ struct channel *_channel_create(const char *name, unsigned int switch_timer_interval, unsigned int read_timer_interval) { - struct lttng_channel *lttng_chan = priv; + struct lttng_kernel_channel_buffer *lttng_chan = priv; struct channel *chan; chan = channel_create(&client_config, name, lttng_chan, buf_addr, @@ -606,7 +607,7 @@ static int lttng_event_reserve(struct lttng_kernel_ring_buffer_ctx *ctx) { struct lttng_kernel_event_recorder *event_recorder = ctx->client_priv; - struct lttng_channel *lttng_chan = event_recorder->chan; + struct lttng_kernel_channel_buffer *lttng_chan = event_recorder->chan; struct lttng_client_ctx client_ctx; int ret, cpu; uint32_t event_id; @@ -616,13 +617,13 @@ int lttng_event_reserve(struct lttng_kernel_ring_buffer_ctx *ctx) return -EPERM; event_id = event_recorder->priv->id; memset(&ctx->priv, 0, sizeof(ctx->priv)); - ctx->priv.chan = lttng_chan->chan; + ctx->priv.chan = lttng_chan->priv->rb_chan; ctx->priv.reserve_cpu = cpu; /* Compute internal size of context structures. */ - ctx_get_struct_size(lttng_chan->ctx, &client_ctx.packet_context_len, lttng_chan, ctx); + ctx_get_struct_size(lttng_chan->priv->ctx, &client_ctx.packet_context_len, lttng_chan, ctx); - switch (lttng_chan->header_type) { + switch (lttng_chan->priv->header_type) { case 1: /* compact */ if (event_id > 30) ctx->priv.rflags |= LTTNG_RFLAG_EXTENDED; @@ -690,6 +691,12 @@ void lttng_event_strcpy_from_user(struct lttng_kernel_ring_buffer_ctx *ctx, len, '#'); } +static +void lttng_channel_buffer_lost_event_too_big(struct lttng_kernel_channel_buffer *lttng_chan) +{ + lib_ring_buffer_lost_event_too_big(lttng_chan->priv->rb_chan); +} + static wait_queue_head_t *lttng_get_writer_buf_wait_queue(struct channel *chan, int cpu) { @@ -750,6 +757,7 @@ static struct lttng_transport lttng_relay_transport = { .event_memset = lttng_event_memset, .event_strcpy = lttng_event_strcpy, .event_strcpy_from_user = lttng_event_strcpy_from_user, + .lost_event_too_big = lttng_channel_buffer_lost_event_too_big, }, }; diff --git a/src/lttng-ring-buffer-metadata-client.h b/src/lttng-ring-buffer-metadata-client.h index 623120c0..bd6fb200 100644 --- a/src/lttng-ring-buffer-metadata-client.h +++ b/src/lttng-ring-buffer-metadata-client.h @@ -243,11 +243,11 @@ struct channel *_channel_create(const char *name, unsigned int switch_timer_interval, unsigned int read_timer_interval) { - struct lttng_channel *lttng_chan = priv; + struct lttng_kernel_channel_buffer *lttng_chan = priv; struct channel *chan; chan = channel_create(&client_config, name, - lttng_chan->session->priv->metadata_cache, buf_addr, + lttng_chan->parent.session->priv->metadata_cache, buf_addr, subbuf_size, num_subbuf, switch_timer_interval, read_timer_interval); if (chan) { diff --git a/src/lttng-syscalls.c b/src/lttng-syscalls.c index 6b52b69b..bd836c00 100644 --- a/src/lttng-syscalls.c +++ b/src/lttng-syscalls.c @@ -256,33 +256,33 @@ void syscall_entry_event_call_func(struct hlist_head *action_list, void syscall_entry_event_probe(void *__data, struct pt_regs *regs, long id) { - struct lttng_channel *chan = __data; + struct lttng_kernel_channel_buffer *chan = __data; struct hlist_head *action_list, *unknown_action_list; const struct trace_syscall_entry *table, *entry; size_t table_len; if (unlikely(in_compat_syscall())) { - struct lttng_syscall_filter *filter = chan->sc_filter; + struct lttng_syscall_filter *filter = chan->priv->parent.sc_filter; if (id < 0 || id >= NR_compat_syscalls - || (!READ_ONCE(chan->syscall_all_entry) && !test_bit(id, filter->sc_compat_entry))) { + || (!READ_ONCE(chan->priv->parent.syscall_all_entry) && !test_bit(id, filter->sc_compat_entry))) { /* System call filtered out. */ return; } table = compat_sc_table.table; table_len = compat_sc_table.len; - unknown_action_list = &chan->sc_compat_unknown; + unknown_action_list = &chan->priv->parent.sc_compat_unknown; } else { - struct lttng_syscall_filter *filter = chan->sc_filter; + struct lttng_syscall_filter *filter = chan->priv->parent.sc_filter; if (id < 0 || id >= NR_syscalls - || (!READ_ONCE(chan->syscall_all_entry) && !test_bit(id, filter->sc_entry))) { + || (!READ_ONCE(chan->priv->parent.syscall_all_entry) && !test_bit(id, filter->sc_entry))) { /* System call filtered out. */ return; } table = sc_table.table; table_len = sc_table.len; - unknown_action_list = &chan->sc_unknown; + unknown_action_list = &chan->priv->parent.sc_unknown; } if (unlikely(id < 0 || id >= table_len)) { syscall_entry_event_unknown(unknown_action_list, regs, id); @@ -296,9 +296,9 @@ void syscall_entry_event_probe(void *__data, struct pt_regs *regs, long id) } if (unlikely(in_compat_syscall())) { - action_list = &chan->compat_sc_table[id]; + action_list = &chan->priv->parent.compat_sc_table[id]; } else { - action_list = &chan->sc_table[id]; + action_list = &chan->priv->parent.sc_table[id]; } if (unlikely(hlist_empty(action_list))) return; @@ -492,7 +492,7 @@ void syscall_exit_event_call_func(struct hlist_head *action_list, void syscall_exit_event_probe(void *__data, struct pt_regs *regs, long ret) { - struct lttng_channel *chan = __data; + struct lttng_kernel_channel_buffer *chan = __data; struct hlist_head *action_list, *unknown_action_list; const struct trace_syscall_entry *table, *entry; size_t table_len; @@ -501,27 +501,27 @@ void syscall_exit_event_probe(void *__data, struct pt_regs *regs, long ret) id = syscall_get_nr(current, regs); if (unlikely(in_compat_syscall())) { - struct lttng_syscall_filter *filter = chan->sc_filter; + struct lttng_syscall_filter *filter = chan->priv->parent.sc_filter; if (id < 0 || id >= NR_compat_syscalls - || (!READ_ONCE(chan->syscall_all_exit) && !test_bit(id, filter->sc_compat_exit))) { + || (!READ_ONCE(chan->priv->parent.syscall_all_exit) && !test_bit(id, filter->sc_compat_exit))) { /* System call filtered out. */ return; } table = compat_sc_exit_table.table; table_len = compat_sc_exit_table.len; - unknown_action_list = &chan->compat_sc_exit_unknown; + unknown_action_list = &chan->priv->parent.compat_sc_exit_unknown; } else { - struct lttng_syscall_filter *filter = chan->sc_filter; + struct lttng_syscall_filter *filter = chan->priv->parent.sc_filter; if (id < 0 || id >= NR_syscalls - || (!READ_ONCE(chan->syscall_all_exit) && !test_bit(id, filter->sc_exit))) { + || (!READ_ONCE(chan->priv->parent.syscall_all_exit) && !test_bit(id, filter->sc_exit))) { /* System call filtered out. */ return; } table = sc_exit_table.table; table_len = sc_exit_table.len; - unknown_action_list = &chan->sc_exit_unknown; + unknown_action_list = &chan->priv->parent.sc_exit_unknown; } if (unlikely(id < 0 || id >= table_len)) { syscall_exit_event_unknown(unknown_action_list, regs, id, ret); @@ -535,9 +535,9 @@ void syscall_exit_event_probe(void *__data, struct pt_regs *regs, long ret) } if (unlikely(in_compat_syscall())) { - action_list = &chan->compat_sc_exit_table[id]; + action_list = &chan->priv->parent.compat_sc_exit_table[id]; } else { - action_list = &chan->sc_exit_table[id]; + action_list = &chan->priv->parent.sc_exit_table[id]; } if (unlikely(hlist_empty(action_list))) return; @@ -616,8 +616,8 @@ int lttng_create_syscall_event_if_missing(const struct trace_syscall_entry *tabl struct hlist_head *chan_table, struct lttng_event_enabler *event_enabler, enum sc_type type) { - struct lttng_channel *chan = event_enabler->chan; - struct lttng_kernel_session *session = chan->session; + struct lttng_kernel_channel_buffer *chan = event_enabler->chan; + struct lttng_kernel_session *session = chan->parent.session; unsigned int i; /* Allocate events for each syscall matching enabler, insert into table */ @@ -694,46 +694,46 @@ int lttng_create_syscall_event_if_missing(const struct trace_syscall_entry *tabl */ int lttng_syscalls_register_event(struct lttng_event_enabler *event_enabler) { - struct lttng_channel *chan = event_enabler->chan; + struct lttng_kernel_channel_buffer *chan = event_enabler->chan; struct lttng_kernel_abi_event ev; int ret; wrapper_vmalloc_sync_mappings(); - if (!chan->sc_table) { + if (!chan->priv->parent.sc_table) { /* create syscall table mapping syscall to events */ - chan->sc_table = kzalloc(sizeof(struct lttng_kernel_event_recorder *) + chan->priv->parent.sc_table = kzalloc(sizeof(struct lttng_kernel_event_recorder *) * sc_table.len, GFP_KERNEL); - if (!chan->sc_table) + if (!chan->priv->parent.sc_table) return -ENOMEM; } - if (!chan->sc_exit_table) { + if (!chan->priv->parent.sc_exit_table) { /* create syscall table mapping syscall to events */ - chan->sc_exit_table = kzalloc(sizeof(struct lttng_kernel_event_recorder *) + chan->priv->parent.sc_exit_table = kzalloc(sizeof(struct lttng_kernel_event_recorder *) * sc_exit_table.len, GFP_KERNEL); - if (!chan->sc_exit_table) + if (!chan->priv->parent.sc_exit_table) return -ENOMEM; } #ifdef CONFIG_COMPAT - if (!chan->compat_sc_table) { + if (!chan->priv->parent.compat_sc_table) { /* create syscall table mapping compat syscall to events */ - chan->compat_sc_table = kzalloc(sizeof(struct lttng_kernel_event_recorder *) + chan->priv->parent.compat_sc_table = kzalloc(sizeof(struct lttng_kernel_event_recorder *) * compat_sc_table.len, GFP_KERNEL); - if (!chan->compat_sc_table) + if (!chan->priv->parent.compat_sc_table) return -ENOMEM; } - if (!chan->compat_sc_exit_table) { + if (!chan->priv->parent.compat_sc_exit_table) { /* create syscall table mapping compat syscall to events */ - chan->compat_sc_exit_table = kzalloc(sizeof(struct lttng_kernel_event_recorder *) + chan->priv->parent.compat_sc_exit_table = kzalloc(sizeof(struct lttng_kernel_event_recorder *) * compat_sc_exit_table.len, GFP_KERNEL); - if (!chan->compat_sc_exit_table) + if (!chan->priv->parent.compat_sc_exit_table) return -ENOMEM; } #endif - if (hlist_empty(&chan->sc_unknown)) { + if (hlist_empty(&chan->priv->parent.sc_unknown)) { const struct lttng_kernel_event_desc *desc = &__event_desc___syscall_entry_unknown; struct lttng_kernel_event_recorder *event_recorder; @@ -750,10 +750,10 @@ int lttng_syscalls_register_event(struct lttng_event_enabler *event_enabler) if (IS_ERR(event_recorder)) { return PTR_ERR(event_recorder); } - hlist_add_head(&event_recorder->priv->parent.u.syscall.node, &chan->sc_unknown); + hlist_add_head(&event_recorder->priv->parent.u.syscall.node, &chan->priv->parent.sc_unknown); } - if (hlist_empty(&chan->sc_compat_unknown)) { + if (hlist_empty(&chan->priv->parent.sc_compat_unknown)) { const struct lttng_kernel_event_desc *desc = &__event_desc___compat_syscall_entry_unknown; struct lttng_kernel_event_recorder *event_recorder; @@ -770,10 +770,10 @@ int lttng_syscalls_register_event(struct lttng_event_enabler *event_enabler) if (IS_ERR(event_recorder)) { return PTR_ERR(event_recorder); } - hlist_add_head(&event_recorder->priv->parent.u.syscall.node, &chan->sc_compat_unknown); + hlist_add_head(&event_recorder->priv->parent.u.syscall.node, &chan->priv->parent.sc_compat_unknown); } - if (hlist_empty(&chan->compat_sc_exit_unknown)) { + if (hlist_empty(&chan->priv->parent.compat_sc_exit_unknown)) { const struct lttng_kernel_event_desc *desc = &__event_desc___compat_syscall_exit_unknown; struct lttng_kernel_event_recorder *event_recorder; @@ -790,10 +790,10 @@ int lttng_syscalls_register_event(struct lttng_event_enabler *event_enabler) if (IS_ERR(event_recorder)) { return PTR_ERR(event_recorder); } - hlist_add_head(&event_recorder->priv->parent.u.syscall.node, &chan->compat_sc_exit_unknown); + hlist_add_head(&event_recorder->priv->parent.u.syscall.node, &chan->priv->parent.compat_sc_exit_unknown); } - if (hlist_empty(&chan->sc_exit_unknown)) { + if (hlist_empty(&chan->priv->parent.sc_exit_unknown)) { const struct lttng_kernel_event_desc *desc = &__event_desc___syscall_exit_unknown; struct lttng_kernel_event_recorder *event_recorder; @@ -810,48 +810,48 @@ int lttng_syscalls_register_event(struct lttng_event_enabler *event_enabler) if (IS_ERR(event_recorder)) { return PTR_ERR(event_recorder); } - hlist_add_head(&event_recorder->priv->parent.u.syscall.node, &chan->sc_exit_unknown); + hlist_add_head(&event_recorder->priv->parent.u.syscall.node, &chan->priv->parent.sc_exit_unknown); } ret = lttng_create_syscall_event_if_missing(sc_table.table, sc_table.len, - chan->sc_table, event_enabler, SC_TYPE_ENTRY); + chan->priv->parent.sc_table, event_enabler, SC_TYPE_ENTRY); if (ret) return ret; ret = lttng_create_syscall_event_if_missing(sc_exit_table.table, sc_exit_table.len, - chan->sc_exit_table, event_enabler, SC_TYPE_EXIT); + chan->priv->parent.sc_exit_table, event_enabler, SC_TYPE_EXIT); if (ret) return ret; #ifdef CONFIG_COMPAT ret = lttng_create_syscall_event_if_missing(compat_sc_table.table, compat_sc_table.len, - chan->compat_sc_table, event_enabler, SC_TYPE_COMPAT_ENTRY); + chan->priv->parent.compat_sc_table, event_enabler, SC_TYPE_COMPAT_ENTRY); if (ret) return ret; ret = lttng_create_syscall_event_if_missing(compat_sc_exit_table.table, compat_sc_exit_table.len, - chan->compat_sc_exit_table, event_enabler, SC_TYPE_COMPAT_EXIT); + chan->priv->parent.compat_sc_exit_table, event_enabler, SC_TYPE_COMPAT_EXIT); if (ret) return ret; #endif - if (!chan->sc_filter) { - chan->sc_filter = kzalloc(sizeof(struct lttng_syscall_filter), + if (!chan->priv->parent.sc_filter) { + chan->priv->parent.sc_filter = kzalloc(sizeof(struct lttng_syscall_filter), GFP_KERNEL); - if (!chan->sc_filter) + if (!chan->priv->parent.sc_filter) return -ENOMEM; } - if (!chan->sys_enter_registered) { + if (!chan->priv->parent.sys_enter_registered) { ret = lttng_wrapper_tracepoint_probe_register("sys_enter", (void *) syscall_entry_event_probe, chan); if (ret) return ret; - chan->sys_enter_registered = 1; + chan->priv->parent.sys_enter_registered = 1; } /* * We change the name of sys_exit tracepoint due to namespace * conflict with sys_exit syscall entry. */ - if (!chan->sys_exit_registered) { + if (!chan->priv->parent.sys_exit_registered) { ret = lttng_wrapper_tracepoint_probe_register("sys_exit", (void *) syscall_exit_event_probe, chan); if (ret) { @@ -859,7 +859,7 @@ int lttng_syscalls_register_event(struct lttng_event_enabler *event_enabler) (void *) syscall_entry_event_probe, chan)); return ret; } - chan->sys_exit_registered = 1; + chan->priv->parent.sys_exit_registered = 1; } return ret; } @@ -1238,38 +1238,38 @@ int lttng_syscalls_unregister_event_notifier_group( return 0; } -int lttng_syscalls_unregister_channel(struct lttng_channel *chan) +int lttng_syscalls_unregister_channel(struct lttng_kernel_channel_buffer *chan) { int ret; - if (!chan->sc_table) + if (!chan->priv->parent.sc_table) return 0; - if (chan->sys_enter_registered) { + if (chan->priv->parent.sys_enter_registered) { ret = lttng_wrapper_tracepoint_probe_unregister("sys_enter", (void *) syscall_entry_event_probe, chan); if (ret) return ret; - chan->sys_enter_registered = 0; + chan->priv->parent.sys_enter_registered = 0; } - if (chan->sys_exit_registered) { + if (chan->priv->parent.sys_exit_registered) { ret = lttng_wrapper_tracepoint_probe_unregister("sys_exit", (void *) syscall_exit_event_probe, chan); if (ret) return ret; - chan->sys_exit_registered = 0; + chan->priv->parent.sys_exit_registered = 0; } return 0; } -int lttng_syscalls_destroy_event(struct lttng_channel *chan) +int lttng_syscalls_destroy_event(struct lttng_kernel_channel_buffer *chan) { - kfree(chan->sc_table); - kfree(chan->sc_exit_table); + kfree(chan->priv->parent.sc_table); + kfree(chan->priv->parent.sc_exit_table); #ifdef CONFIG_COMPAT - kfree(chan->compat_sc_table); - kfree(chan->compat_sc_exit_table); + kfree(chan->priv->parent.compat_sc_table); + kfree(chan->priv->parent.compat_sc_exit_table); #endif - kfree(chan->sc_filter); + kfree(chan->priv->parent.sc_filter); return 0; } @@ -1475,12 +1475,12 @@ end: } int lttng_syscall_filter_enable_event( - struct lttng_channel *channel, + struct lttng_kernel_channel_buffer *channel, struct lttng_kernel_event_recorder *event_recorder) { WARN_ON_ONCE(event_recorder->priv->parent.instrumentation != LTTNG_KERNEL_ABI_SYSCALL); - return lttng_syscall_filter_enable(channel->sc_filter, + return lttng_syscall_filter_enable(channel->priv->parent.sc_filter, event_recorder->priv->parent.desc->event_name, event_recorder->priv->parent.u.syscall.abi, event_recorder->priv->parent.u.syscall.entryexit); @@ -1565,10 +1565,10 @@ int lttng_syscall_filter_disable_event_notifier( } int lttng_syscall_filter_disable_event( - struct lttng_channel *channel, + struct lttng_kernel_channel_buffer *channel, struct lttng_kernel_event_recorder *event_recorder) { - return lttng_syscall_filter_disable(channel->sc_filter, + return lttng_syscall_filter_disable(channel->priv->parent.sc_filter, event_recorder->priv->parent.desc->event_name, event_recorder->priv->parent.u.syscall.abi, event_recorder->priv->parent.u.syscall.entryexit); @@ -1688,7 +1688,7 @@ const struct file_operations lttng_syscall_list_fops = { /* * A syscall is enabled if it is traced for either entry or exit. */ -long lttng_channel_syscall_mask(struct lttng_channel *channel, +long lttng_channel_syscall_mask(struct lttng_kernel_channel_buffer *channel, struct lttng_kernel_abi_syscall_mask __user *usyscall_mask) { uint32_t len, sc_tables_len, bitmask_len; @@ -1708,14 +1708,14 @@ long lttng_channel_syscall_mask(struct lttng_channel *channel, tmp_mask = kzalloc(bitmask_len, GFP_KERNEL); if (!tmp_mask) return -ENOMEM; - filter = channel->sc_filter; + filter = channel->priv->parent.sc_filter; for (bit = 0; bit < sc_table.len; bit++) { char state; - if (channel->sc_table) { - if (!(READ_ONCE(channel->syscall_all_entry) - || READ_ONCE(channel->syscall_all_exit)) && filter) + if (channel->priv->parent.sc_table) { + if (!(READ_ONCE(channel->priv->parent.syscall_all_entry) + || READ_ONCE(channel->priv->parent.syscall_all_exit)) && filter) state = test_bit(bit, filter->sc_entry) || test_bit(bit, filter->sc_exit); else @@ -1728,9 +1728,9 @@ long lttng_channel_syscall_mask(struct lttng_channel *channel, for (; bit < sc_tables_len; bit++) { char state; - if (channel->compat_sc_table) { - if (!(READ_ONCE(channel->syscall_all_entry) - || READ_ONCE(channel->syscall_all_exit)) && filter) + if (channel->priv->parent.compat_sc_table) { + if (!(READ_ONCE(channel->priv->parent.syscall_all_entry) + || READ_ONCE(channel->priv->parent.syscall_all_exit)) && filter) state = test_bit(bit - sc_table.len, filter->sc_compat_entry) || test_bit(bit - sc_table.len, diff --git a/src/probes/lttng-kprobes.c b/src/probes/lttng-kprobes.c index 95f48540..a279b19d 100644 --- a/src/probes/lttng-kprobes.c +++ b/src/probes/lttng-kprobes.c @@ -37,11 +37,11 @@ int lttng_kprobes_event_handler_pre(struct kprobe *p, struct pt_regs *regs) container_of(event_priv, struct lttng_kernel_event_recorder_private, parent); struct lttng_kernel_event_recorder *event_recorder = event_recorder_priv->pub; - struct lttng_channel *chan = event_recorder->chan; + struct lttng_kernel_channel_buffer *chan = event_recorder->chan; - if (unlikely(!LTTNG_READ_ONCE(chan->session->active))) + if (unlikely(!LTTNG_READ_ONCE(chan->parent.session->active))) return 0; - if (unlikely(!LTTNG_READ_ONCE(chan->enabled))) + if (unlikely(!LTTNG_READ_ONCE(chan->parent.enabled))) return 0; break; } @@ -59,7 +59,7 @@ int lttng_kprobes_event_handler_pre(struct kprobe *p, struct pt_regs *regs) { struct lttng_kernel_event_recorder *event_recorder = container_of(event, struct lttng_kernel_event_recorder, parent); - struct lttng_channel *chan = event_recorder->chan; + struct lttng_kernel_channel_buffer *chan = event_recorder->chan; struct lttng_kernel_ring_buffer_ctx ctx; int ret; diff --git a/src/probes/lttng-kretprobes.c b/src/probes/lttng-kretprobes.c index 7d0db416..e939a0ae 100644 --- a/src/probes/lttng-kretprobes.c +++ b/src/probes/lttng-kretprobes.c @@ -53,11 +53,11 @@ int _lttng_kretprobes_handler(struct kretprobe_instance *krpi, { struct lttng_kernel_event_recorder *event_recorder = container_of(event, struct lttng_kernel_event_recorder, parent); - struct lttng_channel *chan = event_recorder->chan; + struct lttng_kernel_channel_buffer *chan = event_recorder->chan; - if (unlikely(!LTTNG_READ_ONCE(chan->session->active))) + if (unlikely(!LTTNG_READ_ONCE(chan->parent.session->active))) return 0; - if (unlikely(!LTTNG_READ_ONCE(chan->enabled))) + if (unlikely(!LTTNG_READ_ONCE(chan->parent.enabled))) return 0; break; } @@ -74,7 +74,7 @@ int _lttng_kretprobes_handler(struct kretprobe_instance *krpi, { struct lttng_kernel_event_recorder *event_recorder = container_of(event, struct lttng_kernel_event_recorder, parent); - struct lttng_channel *chan = event_recorder->chan; + struct lttng_kernel_channel_buffer *chan = event_recorder->chan; struct lttng_kernel_ring_buffer_ctx ctx; int ret; diff --git a/src/probes/lttng-uprobes.c b/src/probes/lttng-uprobes.c index b88aee13..efb879be 100644 --- a/src/probes/lttng-uprobes.c +++ b/src/probes/lttng-uprobes.c @@ -42,11 +42,11 @@ int lttng_uprobes_event_handler_pre(struct uprobe_consumer *uc, struct pt_regs * { struct lttng_kernel_event_recorder *event_recorder = container_of(event, struct lttng_kernel_event_recorder, parent); - struct lttng_channel *chan = event_recorder->chan; + struct lttng_kernel_channel_buffer *chan = event_recorder->chan; - if (unlikely(!LTTNG_READ_ONCE(chan->session->active))) + if (unlikely(!LTTNG_READ_ONCE(chan->parent.session->active))) return 0; - if (unlikely(!LTTNG_READ_ONCE(chan->enabled))) + if (unlikely(!LTTNG_READ_ONCE(chan->parent.enabled))) return 0; break; } @@ -64,7 +64,7 @@ int lttng_uprobes_event_handler_pre(struct uprobe_consumer *uc, struct pt_regs * { struct lttng_kernel_event_recorder *event_recorder = container_of(event, struct lttng_kernel_event_recorder, parent); - struct lttng_channel *chan = event_recorder->chan; + struct lttng_kernel_channel_buffer *chan = event_recorder->chan; struct lttng_kernel_ring_buffer_ctx ctx; int ret;