Linux Trace Kernel
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@kernel.org>
To: "Masami Hiramatsu (Google)" <mhiramat@kernel.org>
Cc: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
	Mark Rutland <mark.rutland@arm.com>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Ian Rogers <irogers@google.com>
Subject: Re: [PATCH v21 8/9] ring-buffer: Show persistent buffer dropped events in trace file
Date: Thu, 28 May 2026 11:26:55 -0400	[thread overview]
Message-ID: <20260528112655.0b71b71f@gandalf.local.home> (raw)
In-Reply-To: <20260529001500.14178455a046a5cbc6180861@kernel.org>

On Fri, 29 May 2026 00:15:00 +0900
Masami Hiramatsu (Google) <mhiramat@kernel.org> wrote:

> Yeah, the relationship between the persistent ring buffer (which is mapped)
> and the RB_MISSED_EVENTS is a bit unclear.

I'm going to pull these patches into the ring-buffer for-next branch and
start testing it. If they pass, I'll push them up to the linux-trace repo.

I'll send out this patch on top of it.

diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index 910f6b3adf74..5de6f352249a 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -1929,6 +1929,12 @@ static int __rb_validate_buffer(struct buffer_page *bpage, int cpu,
 	 */
 	if (ret < 0 || (prev_ts && prev_ts > ts) || (next_ts && ts > next_ts)) {
 		local_set(&bpage->entries, 0);
+		/*
+		 * Note, the RB_MISSED_EVENTS is only set inside the main write
+		 * buffer by this verification logic. The normal ring buffer
+		 * has this bit set when the page is read and passed to the
+		 * consumers.
+		 */
 		local_set(&dpage->commit, RB_MISSED_EVENTS);
 		dpage->time_stamp = prev_ts ? prev_ts : next_ts;
 		ret = -1;
@@ -7232,6 +7238,14 @@ int ring_buffer_read_page(struct trace_buffer *buffer,
 			local_add(RB_MISSED_STORED, &dpage->commit);
 			size += sizeof(missed_events);
 		}
+		/*
+		 * Note, for the persistent ring buffer, the RB_MISSED_EVENTS
+		 * may have been set in the main buffer via the verification code.
+		 * But here, dpage is a copy of that page and has not yet had
+		 * the RB_MISSED_EVENTS set. As for the normal buffers,
+		 * the main write buffer does not set these bits and it needs
+		 * to be set here.
+		 */
 		local_add(RB_MISSED_EVENTS, &dpage->commit);
 	}
 


-- Steve

  reply	other threads:[~2026-05-28 15:26 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-22 17:08 [PATCH v21 0/9] ring-buffer: Making persistent ring buffers robust Steven Rostedt
2026-05-22 17:08 ` [PATCH v21 1/9] ring-buffer: Skip invalid sub-buffers when validating persistent ring buffer Steven Rostedt
2026-05-22 17:08 ` [PATCH v21 2/9] ring-buffer: Skip invalid sub-buffers when rewinding " Steven Rostedt
2026-05-22 17:09 ` [PATCH v21 3/9] ring-buffer: Add persistent ring buffer invalid-page inject test Steven Rostedt
2026-05-22 17:09 ` [PATCH v21 4/9] ring-buffer: Show commit numbers in buffer_meta file Steven Rostedt
2026-05-22 17:09 ` [PATCH v21 5/9] ring-buffer: Cleanup persistent ring buffer validation Steven Rostedt
2026-05-22 17:09 ` [PATCH v21 6/9] ring-buffer: Cleanup buffer_data_page related code Steven Rostedt
2026-05-22 17:09 ` [PATCH v21 7/9] ring-buffer: Have dropped subbuffers be persistent across reboots Steven Rostedt
2026-05-22 17:09 ` [PATCH v21 8/9] ring-buffer: Show persistent buffer dropped events in trace file Steven Rostedt
2026-05-26  5:06   ` Masami Hiramatsu
2026-05-26 17:41     ` Steven Rostedt
2026-05-27  3:47       ` Masami Hiramatsu
2026-05-27 13:35         ` Steven Rostedt
2026-05-28 15:15           ` Masami Hiramatsu
2026-05-28 15:26             ` Steven Rostedt [this message]
2026-05-22 17:09 ` [PATCH v21 9/9] ring-buffer: Show persistent buffer dropped events in trace_pipe file Steven Rostedt
2026-05-26  6:06   ` Masami Hiramatsu
2026-05-26  5:17 ` [PATCH v21 0/9] ring-buffer: Making persistent ring buffers robust Masami Hiramatsu
2026-05-26 17:42   ` Steven Rostedt
2026-05-27  3:57     ` Masami Hiramatsu

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=20260528112655.0b71b71f@gandalf.local.home \
    --to=rostedt@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=irogers@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mhiramat@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox