From: Frederic Weisbecker <frederic@kernel.org>
To: paulmck@kernel.org
Cc: rcu@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-team@fb.com, mingo@kernel.org, jiangshanlai@gmail.com,
akpm@linux-foundation.org, mathieu.desnoyers@efficios.com,
josh@joshtriplett.org, tglx@linutronix.de, peterz@infradead.org,
rostedt@goodmis.org, dhowells@redhat.com, edumazet@google.com,
fweisbec@gmail.com, oleg@redhat.com, joel@joelfernandes.org
Subject: Re: [PATCH tip/core/rcu 07/10] rcu: Prevent dyntick-idle until ksoftirqd has been spawned
Date: Fri, 12 Mar 2021 00:23:57 +0100 [thread overview]
Message-ID: <20210311232357.GA29548@lothringen> (raw)
In-Reply-To: <20210304000019.22459-7-paulmck@kernel.org>
On Wed, Mar 03, 2021 at 04:00:16PM -0800, paulmck@kernel.org wrote:
> From: "Paul E. McKenney" <paulmck@kernel.org>
>
> After interrupts have enabled at boot but before some random point
> in early_initcall() processing, softirq processing is unreliable.
> If softirq sees a need to push softirq-handler invocation to ksoftirqd
> during this time, then those handlers can be delayed until the ksoftirqd
> kthreads have been spawned, which happens at some random point in the
> early_initcall() processing. In many cases, this delay is just fine.
> However, if the boot sequence blocks waiting for a wakeup from a softirq
> handler, this delay will result in a silent-hang deadlock.
>
> This commit therefore prevents these hangs by ensuring that the tick
> stays active until after the ksoftirqd kthreads have been spawned.
> This change causes the tick to eventually drain the backlog of delayed
> softirq handlers, breaking this deadlock.
>
> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
> ---
> kernel/rcu/tree_plugin.h | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h
> index 2d60377..36212de 100644
> --- a/kernel/rcu/tree_plugin.h
> +++ b/kernel/rcu/tree_plugin.h
> @@ -1255,6 +1255,11 @@ static void rcu_prepare_kthreads(int cpu)
> */
> int rcu_needs_cpu(u64 basemono, u64 *nextevt)
> {
> + /* Through early_initcall(), need tick for softirq handlers. */
> + if (!IS_ENABLED(CONFIG_HZ_PERIODIC) && !this_cpu_ksoftirqd()) {
> + *nextevt = 1;
> + return 1;
> + }
> *nextevt = KTIME_MAX;
> return !rcu_segcblist_empty(&this_cpu_ptr(&rcu_data)->cblist) &&
> !rcu_segcblist_is_offloaded(&this_cpu_ptr(&rcu_data)->cblist);
> @@ -1350,6 +1355,12 @@ int rcu_needs_cpu(u64 basemono, u64 *nextevt)
>
> lockdep_assert_irqs_disabled();
>
> + /* Through early_initcall(), need tick for softirq handlers. */
> + if (!IS_ENABLED(CONFIG_HZ_PERIODIC) && !this_cpu_ksoftirqd()) {
> + *nextevt = 1;
> + return 1;
> + }
> +
> /* If no non-offloaded callbacks, RCU doesn't need the CPU. */
> if (rcu_segcblist_empty(&rdp->cblist) ||
> rcu_segcblist_is_offloaded(&this_cpu_ptr(&rcu_data)->cblist)) {
I suspect rcutiny should be concerned as well?
In fact this patch doesn't look necessary because can_stop_idle_tick() refuse
to stop the tick when softirqs are pending.
Thanks.
next prev parent reply other threads:[~2021-03-11 23:24 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-03 23:59 [PATCH tip/core/rcu 0/10] Miscellaneous fixes for v5.13 Paul E. McKenney
2021-03-04 0:00 ` [PATCH tip/core/rcu 01/10] rcu: Remove superfluous rdp fetch paulmck
2021-03-04 0:00 ` [PATCH tip/core/rcu 02/10] rcu: Fix CPU-offline trace in rcutree_dying_cpu paulmck
2021-03-04 0:00 ` [PATCH tip/core/rcu 03/10] rcu: Remove spurious instrumentation_end() in rcu_nmi_enter() paulmck
2021-03-04 0:00 ` [PATCH tip/core/rcu 04/10] rculist: Replace reference to atomic_ops.rst paulmck
2021-03-04 0:00 ` [PATCH tip/core/rcu 05/10] rcu: Fix kfree_rcu() docbook errors paulmck
2021-03-04 0:00 ` [PATCH tip/core/rcu 06/10] softirq: Don't try waking ksoftirqd before it has been spawned paulmck
2021-03-12 11:36 ` Frederic Weisbecker
2021-03-15 23:11 ` Paul E. McKenney
2021-03-04 0:00 ` [PATCH tip/core/rcu 07/10] rcu: Prevent dyntick-idle until ksoftirqd " paulmck
2021-03-11 23:23 ` Frederic Weisbecker [this message]
2021-03-11 23:34 ` Paul E. McKenney
2021-03-04 0:00 ` [PATCH tip/core/rcu 08/10] docs: Correctly spell Stephen Hemminger's name paulmck
2021-03-04 0:00 ` [PATCH tip/core/rcu 09/10] rcu: Add explicit barrier() to __rcu_read_unlock() paulmck
2021-03-04 0:00 ` [PATCH tip/core/rcu 10/10] rcu/tree: Add a trace event for RCU CPU stall warnings paulmck
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=20210311232357.GA29548@lothringen \
--to=frederic@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=dhowells@redhat.com \
--cc=edumazet@google.com \
--cc=fweisbec@gmail.com \
--cc=jiangshanlai@gmail.com \
--cc=joel@joelfernandes.org \
--cc=josh@joshtriplett.org \
--cc=kernel-team@fb.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mingo@kernel.org \
--cc=oleg@redhat.com \
--cc=paulmck@kernel.org \
--cc=peterz@infradead.org \
--cc=rcu@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
/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;
as well as URLs for NNTP newsgroup(s).