From: "Paul E. McKenney" <paulmck@kernel.org>
To: Doug Anderson <dianders@chromium.org>
Cc: "Cheng-Jui Wang (王正睿)" <Cheng-Jui.Wang@mediatek.com>,
"sumit.garg@linaro.org" <sumit.garg@linaro.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"rostedt@goodmis.org" <rostedt@goodmis.org>,
"frederic@kernel.org" <frederic@kernel.org>,
wsd_upstream <wsd_upstream@mediatek.com>,
"Bobule Chang (張弘義)" <bobule.chang@mediatek.com>,
"mark.rutland@arm.com" <mark.rutland@arm.com>,
"kernel-team@meta.com" <kernel-team@meta.com>,
"joel@joelfernandes.org" <joel@joelfernandes.org>,
"rcu@vger.kernel.org" <rcu@vger.kernel.org>
Subject: Re: [PATCH v3 rcu 3/3] rcu: Finer-grained grace-period-end checks in rcu_dump_cpu_stacks()
Date: Wed, 30 Oct 2024 16:26:30 -0700 [thread overview]
Message-ID: <63859e70-2ea7-4a67-857c-fa226566f25a@paulmck-laptop> (raw)
In-Reply-To: <CAD=FV=WBcOCGbD0haRYLGgAFpDhfoqMW8mvj9DEA0CSPHG3Owg@mail.gmail.com>
On Wed, Oct 30, 2024 at 01:12:01PM -0700, Doug Anderson wrote:
> Hi,
>
> On Wed, Oct 30, 2024 at 6:54 AM Paul E. McKenney <paulmck@kernel.org> wrote:
> >
> > > > We do assume that nmi_trigger_cpumask_backtrace() uses true NMIs, so,
> > > > yes, nmi_trigger_cpumask_backtrace() should use true NMIs, just like
> > > > the name says. ;-)
> > >
> > > In the comments of following patch, the arm64 maintainers have
> > > differing views on the use of nmi_trigger_cpumask_backtrace(). I'm a
> > > bit confused and unsure which perspective is more reasonable.
> > >
> > > https://lore.kernel.org/all/20230906090246.v13.4.Ie6c132b96ebbbcddbf6954b9469ed40a6960343c@changeid/
> >
> > I clearly need to have a chat with the arm64 maintainers, and thank
> > you for checking.
> >
> > > > /*
> > > > * NOTE: though nmi_trigger_cpumask_backtrace() has "nmi_" in the
> > > name,
> > > > * nothing about it truly needs to be implemented using an NMI, it's
> > > > * just that it's _allowed_ to work with NMIs. If ipi_should_be_nmi()
> > > > * returned false our backtrace attempt will just use a regular IPI.
> > > > */
> > >
> > > > Alternatively, arm64 could continue using nmi_trigger_cpumask_backtrace()
> > > > with normal interrupts (for example, on SoCs not implementing true NMIs),
> > > > but have a short timeout (maybe a few jiffies?) after which its returns
> > > > false (and presumably also cancels the backtrace request so that when
> > > > the non-NMI interrupt eventually does happen, its handler simply returns
> > > > without backtracing). This should be implemented using atomics to avoid
> > > > deadlock issues. This alternative approach would provide accurate arm64
> > > > backtraces in the common case where interrupts are enabled, but allow
> > > > a graceful fallback to remote tracing otherwise.
> > > >
> > > > Would you be interested in working this issue, whatever solution the
> > > > arm64 maintainers end up preferring?
> > >
> > > The 10-second timeout is hard-coded in nmi_trigger_cpumask_backtrace().
> > > It is shared code and not architecture-specific. Currently, I haven't
> > > thought of a feasible solution. I have also CC'd the authors of the
> > > aforementioned patch to see if they have any other ideas.
> >
> > It should be possible for arm64 to have an architecture-specific hook
> > that enables them to use a much shorter timeout. Or, to eventually
> > switch to real NMIs.
>
> Note that:
>
> * Switching to real NMIs is impossible on many existing arm64 CPUs.
> The hardware support simply isn't there. Pseudo-NMIs should work fine
> and are (in nearly all cases) just as good as NMIs but they have a
> small performance impact. There are also compatibility issues with
> some pre-existing bootloaders. ...so code can't assume even Pseudo-NMI
> will work and needs to be able to fall back. Prior to my recent
> changes arm64 CPUs wouldn't even do stacktraces in some scenarios. Now
> at least they fall back to regular IPIs.
But those IPIs are of no help whatsoever when the target CPU is spinning
with interrupts disabled, which is the scenario under discussion.
Hence my suggestion that arm64, when using IRQs to request stack
backtraces, have an additional short timeout (milliseconds) in
order to fall back to remote stack tracing. In many cases, this
fallback happens automatically, as you can see in dump_cpu_task().
If trigger_single_cpu_backtrace() returns false, the stack is dumped
remotely.
> * Even if we decided that we absolutely had to disable stacktrades on
> arm64 CPUs without some type of NMI, that won't fix arm32. arm32 has
> been using regular IPIs for backtraces like this for many, many years.
> Maybe folks don't care as much about arm32 anymore but it feels bad if
> we totally break it.
Because arm32 isn't used much for datacenter workloads, it will not
be suffering from this issue. Not enough to have motivated anyone to
fix it, anyway. In contrast, in the datacenter, CPUs really can and
do have interrupts disabled for many seconds. (No, this is not a good
thing, but it is common enough for us to need to avoid disabling other
debugging facilities.)
So it might well be that arm32 will continue to do just fine with
IRQ-based stack tracing. Or maybe someday arm32 will also need to deal
with this same issue. But no "maybe" for arm64, given its increasing
use in the datacenter.
> IMO waiting 10 seconds for a backtrace is pretty crazy to begin with.
> What about just changing that globally to 1 second? If not, it doesn't
> feel like it would be impossibly hard to make an arch-specific
> callback to choose the time and that callback could even take into
> account whether we managed to get an NMI. I'd be happy to review such
> a patch.
Let's please keep the 10-second timeout for NMI-based backtraces.
But I take it that you are not opposed to a shorter timeout for the
special case of IRQ-based stack backtrace requests?
Thanx, Paul
next prev parent reply other threads:[~2024-10-30 23:26 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-09 18:05 [PATCH rcu 0/3] RCU CPU stall-warning changes for v6.13 Paul E. McKenney
2024-10-09 18:05 ` [PATCH rcu 1/3] rcu: Delete unused rcu_gp_might_be_stalled() function Paul E. McKenney
2024-10-09 18:05 ` [PATCH rcu 2/3] rcu: Stop stall warning from dumping stacks if grace period ends Paul E. McKenney
2024-10-15 18:48 ` Joel Fernandes
2024-10-09 18:05 ` [PATCH rcu 3/3] rcu: Finer-grained grace-period-end checks in rcu_dump_cpu_stacks() Paul E. McKenney
2024-10-15 18:49 ` [PATCH rcu 0/3] RCU CPU stall-warning changes for v6.13 Joel Fernandes
2024-10-15 23:02 ` Paul E. McKenney
2024-10-16 0:01 ` Joel Fernandes
2024-10-16 16:18 ` [PATCH v2 " Paul E. McKenney
2024-10-16 16:19 ` [PATCH v2 rcu 1/3] rcu: Delete unused rcu_gp_might_be_stalled() function Paul E. McKenney
2024-10-16 16:19 ` [PATCH v2 rcu 2/3] rcu: Stop stall warning from dumping stacks if grace period ends Paul E. McKenney
2024-10-16 16:19 ` [PATCH v2 rcu 3/3] rcu: Finer-grained grace-period-end checks in rcu_dump_cpu_stacks() Paul E. McKenney
2024-10-29 0:22 ` [PATCH v3 " Paul E. McKenney
2024-10-29 2:20 ` Cheng-Jui Wang (王正睿)
2024-10-29 16:29 ` Paul E. McKenney
2024-10-30 3:55 ` Cheng-Jui Wang (王正睿)
2024-10-30 13:54 ` Paul E. McKenney
2024-10-30 20:12 ` Doug Anderson
2024-10-30 23:26 ` Paul E. McKenney [this message]
2024-10-31 0:21 ` Doug Anderson
2024-10-31 5:03 ` Paul E. McKenney
2024-10-31 21:27 ` Doug Anderson
2024-11-01 1:44 ` Cheng-Jui Wang (王正睿)
2024-11-01 13:55 ` Paul E. McKenney
2025-10-30 8:30 ` Tze-nan Wu (吳澤南)
2024-11-01 7:41 ` Cheng-Jui Wang (王正睿)
2024-11-01 13:59 ` Paul E. McKenney
2024-10-18 21:49 ` [PATCH v2 rcu 0/3] RCU CPU stall-warning changes for v6.13 Frederic Weisbecker
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=63859e70-2ea7-4a67-857c-fa226566f25a@paulmck-laptop \
--to=paulmck@kernel.org \
--cc=Cheng-Jui.Wang@mediatek.com \
--cc=bobule.chang@mediatek.com \
--cc=dianders@chromium.org \
--cc=frederic@kernel.org \
--cc=joel@joelfernandes.org \
--cc=kernel-team@meta.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=rcu@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=sumit.garg@linaro.org \
--cc=wsd_upstream@mediatek.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®