]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
ring-buffer: Flush and stop persistent ring buffer on panic
authorMasami Hiramatsu (Google) <mhiramat@kernel.org>
Thu, 30 Apr 2026 03:28:16 +0000 (12:28 +0900)
committerSteven Rostedt <rostedt@goodmis.org>
Thu, 21 May 2026 12:20:58 +0000 (08:20 -0400)
commita494d3c8d5392bcdff83c2a593df0c160ff9f322
tree7ab498e9963e62f26cf1b0abda460b250ed5691b
parenta254b6d13b0edd6272926674d2afc46d46e496b7
ring-buffer: Flush and stop persistent ring buffer on panic

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: stable@vger.kernel.org
Cc: Will Deacon <will@kernel.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Ian Rogers <irogers@google.com>
Link: https://patch.msgid.link/177751969602.2136606.12031934362587643488.stgit@mhiramat.tok.corp.google.com
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
23 files changed:
arch/alpha/include/asm/Kbuild
arch/arc/include/asm/Kbuild
arch/arm/include/asm/Kbuild
arch/arm64/include/asm/ring_buffer.h [new file with mode: 0644]
arch/csky/include/asm/Kbuild
arch/hexagon/include/asm/Kbuild
arch/loongarch/include/asm/Kbuild
arch/m68k/include/asm/Kbuild
arch/microblaze/include/asm/Kbuild
arch/mips/include/asm/Kbuild
arch/nios2/include/asm/Kbuild
arch/openrisc/include/asm/Kbuild
arch/parisc/include/asm/Kbuild
arch/powerpc/include/asm/Kbuild
arch/riscv/include/asm/Kbuild
arch/s390/include/asm/Kbuild
arch/sh/include/asm/Kbuild
arch/sparc/include/asm/Kbuild
arch/um/include/asm/Kbuild
arch/x86/include/asm/Kbuild
arch/xtensa/include/asm/Kbuild
include/asm-generic/ring_buffer.h [new file with mode: 0644]
kernel/trace/ring_buffer.c