From: Francis Deslauriers Date: Tue, 30 May 2017 15:53:35 +0000 (-0400) Subject: Assign CPU id before saving the context size X-Git-Tag: v2.11.0-rc1~33 X-Git-Url: http://git.lttng.org/?p=lttng-modules.git;a=commitdiff_plain;h=e755470cf63434d615dbae9abf550bb2cd953c6a Assign CPU id before saving the context size The callstack contexts will use the CPU id to save per-CPU data so this field needs to be set before calling the get_size function of this context. Signed-off-by: Francis Deslauriers Signed-off-by: Mathieu Desnoyers --- diff --git a/lttng-ring-buffer-client.h b/lttng-ring-buffer-client.h index 8b87db0d..7cf3a4c8 100644 --- a/lttng-ring-buffer-client.h +++ b/lttng-ring-buffer-client.h @@ -636,15 +636,15 @@ int lttng_event_reserve(struct lib_ring_buffer_ctx *ctx, struct lttng_client_ctx client_ctx; int ret, 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(event->ctx, &client_ctx.event_context_len, lttng_chan, ctx); - cpu = lib_ring_buffer_get_cpu(&client_config); if (unlikely(cpu < 0)) return -EPERM; ctx->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(event->ctx, &client_ctx.event_context_len, lttng_chan, ctx); + switch (lttng_chan->header_type) { case 1: /* compact */ if (event_id > 30)