lttng-dev.lists.lttng.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH lttng-ust v2] Fix: allocate ts_end in ringbuffer shared memory
       [not found] <20190510152632.8730-1-gabriel.pollo-guilbert@efficios.com>
@ 2019-05-10 16:33 ` Sebastien Boisvert
  2019-05-10 17:41 ` Mathieu Desnoyers
       [not found] ` <c9f0e5ee-14ed-a2e7-1113-49a77bc7312a@gydle.com>
  2 siblings, 0 replies; 10+ messages in thread
From: Sebastien Boisvert @ 2019-05-10 16:33 UTC (permalink / raw)
  To: Gabriel-Andrew Pollo-Guilbert, lttng-dev

On 2019-05-10 11:26 a.m., Gabriel-Andrew Pollo-Guilbert wrote:

Hello Gabriel-Andrew,

> This patch allocates the memory used by the ts_end field added by commit
> 6c737d05. When allocating lots of subbuffer for a channel (512 or more),
> zalloc_shm() will fail to allocate all the objects because the allocated memory
> map didn't take account the newly added field.
> 
> lttng-tools version: b14f53d4 (2.12.0-pre)
> 
> Steps to reproduce the bug:
> 
> 	1. lttng-sessiond -vvv --verbose-consumer

I need to killall existing lttng-sessiond daemon, right ?

> 	2. start a traced application

I used lttng-ust/doc/examples/demo/.

> 	3. lttng create "test-sesssion"
                                ^^^
There are too many s in session.


> 	4. lttng enable-channel --userspace --num-subbuf 512 --subbuf-size 8k --overwrite channel
> 	5. lttng enable-event -u -a -c channel
> 	6. lttng start
> 
> After these steps, the following error message show should be thrown:
> 
> 	Error: ask_channel_creation consumer command failed
> 	Error: Error creating UST channel "channel" on the consumer daemon

When I build lttng-tools b14f53d4

I get this error:

make[3]: Entering directory '/home/sboisvert/open-source/lttng.org/Source/lttng-tools/src/common/ust-consumer'
  CC       ust-consumer.lo
ust-consumer.c: In function 'lttng_ustconsumer_recv_cmd':
ust-consumer.c:1459:7: error: 'struct ustctl_consumer_channel_attr' has no member named 'blocking_timeout'
   attr.blocking_timeout= msg.u.ask_channel.blocking_timeout;
       ^
ust-consumer.c: In function 'lttng_ustconsumer_sample_snapshot_positions':
ust-consumer.c:2225:9: warning: implicit declaration of function 'ustctl_snapshot_sample_positions'; did you mean 'ustctl_snapshot_get_produced'? [-Wimplicit-function-declaration]
  return ustctl_snapshot_sample_positions(stream->ustream);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         ustctl_snapshot_get_produced
Makefile:548: recipe for target 'ust-consumer.lo' failed


There seems to be 2 declarations of struct ustctl_consumer_channel_attr.

In file lttng-tools/src/bin/lttng-sessiond/lttng-ust-ctl.h,
struct ustctl_consumer_channel_attr has the attribute blocking_timeout.

In file lttng-ust/include/lttng/ust-ctl.h, struct ustctl_consumer_channel_attr
does not have the attribute.


They are exactly the same, except the missing blocking_timeout attribute.


[sboisvert@GT480:Source]$ grep -A 10 "struct ustctl_consumer_channel_attr {" lttng-ust/include/lttng/ust-ctl.h
struct ustctl_consumer_channel_attr {
	enum lttng_ust_chan_type type;
	uint64_t subbuf_size;			/* bytes */
	uint64_t num_subbuf;			/* power of 2 */
	int overwrite;				/* 1: overwrite, 0: discard */
	unsigned int switch_timer_interval;	/* usec */
	unsigned int read_timer_interval;	/* usec */
	enum lttng_ust_output output;		/* splice, mmap */
	uint32_t chan_id;			/* channel ID */
	unsigned char uuid[LTTNG_UST_UUID_LEN]; /* Trace session unique ID */
} LTTNG_PACKED;

[sboisvert@GT480:Source]$ grep -A 11 "struct ustctl_consumer_channel_attr {" lttng-tools/src/bin/lttng-sessiond/lttng-ust-ctl.h
struct ustctl_consumer_channel_attr {
	enum lttng_ust_chan_type type;
	uint64_t subbuf_size;			/* bytes */
	uint64_t num_subbuf;			/* power of 2 */
	int overwrite;				/* 1: overwrite, 0: discard */
	unsigned int switch_timer_interval;	/* usec */
	unsigned int read_timer_interval;	/* usec */
	enum lttng_ust_output output;		/* splice, mmap */
	uint32_t chan_id;			/* channel ID */
	unsigned char uuid[LTTNG_UST_UUID_LEN]; /* Trace session unique ID */
	int64_t blocking_timeout;			/* Blocking timeout (usec) */
} LTTNG_PACKED;

[sboisvert@GT480:Source]$ diff -u <(grep -A 11 "struct ustctl_consumer_channel_attr {" lttng-tools/src/bin/lttng-sessiond/lttng-ust-ctl.h) <(grep -A 10 "struct ustctl_consumer_channel_attr {" lttng-ust/include/lttng/ust-ctl.h)
--- /dev/fd/63	2019-05-10 12:32:23.562246820 -0400
+++ /dev/fd/62	2019-05-10 12:32:23.562246820 -0400
@@ -8,5 +8,4 @@
 	enum lttng_ust_output output;		/* splice, mmap */
 	uint32_t chan_id;			/* channel ID */
 	unsigned char uuid[LTTNG_UST_UUID_LEN]; /* Trace session unique ID */
-	int64_t blocking_timeout;			/* Blocking timeout (usec) */
 } LTTNG_PACKED;

 
My configure commands (followed by "make install"):

[sboisvert@GT480:userspace-rcu]$ ./configure --prefix=/home/sboisvert/open-source/lttng.org/Build/userspace-rcu/v0.11.0

[sboisvert@GT480:lttng-ust]$ ./configure --prefix=/home/sboisvert/open-source/lttng.org/Build/lttng-ust/v2.9.4 LDFLAGS=-L/home/sboisvert/open-source/lttng.org/Build/userspace-rcu/v0.11.0/lib

[sboisvert@GT480:lttng-tools]$ ./configure --prefix=/home/sboisvert/open-source/lttng.org/Build/lttng-tools/b14f53d4 LDFLAGS=-L/home/sboisvert/open-source/lttng.org/Build/lttng-ust/v2.9.4/lib CPPFLAGS=-I/home/sboisvert/open-source/lttng.org/Build/lttng-ust/v2.9.4/include


Thanks     

> 
> Signed-off-by: Gabriel-Andrew Pollo-Guilbert <gabriel.pollo-guilbert@efficios.com>
> ---
>  libringbuffer/ring_buffer_backend.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/libringbuffer/ring_buffer_backend.c b/libringbuffer/ring_buffer_backend.c
> index a0ef7446..431b8eae 100644
> --- a/libringbuffer/ring_buffer_backend.c
> +++ b/libringbuffer/ring_buffer_backend.c
> @@ -341,6 +341,9 @@ int channel_backend_init(struct channel_backend *chanb,
>  	shmsize += sizeof(struct commit_counters_hot) * num_subbuf;
>  	shmsize += offset_align(shmsize, __alignof__(struct commit_counters_cold));
>  	shmsize += sizeof(struct commit_counters_cold) * num_subbuf;
> +	/* Sampled timestamp end */
> +	shmsize += offset_align(shmsize, __alignof__(uint64_t));
> +	shmsize += sizeof(uint64_t) * num_subbuf;
>  
>  	if (config->alloc == RING_BUFFER_ALLOC_PER_CPU) {
>  		struct lttng_ust_lib_ring_buffer *buf;
> 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH lttng-ust v2] Fix: allocate ts_end in ringbuffer shared memory
       [not found] <20190510152632.8730-1-gabriel.pollo-guilbert@efficios.com>
  2019-05-10 16:33 ` [PATCH lttng-ust v2] Fix: allocate ts_end in ringbuffer shared memory Sebastien Boisvert
@ 2019-05-10 17:41 ` Mathieu Desnoyers
       [not found] ` <c9f0e5ee-14ed-a2e7-1113-49a77bc7312a@gydle.com>
  2 siblings, 0 replies; 10+ messages in thread
From: Mathieu Desnoyers @ 2019-05-10 17:41 UTC (permalink / raw)
  To: Gabriel-Andrew Pollo-Guilbert; +Cc: lttng-dev

Merged into master, 2.11, thanks!

Mathieu

----- On May 10, 2019, at 11:26 AM, Gabriel-Andrew Pollo-Guilbert gabriel.pollo-guilbert@efficios.com wrote:

> This patch allocates the memory used by the ts_end field added by commit
> 6c737d05. When allocating lots of subbuffer for a channel (512 or more),
> zalloc_shm() will fail to allocate all the objects because the allocated memory
> map didn't take account the newly added field.
> 
> lttng-tools version: b14f53d4 (2.12.0-pre)
> 
> Steps to reproduce the bug:
> 
>	1. lttng-sessiond -vvv --verbose-consumer
>	2. start a traced application
>	3. lttng create "test-sesssion"
>	4. lttng enable-channel --userspace --num-subbuf 512 --subbuf-size 8k
>	--overwrite channel
>	5. lttng enable-event -u -a -c channel
>	6. lttng start
> 
> After these steps, the following error message show should be thrown:
> 
>	Error: ask_channel_creation consumer command failed
>	Error: Error creating UST channel "channel" on the consumer daemon
> 
> Signed-off-by: Gabriel-Andrew Pollo-Guilbert
> <gabriel.pollo-guilbert@efficios.com>
> ---
> libringbuffer/ring_buffer_backend.c | 3 +++
> 1 file changed, 3 insertions(+)
> 
> diff --git a/libringbuffer/ring_buffer_backend.c
> b/libringbuffer/ring_buffer_backend.c
> index a0ef7446..431b8eae 100644
> --- a/libringbuffer/ring_buffer_backend.c
> +++ b/libringbuffer/ring_buffer_backend.c
> @@ -341,6 +341,9 @@ int channel_backend_init(struct channel_backend *chanb,
> 	shmsize += sizeof(struct commit_counters_hot) * num_subbuf;
> 	shmsize += offset_align(shmsize, __alignof__(struct commit_counters_cold));
> 	shmsize += sizeof(struct commit_counters_cold) * num_subbuf;
> +	/* Sampled timestamp end */
> +	shmsize += offset_align(shmsize, __alignof__(uint64_t));
> +	shmsize += sizeof(uint64_t) * num_subbuf;
> 
> 	if (config->alloc == RING_BUFFER_ALLOC_PER_CPU) {
> 		struct lttng_ust_lib_ring_buffer *buf;
> --
> 2.21.0

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH lttng-ust v2] Fix: allocate ts_end in ringbuffer shared memory
       [not found] ` <c9f0e5ee-14ed-a2e7-1113-49a77bc7312a@gydle.com>
@ 2019-05-10 18:00   ` Mathieu Desnoyers
  2019-05-10 18:08   ` Jonathan Rajotte-Julien
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 10+ messages in thread
From: Mathieu Desnoyers @ 2019-05-10 18:00 UTC (permalink / raw)
  To: Sebastien Boisvert; +Cc: lttng-dev

----- On May 10, 2019, at 12:33 PM, Sebastien Boisvert sboisvert@gydle.com wrote:

> On 2019-05-10 11:26 a.m., Gabriel-Andrew Pollo-Guilbert wrote:
> 
> Hello Gabriel-Andrew,
> 
>> This patch allocates the memory used by the ts_end field added by commit
>> 6c737d05. When allocating lots of subbuffer for a channel (512 or more),
>> zalloc_shm() will fail to allocate all the objects because the allocated memory
>> map didn't take account the newly added field.
>> 
>> lttng-tools version: b14f53d4 (2.12.0-pre)
>> 
>> Steps to reproduce the bug:
>> 
>> 	1. lttng-sessiond -vvv --verbose-consumer
> 
> I need to killall existing lttng-sessiond daemon, right ?
> 
>> 	2. start a traced application
> 
> I used lttng-ust/doc/examples/demo/.
> 
>> 	3. lttng create "test-sesssion"
>                                ^^^
> There are too many s in session.

oops, already merged.

> 
> 
>> 	4. lttng enable-channel --userspace --num-subbuf 512 --subbuf-size 8k
>> 	--overwrite channel
>> 	5. lttng enable-event -u -a -c channel
>> 	6. lttng start
>> 
>> After these steps, the following error message show should be thrown:
>> 
>> 	Error: ask_channel_creation consumer command failed
>> 	Error: Error creating UST channel "channel" on the consumer daemon
> 
> When I build lttng-tools b14f53d4
> 
> I get this error:
> 
> make[3]: Entering directory
> '/home/sboisvert/open-source/lttng.org/Source/lttng-tools/src/common/ust-consumer'
>  CC       ust-consumer.lo
> ust-consumer.c: In function 'lttng_ustconsumer_recv_cmd':
> ust-consumer.c:1459:7: error: 'struct ustctl_consumer_channel_attr' has no
> member named 'blocking_timeout'
>   attr.blocking_timeout= msg.u.ask_channel.blocking_timeout;
>       ^
> ust-consumer.c: In function 'lttng_ustconsumer_sample_snapshot_positions':
> ust-consumer.c:2225:9: warning: implicit declaration of function
> 'ustctl_snapshot_sample_positions'; did you mean
> 'ustctl_snapshot_get_produced'? [-Wimplicit-function-declaration]
>  return ustctl_snapshot_sample_positions(stream->ustream);
>         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>         ustctl_snapshot_get_produced
> Makefile:548: recipe for target 'ust-consumer.lo' failed
> 
> 
> There seems to be 2 declarations of struct ustctl_consumer_channel_attr.
> 
> In file lttng-tools/src/bin/lttng-sessiond/lttng-ust-ctl.h,
> struct ustctl_consumer_channel_attr has the attribute blocking_timeout.
> 
> In file lttng-ust/include/lttng/ust-ctl.h, struct ustctl_consumer_channel_attr
> does not have the attribute.
> 
> 
> They are exactly the same, except the missing blocking_timeout attribute.
> 
> 
> [sboisvert@GT480:Source]$ grep -A 10 "struct ustctl_consumer_channel_attr {"
> lttng-ust/include/lttng/ust-ctl.h
> struct ustctl_consumer_channel_attr {
>	enum lttng_ust_chan_type type;
>	uint64_t subbuf_size;			/* bytes */
>	uint64_t num_subbuf;			/* power of 2 */
>	int overwrite;				/* 1: overwrite, 0: discard */
>	unsigned int switch_timer_interval;	/* usec */
>	unsigned int read_timer_interval;	/* usec */
>	enum lttng_ust_output output;		/* splice, mmap */
>	uint32_t chan_id;			/* channel ID */
>	unsigned char uuid[LTTNG_UST_UUID_LEN]; /* Trace session unique ID */
> } LTTNG_PACKED;
> 
> [sboisvert@GT480:Source]$ grep -A 11 "struct ustctl_consumer_channel_attr {"
> lttng-tools/src/bin/lttng-sessiond/lttng-ust-ctl.h
> struct ustctl_consumer_channel_attr {
>	enum lttng_ust_chan_type type;
>	uint64_t subbuf_size;			/* bytes */
>	uint64_t num_subbuf;			/* power of 2 */
>	int overwrite;				/* 1: overwrite, 0: discard */
>	unsigned int switch_timer_interval;	/* usec */
>	unsigned int read_timer_interval;	/* usec */
>	enum lttng_ust_output output;		/* splice, mmap */
>	uint32_t chan_id;			/* channel ID */
>	unsigned char uuid[LTTNG_UST_UUID_LEN]; /* Trace session unique ID */
>	int64_t blocking_timeout;			/* Blocking timeout (usec) */
> } LTTNG_PACKED;
> 
> [sboisvert@GT480:Source]$ diff -u <(grep -A 11 "struct
> ustctl_consumer_channel_attr {"
> lttng-tools/src/bin/lttng-sessiond/lttng-ust-ctl.h) <(grep -A 10 "struct
> ustctl_consumer_channel_attr {" lttng-ust/include/lttng/ust-ctl.h)
> --- /dev/fd/63	2019-05-10 12:32:23.562246820 -0400
> +++ /dev/fd/62	2019-05-10 12:32:23.562246820 -0400
> @@ -8,5 +8,4 @@
> 	enum lttng_ust_output output;		/* splice, mmap */
> 	uint32_t chan_id;			/* channel ID */
> 	unsigned char uuid[LTTNG_UST_UUID_LEN]; /* Trace session unique ID */
> -	int64_t blocking_timeout;			/* Blocking timeout (usec) */
> } LTTNG_PACKED;
> 
> 
> My configure commands (followed by "make install"):
> 
> [sboisvert@GT480:userspace-rcu]$ ./configure
> --prefix=/home/sboisvert/open-source/lttng.org/Build/userspace-rcu/v0.11.0
> 
> [sboisvert@GT480:lttng-ust]$ ./configure
> --prefix=/home/sboisvert/open-source/lttng.org/Build/lttng-ust/v2.9.4
> LDFLAGS=-L/home/sboisvert/open-source/lttng.org/Build/userspace-rcu/v0.11.0/lib

I think you need a lttng-ust which is more recent than 2.9.4.

Thanks,

Mathieu

> 
> [sboisvert@GT480:lttng-tools]$ ./configure
> --prefix=/home/sboisvert/open-source/lttng.org/Build/lttng-tools/b14f53d4
> LDFLAGS=-L/home/sboisvert/open-source/lttng.org/Build/lttng-ust/v2.9.4/lib
> CPPFLAGS=-I/home/sboisvert/open-source/lttng.org/Build/lttng-ust/v2.9.4/include
> 
> 
> Thanks
> 
>> 
>> Signed-off-by: Gabriel-Andrew Pollo-Guilbert
>> <gabriel.pollo-guilbert@efficios.com>
>> ---
>>  libringbuffer/ring_buffer_backend.c | 3 +++
>>  1 file changed, 3 insertions(+)
>> 
>> diff --git a/libringbuffer/ring_buffer_backend.c
>> b/libringbuffer/ring_buffer_backend.c
>> index a0ef7446..431b8eae 100644
>> --- a/libringbuffer/ring_buffer_backend.c
>> +++ b/libringbuffer/ring_buffer_backend.c
>> @@ -341,6 +341,9 @@ int channel_backend_init(struct channel_backend *chanb,
>>  	shmsize += sizeof(struct commit_counters_hot) * num_subbuf;
>>  	shmsize += offset_align(shmsize, __alignof__(struct commit_counters_cold));
>>  	shmsize += sizeof(struct commit_counters_cold) * num_subbuf;
>> +	/* Sampled timestamp end */
>> +	shmsize += offset_align(shmsize, __alignof__(uint64_t));
>> +	shmsize += sizeof(uint64_t) * num_subbuf;
>>  
>>  	if (config->alloc == RING_BUFFER_ALLOC_PER_CPU) {
>>  		struct lttng_ust_lib_ring_buffer *buf;
>> 
> _______________________________________________
> 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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH lttng-ust v2] Fix: allocate ts_end in ringbuffer shared memory
       [not found] ` <c9f0e5ee-14ed-a2e7-1113-49a77bc7312a@gydle.com>
  2019-05-10 18:00   ` Mathieu Desnoyers
@ 2019-05-10 18:08   ` Jonathan Rajotte-Julien
       [not found]   ` <1897690228.618.1557511236306.JavaMail.zimbra@efficios.com>
       [not found]   ` <20190510180851.GG15644@joraj-alpa>
  3 siblings, 0 replies; 10+ messages in thread
From: Jonathan Rajotte-Julien @ 2019-05-10 18:08 UTC (permalink / raw)
  To: Sebastien Boisvert; +Cc: lttng-dev

Hi,

On Fri, May 10, 2019 at 12:33:42PM -0400, Sebastien Boisvert wrote:
> On 2019-05-10 11:26 a.m., Gabriel-Andrew Pollo-Guilbert wrote:
> 
> Hello Gabriel-Andrew,
> 
> > This patch allocates the memory used by the ts_end field added by commit
> > 6c737d05. When allocating lots of subbuffer for a channel (512 or more),
> > zalloc_shm() will fail to allocate all the objects because the allocated memory
> > map didn't take account the newly added field.
> > 
> > lttng-tools version: b14f53d4 (2.12.0-pre)
> > 
> > Steps to reproduce the bug:
> > 
> > 	1. lttng-sessiond -vvv --verbose-consumer
> 
> I need to killall existing lttng-sessiond daemon, right ?

No, since we are in userspace this can be done with a root lttng-sessiond
present. But in real life -> yes.

> 
> > 	2. start a traced application
> 
> I used lttng-ust/doc/examples/demo/.

Make sure that the app is long lived (easy-ust with a while loop for example).
This is only to force the allocation on lttng start.

> 
> > 	3. lttng create "test-sesssion"
>                                 ^^^
> There are too many s in session.

Does not matter since it is the session name here and subsequent call are done
in the context on that session. Still a good catch.

> 
> 
> > 	4. lttng enable-channel --userspace --num-subbuf 512 --subbuf-size 8k --overwrite channel
> > 	5. lttng enable-event -u -a -c channel
> > 	6. lttng start
> > 
> > After these steps, the following error message show should be thrown:
> > 
> > 	Error: ask_channel_creation consumer command failed
> > 	Error: Error creating UST channel "channel" on the consumer daemon
> 
> When I build lttng-tools b14f53d4
> 
> I get this error:
> 
> make[3]: Entering directory '/home/sboisvert/open-source/lttng.org/Source/lttng-tools/src/common/ust-consumer'
>   CC       ust-consumer.lo
> ust-consumer.c: In function 'lttng_ustconsumer_recv_cmd':
> ust-consumer.c:1459:7: error: 'struct ustctl_consumer_channel_attr' has no member named 'blocking_timeout'
>    attr.blocking_timeout= msg.u.ask_channel.blocking_timeout;
>        ^
> ust-consumer.c: In function 'lttng_ustconsumer_sample_snapshot_positions':
> ust-consumer.c:2225:9: warning: implicit declaration of function 'ustctl_snapshot_sample_positions'; did you mean 'ustctl_snapshot_get_produced'? [-Wimplicit-function-declaration]
>   return ustctl_snapshot_sample_positions(stream->ustream);
>          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>          ustctl_snapshot_get_produced
> Makefile:548: recipe for target 'ust-consumer.lo' failed

Are you sure you are building lttng-tools against lttng-ust
6c737d0594cac0d969e1948ea1ed55c15be9cec8 or master?

In any case, this does not seems related to this particular issue. Please start
a new email thread.

> 
> 
> There seems to be 2 declarations of struct ustctl_consumer_channel_attr.
> 
> In file lttng-tools/src/bin/lttng-sessiond/lttng-ust-ctl.h,
> struct ustctl_consumer_channel_attr has the attribute blocking_timeout.
> 
> In file lttng-ust/include/lttng/ust-ctl.h, struct ustctl_consumer_channel_attr
> does not have the attribute.

Currently on 6c737d0594cac0d969e1948ea1ed55c15be9cec8 (almost master):

struct ustctl_consumer_channel_attr {
	enum lttng_ust_chan_type type;
	uint64_t subbuf_size;			/* bytes */
	uint64_t num_subbuf;			/* power of 2 */
	int overwrite;				/* 1: overwrite, 0: discard */
	unsigned int switch_timer_interval;	/* usec */
	unsigned int read_timer_interval;	/* usec */
	enum lttng_ust_output output;		/* splice, mmap */
	uint32_t chan_id;			/* channel ID */
	unsigned char uuid[LTTNG_UST_UUID_LEN]; /* Trace session unique ID */
	int64_t blocking_timeout;			/* Blocking timeout (usec) */
} LTTNG_PACKED;

This field was introduced in b2c5f61a9. Suggesting that you lttng-ust tree is
out of date.

> 
> 
> They are exactly the same, except the missing blocking_timeout attribute.
> 
> 
> [sboisvert@GT480:Source]$ grep -A 10 "struct ustctl_consumer_channel_attr {" lttng-ust/include/lttng/ust-ctl.h
> struct ustctl_consumer_channel_attr {
> 	enum lttng_ust_chan_type type;
> 	uint64_t subbuf_size;			/* bytes */
> 	uint64_t num_subbuf;			/* power of 2 */
> 	int overwrite;				/* 1: overwrite, 0: discard */
> 	unsigned int switch_timer_interval;	/* usec */
> 	unsigned int read_timer_interval;	/* usec */
> 	enum lttng_ust_output output;		/* splice, mmap */
> 	uint32_t chan_id;			/* channel ID */
> 	unsigned char uuid[LTTNG_UST_UUID_LEN]; /* Trace session unique ID */
> } LTTNG_PACKED;
> 
> [sboisvert@GT480:Source]$ grep -A 11 "struct ustctl_consumer_channel_attr {" lttng-tools/src/bin/lttng-sessiond/lttng-ust-ctl.h
> struct ustctl_consumer_channel_attr {
> 	enum lttng_ust_chan_type type;
> 	uint64_t subbuf_size;			/* bytes */
> 	uint64_t num_subbuf;			/* power of 2 */
> 	int overwrite;				/* 1: overwrite, 0: discard */
> 	unsigned int switch_timer_interval;	/* usec */
> 	unsigned int read_timer_interval;	/* usec */
> 	enum lttng_ust_output output;		/* splice, mmap */
> 	uint32_t chan_id;			/* channel ID */
> 	unsigned char uuid[LTTNG_UST_UUID_LEN]; /* Trace session unique ID */
> 	int64_t blocking_timeout;			/* Blocking timeout (usec) */
> } LTTNG_PACKED;
> 
> [sboisvert@GT480:Source]$ diff -u <(grep -A 11 "struct ustctl_consumer_channel_attr {" lttng-tools/src/bin/lttng-sessiond/lttng-ust-ctl.h) <(grep -A 10 "struct ustctl_consumer_channel_attr {" lttng-ust/include/lttng/ust-ctl.h)
> --- /dev/fd/63	2019-05-10 12:32:23.562246820 -0400
> +++ /dev/fd/62	2019-05-10 12:32:23.562246820 -0400
> @@ -8,5 +8,4 @@
>  	enum lttng_ust_output output;		/* splice, mmap */
>  	uint32_t chan_id;			/* channel ID */
>  	unsigned char uuid[LTTNG_UST_UUID_LEN]; /* Trace session unique ID */
> -	int64_t blocking_timeout;			/* Blocking timeout (usec) */
>  } LTTNG_PACKED;
> 
>  
> My configure commands (followed by "make install"):
> 
> [sboisvert@GT480:userspace-rcu]$ ./configure --prefix=/home/sboisvert/open-source/lttng.org/Build/userspace-rcu/v0.11.0
> 
> [sboisvert@GT480:lttng-ust]$ ./configure --prefix=/home/sboisvert/open-source/lttng.org/Build/lttng-ust/v2.9.4 LDFLAGS=-L/home/sboisvert/open-source/lttng.org/Build/userspace-rcu/v0.11.0/lib
> 
> [sboisvert@GT480:lttng-tools]$ ./configure --prefix=/home/sboisvert/open-source/lttng.org/Build/lttng-tools/b14f53d4 LDFLAGS=-L/home/sboisvert/open-source/lttng.org/Build/lttng-ust/v2.9.4/lib CPPFLAGS=-I/home/sboisvert/open-source/lttng.org/Build/lttng-ust/v2.9.4/include
> 

This is probably an artefact but all your path have 2.9 in them. This work is
done against master of lttng-tools and lttng-ust.

Our CI does not indicate any failure for the master branches. [1]

[1] 

Cheers

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH lttng-ust v2] Fix: allocate ts_end in ringbuffer shared memory
       [not found]   ` <20190510180851.GG15644@joraj-alpa>
@ 2019-05-10 18:16     ` Jonathan Rajotte-Julien
       [not found]     ` <20190510181626.GA24050@joraj-alpa>
  2019-05-10 19:24     ` Sebastien Boisvert
  2 siblings, 0 replies; 10+ messages in thread
From: Jonathan Rajotte-Julien @ 2019-05-10 18:16 UTC (permalink / raw)
  To: Sebastien Boisvert; +Cc: lttng-dev

On Fri, May 10, 2019 at 02:08:51PM -0400, Jonathan Rajotte-Julien wrote:
> Hi,
> 
> On Fri, May 10, 2019 at 12:33:42PM -0400, Sebastien Boisvert wrote:
> > On 2019-05-10 11:26 a.m., Gabriel-Andrew Pollo-Guilbert wrote:
> > 
> > Hello Gabriel-Andrew,
> > 
> > > This patch allocates the memory used by the ts_end field added by commit
> > > 6c737d05. When allocating lots of subbuffer for a channel (512 or more),
> > > zalloc_shm() will fail to allocate all the objects because the allocated memory
> > > map didn't take account the newly added field.
> > > 
> > > lttng-tools version: b14f53d4 (2.12.0-pre)
> > > 
> > > Steps to reproduce the bug:
> > > 
> > > 	1. lttng-sessiond -vvv --verbose-consumer
> > 
> > I need to killall existing lttng-sessiond daemon, right ?
> 
> No, since we are in userspace this can be done with a root lttng-sessiond
> present. But in real life -> yes.
> 
> > 
> > > 	2. start a traced application
> > 
> > I used lttng-ust/doc/examples/demo/.
> 
> Make sure that the app is long lived (easy-ust with a while loop for example).
> This is only to force the allocation on lttng start.
> 
> > 
> > > 	3. lttng create "test-sesssion"
> >                                 ^^^
> > There are too many s in session.
> 
> Does not matter since it is the session name here and subsequent call are done
> in the context on that session. Still a good catch.
> 
> > 
> > 
> > > 	4. lttng enable-channel --userspace --num-subbuf 512 --subbuf-size 8k --overwrite channel
> > > 	5. lttng enable-event -u -a -c channel
> > > 	6. lttng start
> > > 
> > > After these steps, the following error message show should be thrown:
> > > 
> > > 	Error: ask_channel_creation consumer command failed
> > > 	Error: Error creating UST channel "channel" on the consumer daemon
> > 
> > When I build lttng-tools b14f53d4
> > 
> > I get this error:
> > 
> > make[3]: Entering directory '/home/sboisvert/open-source/lttng.org/Source/lttng-tools/src/common/ust-consumer'
> >   CC       ust-consumer.lo
> > ust-consumer.c: In function 'lttng_ustconsumer_recv_cmd':
> > ust-consumer.c:1459:7: error: 'struct ustctl_consumer_channel_attr' has no member named 'blocking_timeout'
> >    attr.blocking_timeout= msg.u.ask_channel.blocking_timeout;
> >        ^
> > ust-consumer.c: In function 'lttng_ustconsumer_sample_snapshot_positions':
> > ust-consumer.c:2225:9: warning: implicit declaration of function 'ustctl_snapshot_sample_positions'; did you mean 'ustctl_snapshot_get_produced'? [-Wimplicit-function-declaration]
> >   return ustctl_snapshot_sample_positions(stream->ustream);
> >          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >          ustctl_snapshot_get_produced
> > Makefile:548: recipe for target 'ust-consumer.lo' failed
> 
> Are you sure you are building lttng-tools against lttng-ust
> 6c737d0594cac0d969e1948ea1ed55c15be9cec8 or master?
> 
> In any case, this does not seems related to this particular issue. Please start
> a new email thread.
> 
> > 
> > 
> > There seems to be 2 declarations of struct ustctl_consumer_channel_attr.
> > 
> > In file lttng-tools/src/bin/lttng-sessiond/lttng-ust-ctl.h,
> > struct ustctl_consumer_channel_attr has the attribute blocking_timeout.
> > 
> > In file lttng-ust/include/lttng/ust-ctl.h, struct ustctl_consumer_channel_attr
> > does not have the attribute.
> 
> Currently on 6c737d0594cac0d969e1948ea1ed55c15be9cec8 (almost master):
> 
> struct ustctl_consumer_channel_attr {
> 	enum lttng_ust_chan_type type;
> 	uint64_t subbuf_size;			/* bytes */
> 	uint64_t num_subbuf;			/* power of 2 */
> 	int overwrite;				/* 1: overwrite, 0: discard */
> 	unsigned int switch_timer_interval;	/* usec */
> 	unsigned int read_timer_interval;	/* usec */
> 	enum lttng_ust_output output;		/* splice, mmap */
> 	uint32_t chan_id;			/* channel ID */
> 	unsigned char uuid[LTTNG_UST_UUID_LEN]; /* Trace session unique ID */
> 	int64_t blocking_timeout;			/* Blocking timeout (usec) */
> } LTTNG_PACKED;
> 
> This field was introduced in b2c5f61a9. Suggesting that you lttng-ust tree is
> out of date.
> 
> > 
> > 
> > They are exactly the same, except the missing blocking_timeout attribute.
> > 
> > 
> > [sboisvert@GT480:Source]$ grep -A 10 "struct ustctl_consumer_channel_attr {" lttng-ust/include/lttng/ust-ctl.h
> > struct ustctl_consumer_channel_attr {
> > 	enum lttng_ust_chan_type type;
> > 	uint64_t subbuf_size;			/* bytes */
> > 	uint64_t num_subbuf;			/* power of 2 */
> > 	int overwrite;				/* 1: overwrite, 0: discard */
> > 	unsigned int switch_timer_interval;	/* usec */
> > 	unsigned int read_timer_interval;	/* usec */
> > 	enum lttng_ust_output output;		/* splice, mmap */
> > 	uint32_t chan_id;			/* channel ID */
> > 	unsigned char uuid[LTTNG_UST_UUID_LEN]; /* Trace session unique ID */
> > } LTTNG_PACKED;
> > 
> > [sboisvert@GT480:Source]$ grep -A 11 "struct ustctl_consumer_channel_attr {" lttng-tools/src/bin/lttng-sessiond/lttng-ust-ctl.h
> > struct ustctl_consumer_channel_attr {
> > 	enum lttng_ust_chan_type type;
> > 	uint64_t subbuf_size;			/* bytes */
> > 	uint64_t num_subbuf;			/* power of 2 */
> > 	int overwrite;				/* 1: overwrite, 0: discard */
> > 	unsigned int switch_timer_interval;	/* usec */
> > 	unsigned int read_timer_interval;	/* usec */
> > 	enum lttng_ust_output output;		/* splice, mmap */
> > 	uint32_t chan_id;			/* channel ID */
> > 	unsigned char uuid[LTTNG_UST_UUID_LEN]; /* Trace session unique ID */
> > 	int64_t blocking_timeout;			/* Blocking timeout (usec) */
> > } LTTNG_PACKED;
> > 
> > [sboisvert@GT480:Source]$ diff -u <(grep -A 11 "struct ustctl_consumer_channel_attr {" lttng-tools/src/bin/lttng-sessiond/lttng-ust-ctl.h) <(grep -A 10 "struct ustctl_consumer_channel_attr {" lttng-ust/include/lttng/ust-ctl.h)
> > --- /dev/fd/63	2019-05-10 12:32:23.562246820 -0400
> > +++ /dev/fd/62	2019-05-10 12:32:23.562246820 -0400
> > @@ -8,5 +8,4 @@
> >  	enum lttng_ust_output output;		/* splice, mmap */
> >  	uint32_t chan_id;			/* channel ID */
> >  	unsigned char uuid[LTTNG_UST_UUID_LEN]; /* Trace session unique ID */
> > -	int64_t blocking_timeout;			/* Blocking timeout (usec) */
> >  } LTTNG_PACKED;
> > 
> >  
> > My configure commands (followed by "make install"):
> > 
> > [sboisvert@GT480:userspace-rcu]$ ./configure --prefix=/home/sboisvert/open-source/lttng.org/Build/userspace-rcu/v0.11.0
> > 
> > [sboisvert@GT480:lttng-ust]$ ./configure --prefix=/home/sboisvert/open-source/lttng.org/Build/lttng-ust/v2.9.4 LDFLAGS=-L/home/sboisvert/open-source/lttng.org/Build/userspace-rcu/v0.11.0/lib
> > 
> > [sboisvert@GT480:lttng-tools]$ ./configure --prefix=/home/sboisvert/open-source/lttng.org/Build/lttng-tools/b14f53d4 LDFLAGS=-L/home/sboisvert/open-source/lttng.org/Build/lttng-ust/v2.9.4/lib CPPFLAGS=-I/home/sboisvert/open-source/lttng.org/Build/lttng-ust/v2.9.4/include
> > 
> 
> This is probably an artefact but all your path have 2.9 in them. This work is
> done against master of lttng-tools and lttng-ust.
> 
> Our CI does not indicate any failure for the master branches. [1]
> 
> [1] 

A bit quick on the send email on that one.

Our ci currently indicate failure for the master branch but nothing during the
build process (at make check).

[1] https://ci.lttng.org/job/lttng-tools_master_build/

> 
> Cheers
> _______________________________________________
> lttng-dev mailing list
> lttng-dev@lists.lttng.org
> https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

-- 
Jonathan Rajotte-Julien
EfficiOS

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH lttng-ust v2] Fix: allocate ts_end in ringbuffer shared memory
       [not found]     ` <20190510181626.GA24050@joraj-alpa>
@ 2019-05-10 18:19       ` Jonathan Rajotte-Julien
  0 siblings, 0 replies; 10+ messages in thread
From: Jonathan Rajotte-Julien @ 2019-05-10 18:19 UTC (permalink / raw)
  To: Sebastien Boisvert; +Cc: lttng-dev

> > 
> > This is probably an artefact but all your path have 2.9 in them. This work is
> > done against master of lttng-tools and lttng-ust.
> > 
> > Our CI does not indicate any failure for the master branches. [1]
> > 
> > [1] 
> 
> A bit quick on the send email on that one.
> 
> Our ci currently indicate failure for the master branch but nothing during the
> build process (at make check).

Again not true, failures are related to urcu.

I'll go get some coffee clearly need it.

Cheers

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH lttng-ust v2] Fix: allocate ts_end in ringbuffer shared memory
       [not found]   ` <1897690228.618.1557511236306.JavaMail.zimbra@efficios.com>
@ 2019-05-10 19:16     ` Sebastien Boisvert
       [not found]     ` <84225c7a-c13e-ff39-9891-5ddab703e8b9@gydle.com>
  1 sibling, 0 replies; 10+ messages in thread
From: Sebastien Boisvert @ 2019-05-10 19:16 UTC (permalink / raw)
  To: Mathieu Desnoyers; +Cc: lttng-dev



On 2019-05-10 2:00 p.m., Mathieu Desnoyers wrote:
> ----- On May 10, 2019, at 12:33 PM, Sebastien Boisvert sboisvert@gydle.com wrote:
> 
>> On 2019-05-10 11:26 a.m., Gabriel-Andrew Pollo-Guilbert wrote:
>>
>> Hello Gabriel-Andrew,
>>
>>> This patch allocates the memory used by the ts_end field added by commit
>>> 6c737d05. When allocating lots of subbuffer for a channel (512 or more),
>>> zalloc_shm() will fail to allocate all the objects because the allocated memory
>>> map didn't take account the newly added field.
>>>
>>> lttng-tools version: b14f53d4 (2.12.0-pre)
>>>
>>> Steps to reproduce the bug:
>>>
>>> 	1. lttng-sessiond -vvv --verbose-consumer
>>
>> I need to killall existing lttng-sessiond daemon, right ?
>>
>>> 	2. start a traced application
>>
>> I used lttng-ust/doc/examples/demo/.
>>
>>> 	3. lttng create "test-sesssion"
>>                                ^^^
>> There are too many s in session.
> 
> oops, already merged.
> 
>>
>>
>>> 	4. lttng enable-channel --userspace --num-subbuf 512 --subbuf-size 8k
>>> 	--overwrite channel
>>> 	5. lttng enable-event -u -a -c channel
>>> 	6. lttng start
>>>
>>> After these steps, the following error message show should be thrown:
>>>
>>> 	Error: ask_channel_creation consumer command failed
>>> 	Error: Error creating UST channel "channel" on the consumer daemon
>>
>> When I build lttng-tools b14f53d4
>>
>> I get this error:
>>
>> make[3]: Entering directory
>> '/home/sboisvert/open-source/lttng.org/Source/lttng-tools/src/common/ust-consumer'
>>  CC       ust-consumer.lo
>> ust-consumer.c: In function 'lttng_ustconsumer_recv_cmd':
>> ust-consumer.c:1459:7: error: 'struct ustctl_consumer_channel_attr' has no
>> member named 'blocking_timeout'
>>   attr.blocking_timeout= msg.u.ask_channel.blocking_timeout;
>>       ^
>> ust-consumer.c: In function 'lttng_ustconsumer_sample_snapshot_positions':
>> ust-consumer.c:2225:9: warning: implicit declaration of function
>> 'ustctl_snapshot_sample_positions'; did you mean
>> 'ustctl_snapshot_get_produced'? [-Wimplicit-function-declaration]
>>  return ustctl_snapshot_sample_positions(stream->ustream);
>>         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>         ustctl_snapshot_get_produced
>> Makefile:548: recipe for target 'ust-consumer.lo' failed
>>
>>
>> There seems to be 2 declarations of struct ustctl_consumer_channel_attr.
>>
>> In file lttng-tools/src/bin/lttng-sessiond/lttng-ust-ctl.h,
>> struct ustctl_consumer_channel_attr has the attribute blocking_timeout.
>>
>> In file lttng-ust/include/lttng/ust-ctl.h, struct ustctl_consumer_channel_attr
>> does not have the attribute.
>>
>>
>> They are exactly the same, except the missing blocking_timeout attribute.
>>
>>
>> [sboisvert@GT480:Source]$ grep -A 10 "struct ustctl_consumer_channel_attr {"
>> lttng-ust/include/lttng/ust-ctl.h
>> struct ustctl_consumer_channel_attr {
>> 	enum lttng_ust_chan_type type;
>> 	uint64_t subbuf_size;			/* bytes */
>> 	uint64_t num_subbuf;			/* power of 2 */
>> 	int overwrite;				/* 1: overwrite, 0: discard */
>> 	unsigned int switch_timer_interval;	/* usec */
>> 	unsigned int read_timer_interval;	/* usec */
>> 	enum lttng_ust_output output;		/* splice, mmap */
>> 	uint32_t chan_id;			/* channel ID */
>> 	unsigned char uuid[LTTNG_UST_UUID_LEN]; /* Trace session unique ID */
>> } LTTNG_PACKED;
>>
>> [sboisvert@GT480:Source]$ grep -A 11 "struct ustctl_consumer_channel_attr {"
>> lttng-tools/src/bin/lttng-sessiond/lttng-ust-ctl.h
>> struct ustctl_consumer_channel_attr {
>> 	enum lttng_ust_chan_type type;
>> 	uint64_t subbuf_size;			/* bytes */
>> 	uint64_t num_subbuf;			/* power of 2 */
>> 	int overwrite;				/* 1: overwrite, 0: discard */
>> 	unsigned int switch_timer_interval;	/* usec */
>> 	unsigned int read_timer_interval;	/* usec */
>> 	enum lttng_ust_output output;		/* splice, mmap */
>> 	uint32_t chan_id;			/* channel ID */
>> 	unsigned char uuid[LTTNG_UST_UUID_LEN]; /* Trace session unique ID */
>> 	int64_t blocking_timeout;			/* Blocking timeout (usec) */
>> } LTTNG_PACKED;
>>
>> [sboisvert@GT480:Source]$ diff -u <(grep -A 11 "struct
>> ustctl_consumer_channel_attr {"
>> lttng-tools/src/bin/lttng-sessiond/lttng-ust-ctl.h) <(grep -A 10 "struct
>> ustctl_consumer_channel_attr {" lttng-ust/include/lttng/ust-ctl.h)
>> --- /dev/fd/63	2019-05-10 12:32:23.562246820 -0400
>> +++ /dev/fd/62	2019-05-10 12:32:23.562246820 -0400
>> @@ -8,5 +8,4 @@
>> 	enum lttng_ust_output output;		/* splice, mmap */
>> 	uint32_t chan_id;			/* channel ID */
>> 	unsigned char uuid[LTTNG_UST_UUID_LEN]; /* Trace session unique ID */
>> -	int64_t blocking_timeout;			/* Blocking timeout (usec) */
>> } LTTNG_PACKED;
>>
>>
>> My configure commands (followed by "make install"):
>>
>> [sboisvert@GT480:userspace-rcu]$ ./configure
>> --prefix=/home/sboisvert/open-source/lttng.org/Build/userspace-rcu/v0.11.0
>>
>> [sboisvert@GT480:lttng-ust]$ ./configure
>> --prefix=/home/sboisvert/open-source/lttng.org/Build/lttng-ust/v2.9.4
>> LDFLAGS=-L/home/sboisvert/open-source/lttng.org/Build/userspace-rcu/v0.11.0/lib
> 
> I think you need a lttng-ust which is more recent than 2.9.4.

Got it.

I used the most recent git tag for lttng-ust: v2.9.4

> 
> Thanks,
> 
> Mathieu
> 
>>
>> [sboisvert@GT480:lttng-tools]$ ./configure
>> --prefix=/home/sboisvert/open-source/lttng.org/Build/lttng-tools/b14f53d4
>> LDFLAGS=-L/home/sboisvert/open-source/lttng.org/Build/lttng-ust/v2.9.4/lib
>> CPPFLAGS=-I/home/sboisvert/open-source/lttng.org/Build/lttng-ust/v2.9.4/include
>>
>>
>> Thanks
>>
>>>
>>> Signed-off-by: Gabriel-Andrew Pollo-Guilbert
>>> <gabriel.pollo-guilbert@efficios.com>
>>> ---
>>>  libringbuffer/ring_buffer_backend.c | 3 +++
>>>  1 file changed, 3 insertions(+)
>>>
>>> diff --git a/libringbuffer/ring_buffer_backend.c
>>> b/libringbuffer/ring_buffer_backend.c
>>> index a0ef7446..431b8eae 100644
>>> --- a/libringbuffer/ring_buffer_backend.c
>>> +++ b/libringbuffer/ring_buffer_backend.c
>>> @@ -341,6 +341,9 @@ int channel_backend_init(struct channel_backend *chanb,
>>>  	shmsize += sizeof(struct commit_counters_hot) * num_subbuf;
>>>  	shmsize += offset_align(shmsize, __alignof__(struct commit_counters_cold));
>>>  	shmsize += sizeof(struct commit_counters_cold) * num_subbuf;
>>> +	/* Sampled timestamp end */
>>> +	shmsize += offset_align(shmsize, __alignof__(uint64_t));
>>> +	shmsize += sizeof(uint64_t) * num_subbuf;
>>>  
>>>  	if (config->alloc == RING_BUFFER_ALLOC_PER_CPU) {
>>>  		struct lttng_ust_lib_ring_buffer *buf;
>>>
>> _______________________________________________
>> lttng-dev mailing list
>> lttng-dev@lists.lttng.org
>> https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
> 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH lttng-ust v2] Fix: allocate ts_end in ringbuffer shared memory
       [not found]   ` <20190510180851.GG15644@joraj-alpa>
  2019-05-10 18:16     ` Jonathan Rajotte-Julien
       [not found]     ` <20190510181626.GA24050@joraj-alpa>
@ 2019-05-10 19:24     ` Sebastien Boisvert
  2 siblings, 0 replies; 10+ messages in thread
From: Sebastien Boisvert @ 2019-05-10 19:24 UTC (permalink / raw)
  To: Jonathan Rajotte-Julien; +Cc: lttng-dev



On 2019-05-10 2:08 p.m., Jonathan Rajotte-Julien wrote:
> Hi,
> 
> On Fri, May 10, 2019 at 12:33:42PM -0400, Sebastien Boisvert wrote:
>> On 2019-05-10 11:26 a.m., Gabriel-Andrew Pollo-Guilbert wrote:
>>
>> Hello Gabriel-Andrew,
>>
>>> This patch allocates the memory used by the ts_end field added by commit
>>> 6c737d05. When allocating lots of subbuffer for a channel (512 or more),
>>> zalloc_shm() will fail to allocate all the objects because the allocated memory
>>> map didn't take account the newly added field.
>>>
>>> lttng-tools version: b14f53d4 (2.12.0-pre)
>>>
>>> Steps to reproduce the bug:
>>>
>>> 	1. lttng-sessiond -vvv --verbose-consumer
>>
>> I need to killall existing lttng-sessiond daemon, right ?
> 
> No, since we are in userspace this can be done with a root lttng-sessiond
> present. But in real life -> yes.
> 
>>
>>> 	2. start a traced application
>>
>> I used lttng-ust/doc/examples/demo/.
> 
> Make sure that the app is long lived (easy-ust with a while loop for example).
> This is only to force the allocation on lttng start.
> 
>>
>>> 	3. lttng create "test-sesssion"
>>                                 ^^^
>> There are too many s in session.
> 
> Does not matter since it is the session name here and subsequent call are done
> in the context on that session. Still a good catch.

Well, I thought that this typo was going to make it into the "git log"..


> 
>>
>>
>>> 	4. lttng enable-channel --userspace --num-subbuf 512 --subbuf-size 8k --overwrite channel
>>> 	5. lttng enable-event -u -a -c channel
>>> 	6. lttng start
>>>
>>> After these steps, the following error message show should be thrown:
>>>
>>> 	Error: ask_channel_creation consumer command failed
>>> 	Error: Error creating UST channel "channel" on the consumer daemon
>>
>> When I build lttng-tools b14f53d4
>>
>> I get this error:
>>
>> make[3]: Entering directory '/home/sboisvert/open-source/lttng.org/Source/lttng-tools/src/common/ust-consumer'
>>   CC       ust-consumer.lo
>> ust-consumer.c: In function 'lttng_ustconsumer_recv_cmd':
>> ust-consumer.c:1459:7: error: 'struct ustctl_consumer_channel_attr' has no member named 'blocking_timeout'
>>    attr.blocking_timeout= msg.u.ask_channel.blocking_timeout;
>>        ^
>> ust-consumer.c: In function 'lttng_ustconsumer_sample_snapshot_positions':
>> ust-consumer.c:2225:9: warning: implicit declaration of function 'ustctl_snapshot_sample_positions'; did you mean 'ustctl_snapshot_get_produced'? [-Wimplicit-function-declaration]
>>   return ustctl_snapshot_sample_positions(stream->ustream);
>>          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>          ustctl_snapshot_get_produced
>> Makefile:548: recipe for target 'ust-consumer.lo' failed
> 
> Are you sure you are building lttng-tools against lttng-ust
> 6c737d0594cac0d969e1948ea1ed55c15be9cec8 or master?

My email said that I was using lttng-ust, git tag v2.9.4.

> 
> In any case, this does not seems related to this particular issue. Please start
> a new email thread.
> 

I wanted to test the change "Fix: allocate ts_end in ringbuffer shared memory" on my computer.

Building userspace-rcu, lttng-ust, and lttng-tools was a prerequisite.

But, fair enough, I should have started a new thread.

>>
>>
>> There seems to be 2 declarations of struct ustctl_consumer_channel_attr.
>>
>> In file lttng-tools/src/bin/lttng-sessiond/lttng-ust-ctl.h,
>> struct ustctl_consumer_channel_attr has the attribute blocking_timeout.
>>
>> In file lttng-ust/include/lttng/ust-ctl.h, struct ustctl_consumer_channel_attr
>> does not have the attribute.
> 
> Currently on 6c737d0594cac0d969e1948ea1ed55c15be9cec8 (almost master):
> 
> struct ustctl_consumer_channel_attr {
> 	enum lttng_ust_chan_type type;
> 	uint64_t subbuf_size;			/* bytes */
> 	uint64_t num_subbuf;			/* power of 2 */
> 	int overwrite;				/* 1: overwrite, 0: discard */
> 	unsigned int switch_timer_interval;	/* usec */
> 	unsigned int read_timer_interval;	/* usec */
> 	enum lttng_ust_output output;		/* splice, mmap */
> 	uint32_t chan_id;			/* channel ID */
> 	unsigned char uuid[LTTNG_UST_UUID_LEN]; /* Trace session unique ID */
> 	int64_t blocking_timeout;			/* Blocking timeout (usec) */
> } LTTNG_PACKED;
> 
> This field was introduced in b2c5f61a9. Suggesting that you lttng-ust tree is
> out of date.
> 
>>
>>
>> They are exactly the same, except the missing blocking_timeout attribute.
>>
>>
>> [sboisvert@GT480:Source]$ grep -A 10 "struct ustctl_consumer_channel_attr {" lttng-ust/include/lttng/ust-ctl.h
>> struct ustctl_consumer_channel_attr {
>> 	enum lttng_ust_chan_type type;
>> 	uint64_t subbuf_size;			/* bytes */
>> 	uint64_t num_subbuf;			/* power of 2 */
>> 	int overwrite;				/* 1: overwrite, 0: discard */
>> 	unsigned int switch_timer_interval;	/* usec */
>> 	unsigned int read_timer_interval;	/* usec */
>> 	enum lttng_ust_output output;		/* splice, mmap */
>> 	uint32_t chan_id;			/* channel ID */
>> 	unsigned char uuid[LTTNG_UST_UUID_LEN]; /* Trace session unique ID */
>> } LTTNG_PACKED;
>>
>> [sboisvert@GT480:Source]$ grep -A 11 "struct ustctl_consumer_channel_attr {" lttng-tools/src/bin/lttng-sessiond/lttng-ust-ctl.h
>> struct ustctl_consumer_channel_attr {
>> 	enum lttng_ust_chan_type type;
>> 	uint64_t subbuf_size;			/* bytes */
>> 	uint64_t num_subbuf;			/* power of 2 */
>> 	int overwrite;				/* 1: overwrite, 0: discard */
>> 	unsigned int switch_timer_interval;	/* usec */
>> 	unsigned int read_timer_interval;	/* usec */
>> 	enum lttng_ust_output output;		/* splice, mmap */
>> 	uint32_t chan_id;			/* channel ID */
>> 	unsigned char uuid[LTTNG_UST_UUID_LEN]; /* Trace session unique ID */
>> 	int64_t blocking_timeout;			/* Blocking timeout (usec) */
>> } LTTNG_PACKED;
>>
>> [sboisvert@GT480:Source]$ diff -u <(grep -A 11 "struct ustctl_consumer_channel_attr {" lttng-tools/src/bin/lttng-sessiond/lttng-ust-ctl.h) <(grep -A 10 "struct ustctl_consumer_channel_attr {" lttng-ust/include/lttng/ust-ctl.h)
>> --- /dev/fd/63	2019-05-10 12:32:23.562246820 -0400
>> +++ /dev/fd/62	2019-05-10 12:32:23.562246820 -0400
>> @@ -8,5 +8,4 @@
>>  	enum lttng_ust_output output;		/* splice, mmap */
>>  	uint32_t chan_id;			/* channel ID */
>>  	unsigned char uuid[LTTNG_UST_UUID_LEN]; /* Trace session unique ID */
>> -	int64_t blocking_timeout;			/* Blocking timeout (usec) */
>>  } LTTNG_PACKED;
>>
>>  
>> My configure commands (followed by "make install"):
>>
>> [sboisvert@GT480:userspace-rcu]$ ./configure --prefix=/home/sboisvert/open-source/lttng.org/Build/userspace-rcu/v0.11.0
>>
>> [sboisvert@GT480:lttng-ust]$ ./configure --prefix=/home/sboisvert/open-source/lttng.org/Build/lttng-ust/v2.9.4 LDFLAGS=-L/home/sboisvert/open-source/lttng.org/Build/userspace-rcu/v0.11.0/lib
>>
>> [sboisvert@GT480:lttng-tools]$ ./configure --prefix=/home/sboisvert/open-source/lttng.org/Build/lttng-tools/b14f53d4 LDFLAGS=-L/home/sboisvert/open-source/lttng.org/Build/lttng-ust/v2.9.4/lib CPPFLAGS=-I/home/sboisvert/open-source/lttng.org/Build/lttng-ust/v2.9.4/include
>>
> 
> This is probably an artefact but all your path have 2.9 in them. This work is
> done against master of lttng-tools and lttng-ust.
> 
> Our CI does not indicate any failure for the master branches. [1]
> 
> [1] 
> 
> Cheers
> 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH lttng-ust v2] Fix: allocate ts_end in ringbuffer shared memory
       [not found]     ` <84225c7a-c13e-ff39-9891-5ddab703e8b9@gydle.com>
@ 2019-05-10 19:34       ` Mathieu Desnoyers
  0 siblings, 0 replies; 10+ messages in thread
From: Mathieu Desnoyers @ 2019-05-10 19:34 UTC (permalink / raw)
  To: Sebastien Boisvert; +Cc: lttng-dev

----- On May 10, 2019, at 3:16 PM, Sebastien Boisvert sboisvert@gydle.com wrote:

> On 2019-05-10 2:00 p.m., Mathieu Desnoyers wrote:
[...]
>>> [sboisvert@GT480:lttng-ust]$ ./configure
>>> --prefix=/home/sboisvert/open-source/lttng.org/Build/lttng-ust/v2.9.4
>>> LDFLAGS=-L/home/sboisvert/open-source/lttng.org/Build/userspace-rcu/v0.11.0/lib
>> 
>> I think you need a lttng-ust which is more recent than 2.9.4.
> 
> Got it.
> 
> I used the most recent git tag for lttng-ust: v2.9.4

The most recent git tag stable version for lttng-ust is actually 2.10.3.

The patch in this thread addresses an issue recently introduced only in the
master branch and the stable-2.11 branch (no release tags yet).

Thanks,

Mathieu

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH lttng-ust v2] Fix: allocate ts_end in ringbuffer shared memory
@ 2019-05-10 15:26 Gabriel-Andrew Pollo-Guilbert
  0 siblings, 0 replies; 10+ messages in thread
From: Gabriel-Andrew Pollo-Guilbert @ 2019-05-10 15:26 UTC (permalink / raw)
  To: lttng-dev

This patch allocates the memory used by the ts_end field added by commit
6c737d05. When allocating lots of subbuffer for a channel (512 or more),
zalloc_shm() will fail to allocate all the objects because the allocated memory
map didn't take account the newly added field.

lttng-tools version: b14f53d4 (2.12.0-pre)

Steps to reproduce the bug:

	1. lttng-sessiond -vvv --verbose-consumer
	2. start a traced application
	3. lttng create "test-sesssion"
	4. lttng enable-channel --userspace --num-subbuf 512 --subbuf-size 8k --overwrite channel
	5. lttng enable-event -u -a -c channel
	6. lttng start

After these steps, the following error message show should be thrown:

	Error: ask_channel_creation consumer command failed
	Error: Error creating UST channel "channel" on the consumer daemon

Signed-off-by: Gabriel-Andrew Pollo-Guilbert <gabriel.pollo-guilbert@efficios.com>
---
 libringbuffer/ring_buffer_backend.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libringbuffer/ring_buffer_backend.c b/libringbuffer/ring_buffer_backend.c
index a0ef7446..431b8eae 100644
--- a/libringbuffer/ring_buffer_backend.c
+++ b/libringbuffer/ring_buffer_backend.c
@@ -341,6 +341,9 @@ int channel_backend_init(struct channel_backend *chanb,
 	shmsize += sizeof(struct commit_counters_hot) * num_subbuf;
 	shmsize += offset_align(shmsize, __alignof__(struct commit_counters_cold));
 	shmsize += sizeof(struct commit_counters_cold) * num_subbuf;
+	/* Sampled timestamp end */
+	shmsize += offset_align(shmsize, __alignof__(uint64_t));
+	shmsize += sizeof(uint64_t) * num_subbuf;
 
 	if (config->alloc == RING_BUFFER_ALLOC_PER_CPU) {
 		struct lttng_ust_lib_ring_buffer *buf;
-- 
2.21.0

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2019-05-10 19:34 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20190510152632.8730-1-gabriel.pollo-guilbert@efficios.com>
2019-05-10 16:33 ` [PATCH lttng-ust v2] Fix: allocate ts_end in ringbuffer shared memory Sebastien Boisvert
2019-05-10 17:41 ` Mathieu Desnoyers
     [not found] ` <c9f0e5ee-14ed-a2e7-1113-49a77bc7312a@gydle.com>
2019-05-10 18:00   ` Mathieu Desnoyers
2019-05-10 18:08   ` Jonathan Rajotte-Julien
     [not found]   ` <1897690228.618.1557511236306.JavaMail.zimbra@efficios.com>
2019-05-10 19:16     ` Sebastien Boisvert
     [not found]     ` <84225c7a-c13e-ff39-9891-5ddab703e8b9@gydle.com>
2019-05-10 19:34       ` Mathieu Desnoyers
     [not found]   ` <20190510180851.GG15644@joraj-alpa>
2019-05-10 18:16     ` Jonathan Rajotte-Julien
     [not found]     ` <20190510181626.GA24050@joraj-alpa>
2019-05-10 18:19       ` Jonathan Rajotte-Julien
2019-05-10 19:24     ` Sebastien Boisvert
2019-05-10 15:26 Gabriel-Andrew Pollo-Guilbert

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).