All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
To: Yannick Lamarre <ylamarre@efficios.com>
Cc: lttng-dev <lttng-dev@lists.lttng.org>,
	Jeremie Galarneau <jgalar@efficios.com>
Subject: Re: [RFC PATCH lttng-tools 07/18] Add serialized versions of lttng_channel structs
Date: Thu, 18 Apr 2019 15:38:41 -0400 (EDT)	[thread overview]
Message-ID: <1152533262.1544.1555616321837.JavaMail.zimbra__27895.7950462186$1555616338$gmane$org@efficios.com> (raw)
In-Reply-To: <20190418161850.1536-8-ylamarre@efficios.com>

----- On Apr 18, 2019, at 12:18 PM, Yannick Lamarre ylamarre@efficios.com wrote:

> Serialized versions of lttng_channel and lttng_channel_extended are
> packed structures to be used in communication protocols for consistent
> sizes across platforms. The serialized versions are stripped of pointers
> and padding.
> 
> Pointers are removed since their size can vary on platforms supporting
> variable sized registers (x86-64).

I don't understand this explanation. I think it's mostly that we have
situations where x86-32 processes interact with x86-64 processes, and
since this is within a communication protocol between processes over
unix socket, it breaks because of pointer size mismatch.

> Padding is also removed since it defeats the purpose of a packed struct.

Not necessarily. Padding was how we extend each command as the protocol evolves.
If we remove padding, how do we plan to extend those in the future ? This commit
documentat how we plan to extend those from now on.

Thanks,

Mathieu


> 
> Signed-off-by: Yannick Lamarre <ylamarre@efficios.com>
> ---
> include/lttng/channel-internal.h | 30 ++++++++++++++++++++++++++++++
> 1 file changed, 30 insertions(+)
> 
> diff --git a/include/lttng/channel-internal.h b/include/lttng/channel-internal.h
> index 030b4701..c956c19d 100644
> --- a/include/lttng/channel-internal.h
> +++ b/include/lttng/channel-internal.h
> @@ -20,11 +20,41 @@
> 
> #include <common/macros.h>
> 
> +struct lttng_channel_attr_serialized {
> +	int overwrite;                      /* -1: session default, 1: overwrite, 0:
> discard */
> +	uint64_t subbuf_size;               /* bytes, power of 2 */
> +	uint64_t num_subbuf;                /* power of 2 */
> +	unsigned int switch_timer_interval; /* usec */
> +	unsigned int read_timer_interval;   /* usec */
> +	uint32_t output; /* enum lttng_event_output */
> +	/* LTTng 2.1 padding limit */
> +	uint64_t tracefile_size;            /* bytes */
> +	uint64_t tracefile_count;           /* number of tracefiles */
> +	/* LTTng 2.3 padding limit */
> +	unsigned int live_timer_interval;   /* usec */
> +	/* LTTng 2.7 padding limit */
> +
> +} LTTNG_PACKED;
> +
> +struct lttng_channel_serialized {
> +	char name[LTTNG_SYMBOL_NAME_LEN];
> +	uint32_t enabled;
> +	struct lttng_channel_attr_serialized attr;
> +
> +} LTTNG_PACKED;
> +
> struct lttng_channel_extended {
> 	uint64_t discarded_events;
> 	uint64_t lost_packets;
> 	uint64_t monitor_timer_interval;
> 	int64_t blocking_timeout;
> +};
> +
> +struct lttng_channel_extended_serialized {
> +	uint64_t discarded_events;
> +	uint64_t lost_packets;
> +	uint64_t monitor_timer_interval;
> +	int64_t blocking_timeout;
> } LTTNG_PACKED;
> 
> #endif /* LTTNG_CHANNEL_INTERNAL_H */
> --
> 2.11.0
> 
> _______________________________________________
> lttng-dev mailing list
> lttng-dev@lists.lttng.org
> https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

-- 
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com

  parent reply	other threads:[~2019-04-18 19:38 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20190418161850.1536-1-ylamarre@efficios.com>
2019-04-18 16:18 ` [RFC PATCH lttng-tools 01/18] Fix: Use platform-independant types in sessiond to consumerd communication Yannick Lamarre
2019-04-18 16:18 ` [RFC PATCH lttng-tools 02/18] Clean-up: Switch enum fields in lttcomm_consumer_msg Yannick Lamarre
2019-04-18 16:18 ` [RFC PATCH lttng-tools 03/18] Clean-up: Switch enum fields in lttcomm_consumer_status_msg Yannick Lamarre
2019-04-18 16:18 ` [RFC PATCH lttng-tools 04/18] Clean-up: Switch enum fields in lttcomm_consumer_status_channel Yannick Lamarre
2019-04-18 16:18 ` [RFC PATCH lttng-tools 05/18] Clean-up: Remove unused structure Yannick Lamarre
2019-04-18 16:18 ` [RFC PATCH lttng-tools 06/18] Clean-up: Removed deprecated field Yannick Lamarre
2019-04-18 16:18 ` [RFC PATCH lttng-tools 07/18] Add serialized versions of lttng_channel structs Yannick Lamarre
2019-04-18 16:18 ` [RFC PATCH lttng-tools 08/18] Add serdes functions for lttng_channel Yannick Lamarre
2019-04-18 16:18 ` [RFC PATCH lttng-tools 09/18] Integrate serialized communication in lttng-ctl and sessiond Yannick Lamarre
2019-04-18 16:18 ` [RFC PATCH lttng-tools 10/18] Add serialized versions of lttng_event_context structs Yannick Lamarre
2019-04-18 16:18 ` [RFC PATCH lttng-tools 11/18] Add serdes functions for lttng_event_context Yannick Lamarre
2019-04-18 16:18 ` [RFC PATCH lttng-tools 12/18] Integrate serialized communication in lttng-ctl and sessiond Yannick Lamarre
2019-04-18 16:18 ` [RFC PATCH lttng-tools 13/18] Add serialized versions of lttng_event structs Yannick Lamarre
2019-04-18 16:18 ` [RFC PATCH lttng-tools 14/18] Add serdes functions for lttng_event_context Yannick Lamarre
2019-04-18 16:18 ` [RFC PATCH lttng-tools 15/18] Integrate serialized communication in lttng-ctl and sessiond Yannick Lamarre
2019-04-18 16:18 ` [RFC PATCH lttng-tools 16/18] Add serialized versions of lttng_event structs Yannick Lamarre
2019-04-18 16:18 ` [RFC PATCH lttng-tools 17/18] Add serdes functions for lttng_snapshot_output Yannick Lamarre
2019-04-18 16:18 ` [RFC PATCH lttng-tools 18/18] Integrate serialized communication in lttng-ctl and sessiond Yannick Lamarre
     [not found] ` <20190418161850.1536-9-ylamarre@efficios.com>
2019-04-18 19:32   ` [RFC PATCH lttng-tools 08/18] Add serdes functions for lttng_channel Mathieu Desnoyers
     [not found] ` <20190418161850.1536-8-ylamarre@efficios.com>
2019-04-18 19:38   ` Mathieu Desnoyers [this message]
     [not found] ` <20190418161850.1536-11-ylamarre@efficios.com>
2019-04-18 19:41   ` [RFC PATCH lttng-tools 10/18] Add serialized versions of lttng_event_context structs Mathieu Desnoyers
     [not found] ` <20190418161850.1536-12-ylamarre@efficios.com>
2019-04-18 19:42   ` [RFC PATCH lttng-tools 11/18] Add serdes functions for lttng_event_context Mathieu Desnoyers
     [not found] ` <20190418161850.1536-13-ylamarre@efficios.com>
2019-04-18 19:44   ` [RFC PATCH lttng-tools 12/18] Integrate serialized communication in lttng-ctl and sessiond Mathieu Desnoyers
     [not found] ` <20190418161850.1536-14-ylamarre@efficios.com>
2019-04-18 19:45   ` [RFC PATCH lttng-tools 13/18] Add serialized versions of lttng_event structs Mathieu Desnoyers
     [not found] ` <20190418161850.1536-15-ylamarre@efficios.com>
2019-04-18 19:46   ` [RFC PATCH lttng-tools 14/18] Add serdes functions for lttng_event_context Mathieu Desnoyers
     [not found] ` <20190418161850.1536-16-ylamarre@efficios.com>
2019-04-18 19:49   ` [RFC PATCH lttng-tools 15/18] Integrate serialized communication in lttng-ctl and sessiond Mathieu Desnoyers
     [not found] ` <20190418161850.1536-17-ylamarre@efficios.com>
2019-04-18 19:50   ` [RFC PATCH lttng-tools 16/18] Add serialized versions of lttng_event structs Mathieu Desnoyers
     [not found] ` <20190418161850.1536-18-ylamarre@efficios.com>
2019-04-18 19:52   ` [RFC PATCH lttng-tools 17/18] Add serdes functions for lttng_snapshot_output Mathieu Desnoyers
     [not found] ` <20190418161850.1536-19-ylamarre@efficios.com>
2019-04-18 19:58   ` [RFC PATCH lttng-tools 18/18] Integrate serialized communication in lttng-ctl and sessiond Mathieu Desnoyers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='1152533262.1544.1555616321837.JavaMail.zimbra__27895.7950462186$1555616338$gmane$org@efficios.com' \
    --to=mathieu.desnoyers@efficios.com \
    --cc=jgalar@efficios.com \
    --cc=lttng-dev@lists.lttng.org \
    --cc=ylamarre@efficios.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.