On Fri, 23 Oct 2026 17:55:29 +0200
Jerome Marchand <[email protected]> wrote:

> On ppc64 with CONFIG_TRACE_IRQFLAGS enabled, the ring buffer code can
> enter in an infinite recursion loop.
> 
> The problem occurs because some PowerPC's local_t operations
> (local_inc/dec in particular) use powerpc_local_irq_pmu_save/restore()
> which call trace_hardirqs_on/off() to generate trace events. This
> creates a recursion loop:
> 
>   ring_buffer_unlock_commit()
>     rb_commit()
>       local_inc(&cpu_buffer->entries)
>         powerpc_local_irq_pmu_save()
>           trace_hardirqs_off()
>             trace event => ring_buffer_unlock_commit()
>               [INFINITE RECURSION]

Hmm, the ring buffer has recursion protection that should prevent this. My
question is, why didn't that work? Yes, I agree with the patch to not have
local_inc/dec() call anything that can be traced, but if this caused an
infinite recursion, there's a bug in the ring buffer code I want fixed too.

The ring buffer has a trace_recursive_lock() that will allow one level of
recursion and then prevents new commits from happening. The
trace_recursive_unlock() is called after the rb_commit(). Why did the
rb_commit() allow an infinite recursion?

-- Steve

Reply via email to