From 11166b99b32b121069effefff94e62d74f53a5c2 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Thu, 27 Jan 2022 15:36:45 -0500 Subject: [PATCH] Remove event context dead code The event context is never wired up by the lttng ust abi, so it is never actually used. Remove this dead code which adds complexity for no reason. This code is all internal to lttng-ust (not exposed to probe providers), which makes it easy to add this back if needed in the future. Signed-off-by: Mathieu Desnoyers Change-Id: I52e93835ffe6d3040ead7fb8d3113ab20a555019 --- src/common/events.h | 2 -- src/common/ringbuffer-clients/template.h | 7 ------- src/lib/lttng-ust/lttng-events.c | 24 ------------------------ 3 files changed, 33 deletions(-) diff --git a/src/common/events.h b/src/common/events.h index c8d37046..a7ede200 100644 --- a/src/common/events.h +++ b/src/common/events.h @@ -307,8 +307,6 @@ struct lttng_ust_event_common_private { struct lttng_ust_event_session_common_private { struct lttng_ust_event_common_private parent; - struct lttng_ust_ctx *ctx; - struct lttng_ust_channel_common *chan; uint64_t id; /* Event id */ diff --git a/src/common/ringbuffer-clients/template.h b/src/common/ringbuffer-clients/template.h index 96c55d8b..2ebcbf6d 100644 --- a/src/common/ringbuffer-clients/template.h +++ b/src/common/ringbuffer-clients/template.h @@ -60,7 +60,6 @@ struct lttng_client_ctx { size_t packet_context_len; size_t event_context_len; struct lttng_ust_ctx *chan_ctx; - struct lttng_ust_ctx *event_ctx; }; /* @@ -189,8 +188,6 @@ size_t record_header_size( } offset += ctx_get_aligned_size(offset, client_ctx->chan_ctx, client_ctx->packet_context_len); - offset += ctx_get_aligned_size(offset, client_ctx->event_ctx, - client_ctx->event_context_len); *pre_header_padding = padding; return offset - orig_offset; } @@ -255,7 +252,6 @@ void lttng_write_event_header(const struct lttng_ust_ring_buffer_config *config, } ctx_record(ctx, lttng_chan, client_ctx->chan_ctx); - ctx_record(ctx, lttng_chan, client_ctx->event_ctx); lttng_ust_ring_buffer_align_ctx(ctx, ctx->largest_align); return; @@ -329,7 +325,6 @@ void lttng_write_event_header_slow(const struct lttng_ust_ring_buffer_config *co WARN_ON_ONCE(1); } ctx_record(ctx, lttng_chan, client_ctx->chan_ctx); - ctx_record(ctx, lttng_chan, client_ctx->event_ctx); lttng_ust_ring_buffer_align_ctx(ctx, ctx->largest_align); } @@ -689,10 +684,8 @@ int lttng_event_reserve(struct lttng_ust_ring_buffer_ctx *ctx) event_id = (uint32_t) event_recorder->priv->parent.id; client_ctx.chan_ctx = lttng_ust_rcu_dereference(lttng_chan->priv->ctx); - client_ctx.event_ctx = lttng_ust_rcu_dereference(event_recorder->priv->parent.ctx); /* Compute internal size of context structures. */ ctx_get_struct_size(ctx, client_ctx.chan_ctx, &client_ctx.packet_context_len); - ctx_get_struct_size(ctx, client_ctx.event_ctx, &client_ctx.event_context_len); nesting = lib_ring_buffer_nesting_inc(&client_config); if (nesting < 0) diff --git a/src/lib/lttng-ust/lttng-events.c b/src/lib/lttng-ust/lttng-events.c index dae92cb5..b45e670b 100644 --- a/src/lib/lttng-ust/lttng-events.c +++ b/src/lib/lttng-ust/lttng-events.c @@ -1585,20 +1585,6 @@ void _lttng_event_destroy(struct lttng_ust_event_common *event) /* Remove from event hash table. */ cds_hlist_del(&event->priv->name_hlist_node); - switch (event->type) { - case LTTNG_UST_EVENT_TYPE_RECORDER: - { - struct lttng_ust_event_session_common_private *event_session_priv = - caa_container_of(event->priv, struct lttng_ust_event_session_common_private, parent); - - lttng_destroy_context(event_session_priv->ctx); - break; - } - case LTTNG_UST_EVENT_TYPE_NOTIFIER: - break; - default: - abort(); - } lttng_ust_event_free(event); } @@ -2159,7 +2145,6 @@ void lttng_ust_context_set_session_provider(const char *name, cds_list_for_each_entry(session_priv, &sessions, node) { struct lttng_ust_channel_buffer_private *chan; - struct lttng_ust_event_common_private *event_priv; int ret; ret = lttng_ust_context_set_provider_rcu(&session_priv->ctx, @@ -2172,15 +2157,6 @@ void lttng_ust_context_set_session_provider(const char *name, if (ret) abort(); } - cds_list_for_each_entry(event_priv, &session_priv->events_head, node) { - struct lttng_ust_event_session_common_private *event_session_priv = - caa_container_of(event_priv, struct lttng_ust_event_session_common_private, parent); - - ret = lttng_ust_context_set_provider_rcu(&event_session_priv->ctx, - name, get_size, record, get_value); - if (ret) - abort(); - } } } -- 2.34.1