Re: [PATCH v14 2/5] ring-buffer: Skip invalid sub-buffers when validating persistent ring buffer
From: Steven Rostedt
Date: Mon Mar 30 2026 - 16:27:50 EST
On Mon, 30 Mar 2026 16:22:10 -0400
Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:
> On Mon, 30 Mar 2026 21:50:04 +0900
> "Masami Hiramatsu (Google)" <mhiramat@xxxxxxxxxx> wrote:
>
> > @@ -2042,7 +2065,8 @@ static void rb_meta_validate_events(struct ring_buffer_per_cpu *cpu_buffer)
> > local_set(&cpu_buffer->entries, entries);
> > local_set(&cpu_buffer->entries_bytes, entry_bytes);
> >
> > - pr_info("Ring buffer meta [%d] is from previous boot!\n", cpu_buffer->cpu);
> > + pr_info("Ring buffer meta [%d] is from previous boot! (%d pages discarded)\n",
> > + cpu_buffer->cpu, discarded);
>
> As pages should never be discarded unless something went wrong, let's only
> print that if there were discarded pages.
>
> if (discarded) {
> pr_info("Ring buffer meta [%d] is from previous boot! (%d pages discarded)\n",
> cpu_buffer->cpu, discarded);
> } else {
> pr_info("Ring buffer meta [%d] is from previous boot!\n", cpu_buffer->cpu);
> }
Or perhaps:
pr_info("Ring buffer meta [%d] is from previous boot!", cpu_buffer->cpu);
if (discarded)
pr_cont(" (%d pages discarded)", discarded);
pr_cont("\n");
-- Steve