The list of contexts active for an event can be moved to a private
structure by keeping the temporary pointer to the RCU dereferenced
context in the ring buffer client's internal context rather than within
the context shared between the probe and the ring buffer client.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I3040edf42ea59786a4ee1b5b3f9a90e1834821ab
unsigned int id;
struct lttng_ust_channel_buffer *chan;
unsigned int id;
struct lttng_ust_channel_buffer *chan;
- struct lttng_ust_ctx *ctx;
/* End of base ABI. Fields below should be used after checking struct_size. */
};
/* End of base ABI. Fields below should be used after checking struct_size. */
};
uint32_t struct_size; /* Size of this structure */
struct lttng_ust_event_recorder *event_recorder;
uint32_t struct_size; /* Size of this structure */
struct lttng_ust_event_recorder *event_recorder;
- struct lttng_ust_ctx *event_ctx; /* RCU dereferenced. */
/* End of base ABI. Fields below should be used after checking struct_size. */
};
/* End of base ABI. Fields below should be used after checking struct_size. */
};
memset(&__lttng_ctx, 0, sizeof(__lttng_ctx)); \
__lttng_ctx.struct_size = sizeof(struct lttng_ust_stack_ctx); \
__lttng_ctx.event_recorder = __event_recorder; \
memset(&__lttng_ctx, 0, sizeof(__lttng_ctx)); \
__lttng_ctx.struct_size = sizeof(struct lttng_ust_stack_ctx); \
__lttng_ctx.event_recorder = __event_recorder; \
- __lttng_ctx.event_ctx = tp_rcu_dereference(__event_recorder->ctx); \
lib_ring_buffer_ctx_init(&__ctx, __chan->chan, &__lttng_ctx, __event_len, \
__event_align, -1, __chan->handle); \
__ctx.ip = _TP_IP_PARAM(TP_IP_PARAM); \
lib_ring_buffer_ctx_init(&__ctx, __chan->chan, &__lttng_ctx, __event_len, \
__event_align, -1, __chan->handle); \
__ctx.ip = _TP_IP_PARAM(TP_IP_PARAM); \
/* Remove from event hash table. */
cds_hlist_del(&event_recorder->priv->hlist);
/* Remove from event hash table. */
cds_hlist_del(&event_recorder->priv->hlist);
- lttng_destroy_context(event_recorder->ctx);
+ lttng_destroy_context(event_recorder->priv->ctx);
free(event_recorder->parent);
free(event_recorder->priv);
free(event_recorder);
free(event_recorder->parent);
free(event_recorder->priv);
free(event_recorder);
abort();
}
cds_list_for_each_entry(event_recorder_priv, &session_priv->events_head, node) {
abort();
}
cds_list_for_each_entry(event_recorder_priv, &session_priv->events_head, node) {
- ret = lttng_ust_context_set_provider_rcu(&event_recorder_priv->pub->ctx,
+ ret = lttng_ust_context_set_provider_rcu(&event_recorder_priv->ctx,
name, get_size, record, get_value);
if (ret)
abort();
name, get_size, record, get_value);
if (ret)
abort();
size_t packet_context_len;
size_t event_context_len;
struct lttng_ust_ctx *chan_ctx;
size_t packet_context_len;
size_t event_context_len;
struct lttng_ust_ctx *chan_ctx;
+ struct lttng_ust_ctx *event_ctx;
};
static inline uint64_t lib_ring_buffer_clock_read(struct lttng_ust_lib_ring_buffer_channel *chan)
};
static inline uint64_t lib_ring_buffer_clock_read(struct lttng_ust_lib_ring_buffer_channel *chan)
struct lttng_client_ctx *client_ctx)
{
struct lttng_ust_channel_buffer *lttng_chan = channel_get_private(chan);
struct lttng_client_ctx *client_ctx)
{
struct lttng_ust_channel_buffer *lttng_chan = channel_get_private(chan);
- struct lttng_ust_stack_ctx *lttng_ctx = ctx->priv;
size_t orig_offset = offset;
size_t padding;
size_t orig_offset = offset;
size_t padding;
}
offset += ctx_get_aligned_size(offset, client_ctx->chan_ctx,
client_ctx->packet_context_len);
}
offset += ctx_get_aligned_size(offset, client_ctx->chan_ctx,
client_ctx->packet_context_len);
- offset += ctx_get_aligned_size(offset, lttng_ctx->event_ctx,
+ offset += ctx_get_aligned_size(offset, client_ctx->event_ctx,
client_ctx->event_context_len);
*pre_header_padding = padding;
return offset - orig_offset;
client_ctx->event_context_len);
*pre_header_padding = padding;
return offset - orig_offset;
uint32_t event_id)
{
struct lttng_ust_channel_buffer *lttng_chan = channel_get_private(ctx->chan);
uint32_t event_id)
{
struct lttng_ust_channel_buffer *lttng_chan = channel_get_private(ctx->chan);
- struct lttng_ust_stack_ctx *lttng_ctx = ctx->priv;
if (caa_unlikely(ctx->rflags))
goto slow_path;
if (caa_unlikely(ctx->rflags))
goto slow_path;
}
ctx_record(ctx, lttng_chan, client_ctx->chan_ctx, APP_CTX_ENABLED);
}
ctx_record(ctx, lttng_chan, client_ctx->chan_ctx, APP_CTX_ENABLED);
- ctx_record(ctx, lttng_chan, lttng_ctx->event_ctx, APP_CTX_ENABLED);
+ ctx_record(ctx, lttng_chan, client_ctx->event_ctx, APP_CTX_ENABLED);
lib_ring_buffer_align_ctx(ctx, ctx->largest_align);
return;
lib_ring_buffer_align_ctx(ctx, ctx->largest_align);
return;
uint32_t event_id)
{
struct lttng_ust_channel_buffer *lttng_chan = channel_get_private(ctx->chan);
uint32_t event_id)
{
struct lttng_ust_channel_buffer *lttng_chan = channel_get_private(ctx->chan);
- struct lttng_ust_stack_ctx *lttng_ctx = ctx->priv;
switch (lttng_chan->priv->header_type) {
case 1: /* compact */
switch (lttng_chan->priv->header_type) {
case 1: /* compact */
WARN_ON_ONCE(1);
}
ctx_record(ctx, lttng_chan, client_ctx->chan_ctx, APP_CTX_ENABLED);
WARN_ON_ONCE(1);
}
ctx_record(ctx, lttng_chan, client_ctx->chan_ctx, APP_CTX_ENABLED);
- ctx_record(ctx, lttng_chan, lttng_ctx->event_ctx, APP_CTX_ENABLED);
+ ctx_record(ctx, lttng_chan, client_ctx->event_ctx, APP_CTX_ENABLED);
lib_ring_buffer_align_ctx(ctx, ctx->largest_align);
}
lib_ring_buffer_align_ctx(ctx, ctx->largest_align);
}
{
struct lttng_ust_channel_buffer *lttng_chan = channel_get_private(ctx->chan);
struct lttng_ust_stack_ctx *lttng_ctx = ctx->priv;
{
struct lttng_ust_channel_buffer *lttng_chan = channel_get_private(ctx->chan);
struct lttng_ust_stack_ctx *lttng_ctx = ctx->priv;
+ struct lttng_ust_event_recorder *event_recorder = lttng_ctx->event_recorder;
struct lttng_client_ctx client_ctx;
int ret, cpu;
client_ctx.chan_ctx = lttng_ust_rcu_dereference(lttng_chan->priv->ctx);
struct lttng_client_ctx client_ctx;
int ret, cpu;
client_ctx.chan_ctx = lttng_ust_rcu_dereference(lttng_chan->priv->ctx);
+ client_ctx.event_ctx = lttng_ust_rcu_dereference(event_recorder->priv->ctx);
/* Compute internal size of context structures. */
ctx_get_struct_size(client_ctx.chan_ctx, &client_ctx.packet_context_len,
APP_CTX_ENABLED);
/* Compute internal size of context structures. */
ctx_get_struct_size(client_ctx.chan_ctx, &client_ctx.packet_context_len,
APP_CTX_ENABLED);
- ctx_get_struct_size(lttng_ctx->event_ctx, &client_ctx.event_context_len,
+ ctx_get_struct_size(client_ctx.event_ctx, &client_ctx.event_context_len,
APP_CTX_ENABLED);
cpu = lib_ring_buffer_get_cpu(&client_config);
APP_CTX_ENABLED);
cpu = lib_ring_buffer_get_cpu(&client_config);
struct lttng_ust_event_recorder *pub; /* Public event interface */
struct cds_list_head node; /* Event recorder list */
struct cds_hlist_node hlist; /* Hash table of event recorders */
struct lttng_ust_event_recorder *pub; /* Public event interface */
struct cds_list_head node; /* Event recorder list */
struct cds_hlist_node hlist; /* Hash table of event recorders */
+ struct lttng_ust_ctx *ctx;
};
struct lttng_ust_event_notifier_private {
};
struct lttng_ust_event_notifier_private {