Re: [PATCH] tracing: Move snapshot code out of trace.c and into trace_snapshot.c
From: Arnd Bergmann
Date: Tue Mar 31 2026 - 07:00:46 EST
On Mon, Mar 30, 2026, at 18:05, Steven Rostedt wrote:
> On Mon, 30 Mar 2026 16:06:44 +0200 "Arnd Bergmann" <arnd@xxxxxxxx> wrote:
>
>> I saw the same thing and worked around it by removing the function.
>> I then noticed that a bunch of code surrounding it is also unused
>> and I removed that as well (see below). This version passes
>> my randconfig build tests, but I suspect it is still wrong,
>> since the code never had any callers and I don't understand
>> why.
>
> Note, this code is in include/linux/tracing_printk.h, and is for debugging
> purposes (just like trace_printk() is). Hence, it shouldn't be removed.
>
> The purpose is to call tracing_snapshot() when your code detects something
> isn't right (but it doesn't crash), and this will take a snapshot of the
> current trace that lead up to the anomaly.
Right, I assumed it had to be something like that, just didn't immediately
see what. I've sent a patch to just remove the duplicate inline
function now.
> If anything, I should add more to Documentation/trace/debugging.rst about it.
Or maybe a samples module that serves to show how the interface
gets used?
Arnd