Fix: silence 'non-consumed' message for non-started sessions
authorMichael Jeanson <mjeanson@efficios.com>
Mon, 28 Oct 2024 20:02:59 +0000 (16:02 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 4 Nov 2024 20:37:46 +0000 (15:37 -0500)
Destroying a session with at least one enabled event and which has never
been started will currently result in an error message in the kernel log
about 'non-consumed data' for each of the per-cpu buffer. This happens
because a packet header is created in the buffer but never consumed if
the session is not started.

Add a check in the buffer cleanup code to avoid printing 'non-consumed
data' errors for buffers associated with a session taht was never
started.

Change-Id: I1358e1ae49d03544a961515b97b115a488434e27
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
include/ringbuffer/frontend_types.h
src/lib/ringbuffer/ring_buffer_frontend.c
src/lttng-events.c

index 65782ea776cefd67d44d7eaead57181048c33a97..7e50da162538a612f42544c9ea4d55d6e86f3535 100644 (file)
@@ -71,6 +71,7 @@ struct lttng_kernel_ring_buffer_channel {
        int finalized;                          /* Has channel been finalized */
        struct channel_iter iter;               /* Channel read-side iterator */
        struct kref ref;                        /* Reference count */
+       int been_active;                        /* Tracing was started at least once */
 };
 
 /* Per-subbuffer commit counters used on the hot path */
index df0705cbd4245f1f2221a00ed41e9884f7c1a5a6..32fc88bab6264e718baf282130bd730d6e7a74ae 100644 (file)
@@ -1512,7 +1512,13 @@ void lib_ring_buffer_print_buffer_errors(struct lttng_kernel_ring_buffer *buf,
         */
        write_offset = v_read(config, &buf->offset);
        cons_offset = atomic_long_read(&buf->consumed);
-       if (write_offset != cons_offset)
+
+       /*
+        * Only print errors if the session associated with the buffer has been
+        * active, otherwise destroying an un-started session results in errors
+        * because of the un-consumed packet header present in the buffer.
+        */
+       if (chan->been_active && write_offset != cons_offset)
                printk(KERN_DEBUG
                       "LTTng: ring buffer %s, cpu %d: "
                       "non-consumed data\n"
index 95184984d27cc15721080da921a950fd7f4fb0c9..21d23d6632f9183cf5680736682f20e71bb717cd 100644 (file)
@@ -503,6 +503,8 @@ int lttng_session_enable(struct lttng_kernel_session *session)
                chan_buf_priv = container_of(chan_priv, struct lttng_kernel_channel_buffer_private, parent);
                if (chan_buf_priv->channel_type != METADATA_CHANNEL)
                        lib_ring_buffer_clear_quiescent_channel(chan_buf_priv->rb_chan);
+
+               WRITE_ONCE(chan_buf_priv->rb_chan->been_active, 1);
        }
 
        WRITE_ONCE(session->active, 1);
This page took 0.029744 seconds and 4 git commands to generate.