Re: [PATCH 0/3] probes: Use trace_printk() in probe handlers
From: Steven Rostedt
Date: Tue Nov 03 2026 - 09:19:52 EST
On Tue, 3 Nov 2026 12:11:47 +0100
Petr Mladek <pmladek@xxxxxxxx> wrote:
> I believe that trace_printk() has a similar problem. You could
> not use it inside the code used by trace_printk() because
> it might cause an unbound recursion.
That is slightly incorrect. I use trace_printk() to debug tracing! ;-)
Well, adding trace_printk() to the trace_printk() function itself will have
issues, but the ring buffer logic allows trace_printk() to be injected into
it. The ring buffer has recursion protection, so adding trace_printk() into
the ftrace ring buffer will print the trace_printk(). You may need to add a
way to not do the trace_printk() again, otherwise you may get multiple
prints until the nested limit is reached.
But I just wanted to point out that I do use trace_printk() to debug the
ring buffer even though trace_printk itself uses the ring buffer too.
-- Steve