On Mon, 30 Mar 2026 21:50:20 +0900
"Masami Hiramatsu (Google)" [off-list ref] wrote:
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Reset RB_MISSED_* flags when the persistent ring buffer is
validated at boot. Since these flags are used only in reading
process, such process should be stopped when reboot and never
be restarted. Thus, these flags are meaningless in the next
boot. Moreover, it can confuse the read process after reboot.
Is it meaningless on a second boot?
Let's say you have a crash, and there's an invalid buffer. On the next boot
it is flagged as invalid with the RB_MISSED flag. But then you reboot again
before looking at the buffer. The next boot will clear this flag. Now
looking at the persistent ring buffer will not show any missed events.
Ideally, it shouldn't matter how many reboots are made. If the persistent
ring buffer hasn't started again, it should always show the same output.
-- Steve
quoted hunk ↗ jump to hunk
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
---
Changes in v14:
- Newly added.
---
kernel/trace/ring_buffer.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index e5178239f2f9..5049cf13021e 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -1903,6 +1903,7 @@ static int rb_validate_buffer(struct buffer_page *bpage, int cpu,
local_set(&bpage->page->commit, 0);
} else {
local_set(&bpage->entries, ret);
+ local_set(&bpage->page->commit, tail);
}
return ret;