mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Jerome Marchand <jmarchan@redhat.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>,
	Nicholas Piggin <npiggin@gmail.com>,
	Christophe Leroy <chleroy@kernel.org>,
	Ritesh Harjani <ritesh.list@gmail.com>,
	Shrikanth Hegde <sshegde@linux.ibm.com>,
	Madhavan Srinivasan <maddy@linux.vnet.ibm.com>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] powerpc: Use raw_local_irq_pmu_save/restore() in local_t functions
Date: Fri, 23 Oct 2026 13:09:43 -0400	[thread overview]
Message-ID: <20261023130943.775b2b65@gandalf.local.home> (raw)
In-Reply-To: <20261023155529.3895393-1-jmarchan@redhat.com>

On Fri, 23 Oct 2026 17:55:29 +0200
Jerome Marchand <jmarchan@redhat.com> 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	other threads:[~2026-10-23 17:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-23 15:55 Jerome Marchand
2026-10-23 17:09 ` Steven Rostedt [this message]
2026-10-23 19:11   ` Jerome Marchand
2026-10-23 20:02     ` Steven Rostedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261023130943.775b2b65@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=chleroy@kernel.org \
    --cc=jmarchan@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=maddy@linux.vnet.ibm.com \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mhiramat@kernel.org \
    --cc=mpe@ellerman.id.au \
    --cc=npiggin@gmail.com \
    --cc=ritesh.list@gmail.com \
    --cc=sshegde@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®