From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Julia Cartwright <julia@ni.com>
Cc: "Pavel V. Panteleev" <panteleev_p@mcst.ru>,
linux-rt-users@vger.kernel.org,
Steven Rostedt <rostedt@goodmis.org>
Subject: [PATCH] mm/slub: enable IRQs once scheduling is working
Date: Fri, 24 Nov 2017 10:35:12 +0100 [thread overview]
Message-ID: <20171124093512.GA2564@linutronix.de> (raw)
In-Reply-To: <20171117173820.GM872@jcartwri.amer.corp.natinst.com>
Pavel V. Panteleev reported that a WARN_ON_ONCE(p->migrate_disable <= 0)
triggered in 3.14.79-rt85 during boot from radix_tree_insert().
The problem is that radix_tree_insert() allocates memory and SLUB does
not enable interrupts in allocate_slab().
They can't be be enabled unconditionally because early in the boot
process they have to remain off. Enabling them at the "SYSTEM_RUNNING"
state is too late. The earliest point is once we have scheduling
working that is once the kthread is running.
In newer -RT (v4.11+) there is the check
if (system_state > SYSTEM_BOOTING)
to enable interrupts in the allocator which is what this patch intends:
Once scheduling is working enable interrupts in the allocator path so we
can take sleeping locks.
Reported-by: "Pavel V. Panteleev" <panteleev_p@mcst.ru>
Tested-by: "Pavel V. Panteleev" <panteleev_p@mcst.ru>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
init/main.c | 2 ++
mm/slub.c | 3 ++-
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/init/main.c b/init/main.c
index 6470deef01c9..362761effeac 100644
--- a/init/main.c
+++ b/init/main.c
@@ -379,6 +379,7 @@ static void __init setup_command_line(char *command_line)
*/
static __initdata DECLARE_COMPLETION(kthreadd_done);
+extern bool slab_do_irq_on;
static noinline void __ref rest_init(void)
{
@@ -396,6 +397,7 @@ static noinline void __ref rest_init(void)
rcu_read_lock();
kthreadd_task = find_task_by_pid_ns(pid, &init_pid_ns);
rcu_read_unlock();
+ slab_do_irq_on = true;
complete(&kthreadd_done);
/*
diff --git a/mm/slub.c b/mm/slub.c
index 67eb368b9314..22ec805130e5 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -1527,6 +1527,7 @@ static inline bool shuffle_freelist(struct kmem_cache *s, struct page *page)
return false;
}
#endif /* CONFIG_SLAB_FREELIST_RANDOM */
+bool slab_do_irq_on;
static struct page *allocate_slab(struct kmem_cache *s, gfp_t flags, int node)
{
@@ -1543,7 +1544,7 @@ static struct page *allocate_slab(struct kmem_cache *s, gfp_t flags, int node)
if (gfpflags_allow_blocking(flags))
enableirqs = true;
#ifdef CONFIG_PREEMPT_RT_FULL
- if (system_state == SYSTEM_RUNNING)
+ if (slab_do_irq_on)
enableirqs = true;
#endif
if (enableirqs)
--
2.15.0
prev parent reply other threads:[~2017-11-24 9:35 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CADF-jezvVP2O++FR2KiRSSSJF7oObjy8LSP3-yj1HCmxyTzB_Q@mail.gmail.com>
2017-11-02 16:50 ` schedule under irqs_disabled in SLUB problem Sebastian Andrzej Siewior
2017-11-02 20:55 ` Grygorii Strashko
[not found] ` <CADF-jexLs9vRuiuoRmcA+0L6Mp-XxW75okheWV+ipGf1b_Ua1w@mail.gmail.com>
2017-11-03 10:23 ` Pavel V. Panteleev
2017-11-07 9:00 ` Pavel V. Panteleev
2017-11-07 9:14 ` Pavel V. Panteleev
2017-11-07 9:47 ` Pavel V. Panteleev
2017-11-16 16:08 ` Sebastian Andrzej Siewior
2017-11-16 16:39 ` Pavel V. Panteleev
2017-11-17 17:38 ` Julia Cartwright
2017-11-24 6:39 ` Sam Kappen
2017-11-24 9:37 ` Sebastian Andrzej Siewior
2017-11-27 6:46 ` Sam Kappen
2017-12-04 9:59 ` Sebastian Andrzej Siewior
2017-12-05 16:31 ` Sam Kappen
2017-12-12 10:18 ` Sebastian Andrzej Siewior
2018-03-05 8:47 ` Sam Kappen
2018-03-05 17:40 ` Sebastian Andrzej Siewior
2017-11-24 9:35 ` Sebastian Andrzej Siewior [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:
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=20171124093512.GA2564@linutronix.de \
--to=bigeasy@linutronix.de \
--cc=julia@ni.com \
--cc=linux-rt-users@vger.kernel.org \
--cc=panteleev_p@mcst.ru \
--cc=rostedt@goodmis.org \
/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).