On Tue, Mar 31, 2026 at 05:36:06PM +0900, Masami Hiramatsu (Google) wrote: > From: Masami Hiramatsu (Google) <[email protected]> > > On real hardware, panic and machine reboot may not flush hardware cache > to memory. This means the persistent ring buffer, which relies on a > coherent state of memory, may not have its events written to the buffer > and they may be lost. Moreover, there may be inconsistency with the > counters which are used for validation of the integrity of the > persistent ring buffer which may cause all data to be discarded. > > To avoid this issue, stop recording of the ring buffer on panic and > flush the cache of the ring buffer's memory. > > Fixes: e645535a954a ("tracing: Add option to use memmapped memory for trace > boot instance") > Cc: [email protected] > Signed-off-by: Masami Hiramatsu (Google) <[email protected]> [...] > diff --git a/arch/arm64/include/asm/ring_buffer.h > b/arch/arm64/include/asm/ring_buffer.h > new file mode 100644 > index 000000000000..62316c406888 > --- /dev/null > +++ b/arch/arm64/include/asm/ring_buffer.h > @@ -0,0 +1,10 @@ > +/* SPDX-License-Identifier: GPL-2.0-only */ > +#ifndef _ASM_ARM64_RING_BUFFER_H > +#define _ASM_ARM64_RING_BUFFER_H > + > +#include <asm/cacheflush.h> > + > +/* Flush D-cache on persistent ring buffer */ > +#define arch_ring_buffer_flush_range(start, end) dcache_clean_pop(start, > end) > + > +#endif /* _ASM_ARM64_RING_BUFFER_H */
Adding Robin as he wrote the pmem support for arm64. I assume the ring buffer here is cacheable memory, otherwise we'd also need a dmb(osh) as in arch_wb_cache_pmem(). If that's correct: Acked-by: Catalin Marinas <[email protected]>
