Fix: allocate ts_end in ringbuffer shared memory
authorGabriel-Andrew Pollo-Guilbert <gabriel.pollo-guilbert@efficios.com>
Fri, 10 May 2019 15:26:32 +0000 (11:26 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 10 May 2019 17:39:09 +0000 (13:39 -0400)
Allocate 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.

With 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>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
libringbuffer/ring_buffer_backend.c

index a0ef74461bd12606b9d3bd6eaa14ac2ae9f600ab..431b8eae949250c1d51bbbe981aac84c42ee5edf 100644 (file)
@@ -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;
This page took 0.025192 seconds and 4 git commands to generate.