archive mirror
 help / color / mirror / Atom feed
From: Uladzislau Rezki <>
To: Thomas Gleixner <>,
	"Paul E. McKenney" <>
Cc: Thomas Gleixner <>,
	Uladzislau Rezki <>,
	Sebastian Andrzej Siewior <>,
	"tip-bot2 for Paul E. McKenney" <>,,
	Peter Zijlstra <>,
	Frederic Weisbecker <>,,
Subject: Re: [tip: core/rcu] softirq: Don't try waking ksoftirqd before it has been spawned
Date: Thu, 15 Apr 2021 16:34:26 +0200	[thread overview]
Message-ID: <20210415143426.GA14967@pc638.lan> (raw)
In-Reply-To: <20210415050225.GC4510@paulmck-ThinkPad-P17-Gen-1>

> Another approach is to move the spawning of ksoftirqd earlier.  This
> still leaves a window of vulnerability, but the window is smaller, and
> thus the probablity of something needing to happen there is smaller.
> Uladzislau sent out a patch that did this some weeks back.
See below the patch that is in question, just in case:

commit f4cd768e341486655c8c196e1f2b48a4463541f3
Author: Paul E. McKenney <>
Date:   Fri Feb 12 16:41:05 2021 -0800

    softirq: Don't try waking ksoftirqd before it has been spawned

    If there is heavy softirq activity, the softirq system will attempt
    to awaken ksoftirqd and will stop the traditional back-of-interrupt
    softirq processing.  This is all well and good, but only if the
    ksoftirqd kthreads already exist, which is not the case during early
    boot, in which case the system hangs.

    One reproducer is as follows:

    tools/testing/selftests/rcutorture/bin/ --allcpus --duration 2 --configs "TREE03" --kconfig "CONFIG_DEBUG_LOCK_ALLOC=y CONFIG_PROVE_LOCKING=y" --bootargs "threadirqs=1" --trust-make

    This commit therefore moves the spawning of the ksoftirqd kthreads
    earlier in boot.  With this change, the above test passes.

    Reported-by: Sebastian Andrzej Siewior <>
    Reported-by: Uladzislau Rezki <>
    Inspired-by: Uladzislau Rezki <>
    Signed-off-by: Paul E. McKenney <>

diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index bb8ff90..283a02d 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -592,6 +592,8 @@ static inline struct task_struct *this_cpu_ksoftirqd(void)
        return this_cpu_read(ksoftirqd);

+int spawn_ksoftirqd(void);
 /* Tasklets --- multithreaded analogue of BHs.

    This API is deprecated. Please consider using threaded IRQs instead:
diff --git a/init/main.c b/init/main.c
index c68d784..99835bb 100644
--- a/init/main.c
+++ b/init/main.c
@@ -1512,6 +1512,7 @@ static noinline void __init kernel_init_freeable(void)


+       spawn_ksoftirqd();
diff --git a/kernel/softirq.c b/kernel/softirq.c
index 9d71046..45d50d4 100644
--- a/kernel/softirq.c
+++ b/kernel/softirq.c
@@ -724,7 +724,7 @@ static struct smp_hotplug_thread softirq_threads = {
        .thread_comm            = "ksoftirqd/%u",

-static __init int spawn_ksoftirqd(void)
+__init int spawn_ksoftirqd(void)
        cpuhp_setup_state_nocalls(CPUHP_SOFTIRQ_DEAD, "softirq:dead", NULL,
@@ -732,7 +732,6 @@ static __init int spawn_ksoftirqd(void)

        return 0;

  * [ These __weak aliases are kept in a separate compilation unit, so that


Vlad Rezki

      reply	other threads:[~2021-04-15 14:34 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-11 13:43 [tip: core/rcu] softirq: Don't try waking ksoftirqd before it has been spawned tip-bot2 for Paul E. McKenney
2021-04-12 14:16 ` Thomas Gleixner
2021-04-12 18:36   ` Paul E. McKenney
2021-04-14  7:13     ` Sebastian Andrzej Siewior
2021-04-14  8:57       ` Uladzislau Rezki
2021-04-14 18:11         ` Paul E. McKenney
2021-04-14 23:54           ` Thomas Gleixner
2021-04-15  5:02             ` Paul E. McKenney
2021-04-15 14:34               ` Uladzislau Rezki [this message]

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:

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

  git send-email \
    --in-reply-to=20210415143426.GA14967@pc638.lan \ \ \ \ \ \ \ \ \ \ \

* 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).