From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
Ian Rogers <irogers@google.com>
Subject: Re: [PATCH v13 4/4] ring-buffer: Add persistent ring buffer selftest
Date: Mon, 30 Mar 2026 10:42:52 +0900 [thread overview]
Message-ID: <20260330104252.2dd5b8a96120996fdec69fe8@kernel.org> (raw)
In-Reply-To: <20260327162508.6cac690c@gandalf.local.home>
On Fri, 27 Mar 2026 16:25:08 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:
> On Wed, 25 Mar 2026 11:25:25 +0900
> "Masami Hiramatsu (Google)" <mhiramat@kernel.org> wrote:
>
> > From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
> >
> > Add a self-destractive test for the persistent ring buffer. This
> > will invalidate some sub-buffer pages in the persistent ring buffer
> > when kernel gets panic, and check whether the number of detected
> > invalid pages and the total entry_bytes are the same as record
> > after reboot.
> >
> > This can ensure the kernel correctly recover partially corrupted
> > persistent ring buffer when boot.
> >
> > The test only runs on the persistent ring buffer whose name is
> > "ptracingtest". And user has to fill it up with events before
> > kernel panics.
> >
> > To run the test, enable CONFIG_RING_BUFFER_PERSISTENT_SELFTEST
>
> I think a more appropriate config name would be:
>
> CONFIG_PERSISTENT_RING_BUFFER_ERROR_INJECT
>
> as that's what it is doing as it is only testing error injection and not
> the persistent ring buffer.
OK, selftest will be another implementation.
(preparing buffer with test data and check recovery process?)
>
> > and you have to setup the kernel cmdline;
> >
> > reserve_mem=20M:2M:trace trace_instance=ptracingtest^traceoff@trace
> > panic=1
> >
> > And run following commands after the 1st boot;
> >
> > cd /sys/kernel/tracing/instances/ptracingtest
> > echo 1 > tracing_on
> > echo 1 > events/enable
> > sleep 3
> > echo c > /proc/sysrq-trigger
>
> These instructions should probably be in the CONFIG help message.
OK. I'll add it.
>
> >
> > After panic message, the kernel will reboot and run the verification
> > on the persistent ring buffer, e.g.
> >
> > Ring buffer meta [2] invalid buffer page detected
> > Ring buffer meta [2] is from previous boot! (318 pages discarded)
> > Ring buffer testing [2] invalid pages: PASSED (318/318)
> > Ring buffer testing [2] entry_bytes: PASSED (1300476/1300476)
>
> BTW, when I tested this, I got the above on the first boot, but if I
> rebooted normally without re-enabling the persistent ring buffer, I would
> get on the next boot:
Hmm, since it is already recovered (rewound) the 2nd rewound process
may not work correctly. Let me fix it.
>
>
> [ 0.966510] Ring buffer meta [2] is from previous boot! (0 pages discarded)
> [ 0.971338] #2
> [ 1.003431] Ring buffer meta [3] is from previous boot! (0 pages discarded)
> [ 1.007737] #3
> [ 1.039091] Ring buffer meta [4] is from previous boot! (0 pages discarded)
> [ 1.043181] Ring buffer testing [4] invalid pages: FAILED (0/1597)
> [ 1.044660] Ring buffer testing [4] entry_bytes: PASSED (6512464/6512464)
> [ 1.047829] #4
> [ 1.079811] Ring buffer meta [5] is from previous boot! (0 pages discarded)
> [ 1.083728] #5
> [ 1.116764] Ring buffer meta [6] is from previous boot! (0 pages discarded)
> [ 1.120846] #6
> [ 1.156502] Ring buffer meta [7] is from previous boot! (0 pages discarded)
> [ 1.160857] #7
>
> I'll start testing the previous 3 patches and may add them to next.
Thanks,
>
> Also, I noticed that there's nothing that reads the RB_MISSING as I thought
> it might. I'll have to look into how to pass that info to the trace output.
>
> -- Steve
>
--
Masami Hiramatsu (Google) <mhiramat@kernel.org>
prev parent reply other threads:[~2026-03-30 1:42 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-25 2:24 [PATCH v13 0/4] ring-buffer: Making persistent ring buffers robust Masami Hiramatsu (Google)
2026-03-25 2:25 ` [PATCH v13 1/4] ring-buffer: Flush and stop persistent ring buffer on panic Masami Hiramatsu (Google)
2026-03-25 2:25 ` [PATCH v13 2/4] ring-buffer: Skip invalid sub-buffers when validating persistent ring buffer Masami Hiramatsu (Google)
2026-03-25 2:25 ` [PATCH v13 3/4] ring-buffer: Skip invalid sub-buffers when rewinding " Masami Hiramatsu (Google)
2026-03-25 2:25 ` [PATCH v13 4/4] ring-buffer: Add persistent ring buffer selftest Masami Hiramatsu (Google)
2026-03-27 20:25 ` Steven Rostedt
2026-03-27 20:47 ` Steven Rostedt
2026-03-30 1:42 ` Masami Hiramatsu [this message]
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=20260330104252.2dd5b8a96120996fdec69fe8@kernel.org \
--to=mhiramat@kernel.org \
--cc=irogers@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=rostedt@goodmis.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