All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vincent Donnefort <vdonnefort@google.com>
To: Christian Aurich Zanettini Martins <christian.aurichzm@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	Thomas Gleixner <tglx@kernel.org>,
	linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org,
	syzbot+fbe07bcf949966f3c00f@syzkaller.appspotmail.com
Subject: Re: [PATCH] ring-buffer: Do not WARN when trace_rb_cpu_prepare() fails to allocate
Date: Mon, 9 Nov 2026 09:29:46 +0000	[thread overview]
Message-ID: <avGSispr9aIXliex@google.com> (raw)
In-Reply-To: <20261104222558.863948-1-christian.aurichzm@gmail.com>

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

  reply	other threads:[~2026-11-09  9:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2026-11-09 10:38   ` Christian Aurich Zanettini Martins
2026-11-10  9:25     ` Steven Rostedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=avGSispr9aIXliex@google.com \
    --to=vdonnefort@google.com \
    --cc=bigeasy@linutronix.de \
    --cc=christian.aurichzm@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mhiramat@kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=syzbot+fbe07bcf949966f3c00f@syzkaller.appspotmail.com \
    --cc=tglx@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.