Re: [PATCH] tracing/events: Expand ring buffer for in-kernel event enables
From: Steven Rostedt
Date: Tue Jun 02 2026 - 09:00:13 EST
On Mon, 1 Jun 2026 16:24:43 -0700
Manjunath Patil <manjunath.b.patil@xxxxxxxxxx> wrote:
> Ftrace keeps trace arrays at a boot-minimum ring-buffer size until
> tracing is used. Tracefs event-enable paths already call
> tracing_update_buffers() before enabling events, but the exported
> in-kernel helpers trace_set_clr_event() and trace_array_set_clr_event()
> directly enable events through __ftrace_set_clr_event().
>
> This can leave events enabled by in-kernel users recording into the tiny
> boot-minimum buffer instead of the configured default-sized buffer. Any
> caller that enables events through these exported helpers observes
> different buffer-expansion behavior than a userspace tracefs event enable.
>
> Expand the relevant trace array before enabling events through the
> exported in-kernel helpers, matching the tracefs event-enable behavior.
> Disabling events remains unchanged.
The above explains everything correctly, but you left out what needs this?
Internal code should not be using the main ring buffer except for
debugging, in which case you can use trace_printk(), which will cause the
tracing buffers to be expanded by default.
Other areas of the kernel should create their own trace array which will be
created expanded by default too.
-- Steve