* [PATCH] ring-buffer: Do not WARN when trace_rb_cpu_prepare() fails to allocate
@ 2026-11-04 22:25 Christian Aurich Zanettini Martins
2026-11-09 9:29 ` Vincent Donnefort
0 siblings, 1 reply; 4+ messages in thread
From: Christian Aurich Zanettini Martins @ 2026-11-04 22:25 UTC (permalink / raw)
To: Steven Rostedt
Cc: Masami Hiramatsu, Mathieu Desnoyers, Vincent Donnefort,
Sebastian Andrzej Siewior, Thomas Gleixner, linux-trace-kernel,
linux-kernel, Christian Aurich Zanettini Martins,
syzbot+fbe07bcf949966f3c00f
Creating a tracing instance allocates the buffers of the other CPUs
through trace_rb_cpu_prepare(), which WARNs if the allocation fails.
But __rb_allocate_pages() bails out on purpose when si_mem_available()
is too low or the task gets killed, so a mkdir in instances/ with a
large trace_buf_size is enough to trigger it:
WARNING: kernel/trace/ring_buffer.c:8094 at trace_rb_cpu_prepare+0xf1/0x100
The same failure for the current CPU, or in ring_buffer_resize(), just
returns -ENOMEM. Use pr_warn() here instead.
Fixes: b32614c03413 ("tracing/rb: Convert to hotplug state machine")
Reported-by: syzbot+fbe07bcf949966f3c00f@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/all/6a707c4f.13bfb6d0.1ecdd5.027e.GAE@google.com/
Signed-off-by: Christian Aurich Zanettini Martins <christian.aurichzm@gmail.com>
---
Notes:
Tested in QEMU on 05441d697f7f (4 CPUs, 1G, trace_buf_size=350M): mkdir
in instances/ WARNs every time before and only prints the message after.
Same with a mkdir killed during the allocation.
kernel/trace/ring_buffer.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index 1fd28a72e6ee..c018559ad61a 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -8091,8 +8091,7 @@ int trace_rb_cpu_prepare(unsigned int cpu, struct hlist_node *node)
buffer->buffers[cpu] =
rb_allocate_cpu_buffer(buffer, nr_pages, cpu);
if (!buffer->buffers[cpu]) {
- WARN(1, "failed to allocate ring buffer on CPU %u\n",
- cpu);
+ pr_warn("failed to allocate ring buffer on CPU %u\n", cpu);
return -ENOMEM;
}
--
2.43.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ring-buffer: Do not WARN when trace_rb_cpu_prepare() fails to allocate
2026-11-04 22:25 [PATCH] ring-buffer: Do not WARN when trace_rb_cpu_prepare() fails to allocate Christian Aurich Zanettini Martins
@ 2026-11-09 9:29 ` Vincent Donnefort
2026-11-09 10:38 ` Christian Aurich Zanettini Martins
0 siblings, 1 reply; 4+ messages in thread
From: Vincent Donnefort @ 2026-11-09 9:29 UTC (permalink / raw)
To: Christian Aurich Zanettini Martins
Cc: Steven Rostedt, Masami Hiramatsu, Mathieu Desnoyers,
Sebastian Andrzej Siewior, Thomas Gleixner, linux-trace-kernel,
linux-kernel, syzbot+fbe07bcf949966f3c00f
On Wed, Nov 04, 2026 at 07:25:58PM -0300, Christian Aurich Zanettini Martins wrote:
> Creating a tracing instance allocates the buffers of the other CPUs
> through trace_rb_cpu_prepare(), which WARNs if the allocation fails.
> But __rb_allocate_pages() bails out on purpose when si_mem_available()
> is too low or the task gets killed, so a mkdir in instances/ with a
> large trace_buf_size is enough to trigger it:
>
> WARNING: kernel/trace/ring_buffer.c:8094 at trace_rb_cpu_prepare+0xf1/0x100
>
> The same failure for the current CPU, or in ring_buffer_resize(), just
> returns -ENOMEM. Use pr_warn() here instead.
>
> Fixes: b32614c03413 ("tracing/rb: Convert to hotplug state machine")
> Reported-by: syzbot+fbe07bcf949966f3c00f@syzkaller.appspotmail.com
> Closes: https://lore.kernel.org/all/6a707c4f.13bfb6d0.1ecdd5.027e.GAE@google.com/
> Signed-off-by: Christian Aurich Zanettini Martins <christian.aurichzm@gmail.com>
> ---
I do not believe Steven is keen on this change [1]
[1] https://lore.kernel.org/all/20260806174638.6012fa24@gandalf.local.home/
>
> Notes:
> Tested in QEMU on 05441d697f7f (4 CPUs, 1G, trace_buf_size=350M): mkdir
> in instances/ WARNs every time before and only prints the message after.
> Same with a mkdir killed during the allocation.
>
> kernel/trace/ring_buffer.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
> index 1fd28a72e6ee..c018559ad61a 100644
> --- a/kernel/trace/ring_buffer.c
> +++ b/kernel/trace/ring_buffer.c
> @@ -8091,8 +8091,7 @@ int trace_rb_cpu_prepare(unsigned int cpu, struct hlist_node *node)
> buffer->buffers[cpu] =
> rb_allocate_cpu_buffer(buffer, nr_pages, cpu);
> if (!buffer->buffers[cpu]) {
> - WARN(1, "failed to allocate ring buffer on CPU %u\n",
> - cpu);
> + pr_warn("failed to allocate ring buffer on CPU %u\n", cpu);
> return -ENOMEM;
> }
>
> --
> 2.43.0
>
--
Vincent
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ring-buffer: Do not WARN when trace_rb_cpu_prepare() fails to allocate
2026-11-09 9:29 ` Vincent Donnefort
@ 2026-11-09 10:38 ` Christian Aurich Zanettini Martins
2026-11-10 9:25 ` Steven Rostedt
0 siblings, 1 reply; 4+ messages in thread
From: Christian Aurich Zanettini Martins @ 2026-11-09 10:38 UTC (permalink / raw)
To: Vincent Donnefort
Cc: Steven Rostedt, Masami Hiramatsu, Mathieu Desnoyers,
Sebastian Andrzej Siewior, Thomas Gleixner, linux-trace-kernel,
linux-kernel, syzbot+fbe07bcf949966f3c00f
Thanks Vincent. I took that reply as Steven explaining where the warning
comes from, but I may have misread it.
Steven, the same si_mem_available() check fails silently for the current
CPU in alloc_buffer(), so whether mkdir WARNs or just returns -ENOMEM
depends on which CPU runs out first. If you'd rather keep the WARN I'll
drop this.
Em seg., 9 de nov. de 2026 às 06:29, Vincent Donnefort
<vdonnefort@google.com> escreveu:
>
> On Wed, Nov 04, 2026 at 07:25:58PM -0300, Christian Aurich Zanettini Martins wrote:
> > Creating a tracing instance allocates the buffers of the other CPUs
> > through trace_rb_cpu_prepare(), which WARNs if the allocation fails.
> > But __rb_allocate_pages() bails out on purpose when si_mem_available()
> > is too low or the task gets killed, so a mkdir in instances/ with a
> > large trace_buf_size is enough to trigger it:
> >
> > WARNING: kernel/trace/ring_buffer.c:8094 at trace_rb_cpu_prepare+0xf1/0x100
> >
> > The same failure for the current CPU, or in ring_buffer_resize(), just
> > returns -ENOMEM. Use pr_warn() here instead.
> >
> > Fixes: b32614c03413 ("tracing/rb: Convert to hotplug state machine")
> > Reported-by: syzbot+fbe07bcf949966f3c00f@syzkaller.appspotmail.com
> > Closes: https://lore.kernel.org/all/6a707c4f.13bfb6d0.1ecdd5.027e.GAE@google.com/
> > Signed-off-by: Christian Aurich Zanettini Martins <christian.aurichzm@gmail.com>
> > ---
>
> I do not believe Steven is keen on this change [1]
>
> [1] https://lore.kernel.org/all/20260806174638.6012fa24@gandalf.local.home/
>
> >
> > Notes:
> > Tested in QEMU on 05441d697f7f (4 CPUs, 1G, trace_buf_size=350M): mkdir
> > in instances/ WARNs every time before and only prints the message after.
> > Same with a mkdir killed during the allocation.
> >
> > kernel/trace/ring_buffer.c | 3 +--
> > 1 file changed, 1 insertion(+), 2 deletions(-)
> >
> > diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
> > index 1fd28a72e6ee..c018559ad61a 100644
> > --- a/kernel/trace/ring_buffer.c
> > +++ b/kernel/trace/ring_buffer.c
> > @@ -8091,8 +8091,7 @@ int trace_rb_cpu_prepare(unsigned int cpu, struct hlist_node *node)
> > buffer->buffers[cpu] =
> > rb_allocate_cpu_buffer(buffer, nr_pages, cpu);
> > if (!buffer->buffers[cpu]) {
> > - WARN(1, "failed to allocate ring buffer on CPU %u\n",
> > - cpu);
> > + pr_warn("failed to allocate ring buffer on CPU %u\n", cpu);
> > return -ENOMEM;
> > }
> >
> > --
> > 2.43.0
> >
>
> --
> Vincent
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ring-buffer: Do not WARN when trace_rb_cpu_prepare() fails to allocate
2026-11-09 10:38 ` Christian Aurich Zanettini Martins
@ 2026-11-10 9:25 ` Steven Rostedt
0 siblings, 0 replies; 4+ messages in thread
From: Steven Rostedt @ 2026-11-10 9:25 UTC (permalink / raw)
To: Christian Aurich Zanettini Martins
Cc: Vincent Donnefort, Masami Hiramatsu, Mathieu Desnoyers,
Sebastian Andrzej Siewior, Thomas Gleixner, linux-trace-kernel,
linux-kernel, syzbot+fbe07bcf949966f3c00f
On Mon, 9 Nov 2026 07:38:55 -0300
Christian Aurich Zanettini Martins <christian.aurichzm@gmail.com> wrote:
> Thanks Vincent. I took that reply as Steven explaining where the warning
> comes from, but I may have misread it.
>
> Steven, the same si_mem_available() check fails silently for the current
> CPU in alloc_buffer(), so whether mkdir WARNs or just returns -ENOMEM
> depends on which CPU runs out first. If you'd rather keep the WARN I'll
> drop this.
Actually, because of the CPU coming on line (not the instances) I
pulled it into my test queue. I'm currently traveling so I haven't
pushed things up yet. But patchwork has updated the status[1] of this to
"Under review" which means it's in the testing process.
-- Steve
[1] https://patchwork.kernel.org/m/20261104222558.863948-1-christian.aurichzm@gmail.com/
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-11-10 9:25 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-04 22:25 [PATCH] ring-buffer: Do not WARN when trace_rb_cpu_prepare() fails to allocate Christian Aurich Zanettini Martins
2026-11-09 9:29 ` Vincent Donnefort
2026-11-09 10:38 ` Christian Aurich Zanettini Martins
2026-11-10 9:25 ` Steven Rostedt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®