[lttng-dev] [PATCH lttng-tools 2/3] Fix: lttng-sessiond: cpu hotplug: send channel to consumer only once
Jérémie Galarneau
jeremie.galarneau at efficios.com
Mon May 22 15:30:20 UTC 2017
Merged in master, stable-2.10, stable-2.9, and stable-2.8.
Thanks!
Jérémie
On 11 May 2017 at 16:00, Mathieu Desnoyers
<mathieu.desnoyers at efficios.com> wrote:
> On CPU hotplug, we currently send a duplicate of the channel key, which
> allocates its own object (duplicated) within the consumerd. We want the
> newly added stream to map to the pre-existing channel key, so don't send
> the channel duplicate.
>
> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
> ---
> src/bin/lttng-sessiond/kernel-consumer.c | 11 +++++++----
> src/bin/lttng-sessiond/trace-kernel.h | 1 +
> 2 files changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/src/bin/lttng-sessiond/kernel-consumer.c b/src/bin/lttng-sessiond/kernel-consumer.c
> index a65e149..067652b 100644
> --- a/src/bin/lttng-sessiond/kernel-consumer.c
> +++ b/src/bin/lttng-sessiond/kernel-consumer.c
> @@ -338,7 +338,7 @@ int kernel_consumer_send_channel_stream(struct consumer_socket *sock,
> struct ltt_kernel_channel *channel, struct ltt_kernel_session *session,
> unsigned int monitor)
> {
> - int ret;
> + int ret = LTTNG_OK;
> struct ltt_kernel_stream *stream;
>
> /* Safety net */
> @@ -356,9 +356,12 @@ int kernel_consumer_send_channel_stream(struct consumer_socket *sock,
> DBG("Sending streams of channel %s to kernel consumer",
> channel->channel->name);
>
> - ret = kernel_consumer_add_channel(sock, channel, session, monitor);
> - if (ret < 0) {
> - goto error;
> + if (!channel->sent_to_consumer) {
> + ret = kernel_consumer_add_channel(sock, channel, session, monitor);
> + if (ret < 0) {
> + goto error;
> + }
> + channel->sent_to_consumer = true;
> }
>
> /* Send streams */
> diff --git a/src/bin/lttng-sessiond/trace-kernel.h b/src/bin/lttng-sessiond/trace-kernel.h
> index 2092469..93870cb 100644
> --- a/src/bin/lttng-sessiond/trace-kernel.h
> +++ b/src/bin/lttng-sessiond/trace-kernel.h
> @@ -71,6 +71,7 @@ struct ltt_kernel_channel {
> struct cds_list_head list;
> /* Session pointer which has a reference to this object. */
> struct ltt_kernel_session *session;
> + bool sent_to_consumer;
> };
>
> /* Metadata */
> --
> 2.1.4
>
--
Jérémie Galarneau
EfficiOS Inc.
http://www.efficios.com
More information about the lttng-dev
mailing list