From: Steven Rostedt <rostedt@goodmis.org>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Masami Hiramatsu <mhiramat@kernel.org>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Vincent Donnefort <vdonnefort@google.com>
Subject: [for-linus][PATCH] ring-buffer: Add missing cnt increment for remote ring buffers
Date: Fri, 27 Nov 2026 17:14:08 -0500 [thread overview]
Message-ID: <20261127171408.0d804b05@gandalf.local.home> (raw)
git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.git
trace/fixes
Head SHA1: 76a0a6d58318fff8b14530ed9b99c7065995db29
Vincent Donnefort (1):
ring-buffer: Add missing cnt increment for remote ring buffers
----
kernel/trace/ring_buffer.c | 1 +
1 file changed, 1 insertion(+)
---------------------------
commit 76a0a6d58318fff8b14530ed9b99c7065995db29
Author: Vincent Donnefort <vdonnefort@google.com>
Date: Tue Nov 17 15:15:20 2026 +0000
ring-buffer: Add missing cnt increment for remote ring buffers
The ring_buffer_per_cpu::cnt member tracks modifications to the ring
buffer links. It was introduced for rb_check_pages() to avoid locking
the ring buffer for the entire duration of the check. The reader page
swap function for remote ring buffers does not update it. If a
concurrent rb_check_pages() recorded a page as head before dropping the
reader lock, it misses the list update and loops indefinitely. Add the
missing increment.
Cc: stable@vger.kernel.org
Fixes: fbd1743ecba1 ("ring-buffer: Add non-consuming read for ring-buffer remotes")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Link: https://patch.msgid.link/20261117151520.3972146-1-vdonnefort@google.com
Signed-off-by: Vincent Donnefort <vdonnefort@google.com>
[ rebased to v7.4-rc4 as there were conflicts ]
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index a5a0adc934fa..65dddfac5e04 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -5891,6 +5891,7 @@ __rb_get_reader_page_from_remote(struct ring_buffer_per_cpu *cpu_buffer)
cpu_buffer->pages = &new_head->list;
cpu_buffer->lost_events = cpu_buffer->meta_page->reader.lost_events;
local_inc(&cpu_buffer->pages_read);
+ cpu_buffer->cnt++;
if (!rb_page_size(cpu_buffer->reader_page))
return NULL;
reply other threads:[~2026-11-27 22:14 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20261127171408.0d804b05@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
--cc=vdonnefort@google.com \
/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 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®