mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [for-linus][PATCH] ring-buffer: Add missing cnt increment for remote ring buffers
@ 2026-11-27 22:14 Steven Rostedt
  0 siblings, 0 replies; only message in thread
From: Steven Rostedt @ 2026-11-27 22:14 UTC (permalink / raw)
  To: LKML; +Cc: Masami Hiramatsu, Mathieu Desnoyers, Vincent Donnefort


  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;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-27 22:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-27 22:14 [for-linus][PATCH] ring-buffer: Add missing cnt increment for remote ring buffers 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®