# Re: \[PATCH v14 2/5\] ring-buffer: Skip invalid sub-buffers when validating persistent ring buffer

- From: Steven Rostedt \<rostedt@goodmis.org\>
- Date: 2026-03-30 20:27:34 
- List: linux-trace-kernel
- Page: https://ratatoskr.run/linux-trace-kernel/2026/03/3489608
- Thread: https://ratatoskr.run/linux-trace-kernel/2026/03/3488676/t.md

```text
On Mon, 30 Mar 2026 16:22:10 -0400
Steven Rostedt [ref] wrote:

> On Mon, 30 Mar 2026 21:50:04 +0900
> "Masami Hiramatsu (Google)" [ref] 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

```
