1 From 10d94ff4d558b96bfc4f55bb0051ae4d938246fe Mon Sep 17 00:00:00 2001
2 From: Rakib Mullick <rakib.mullick@gmail.com>
3 Date: Wed, 1 Nov 2017 10:14:51 +0600
4 Subject: irq/core: Fix boot crash when the irqaffinity= boot parameter is passed on CPUMASK_OFFSTACK=y kernels(v1)
6 From: Rakib Mullick <rakib.mullick@gmail.com>
8 commit 10d94ff4d558b96bfc4f55bb0051ae4d938246fe upstream.
10 When the irqaffinity= kernel parameter is passed in a CPUMASK_OFFSTACK=y
11 kernel, it fails to boot, because zalloc_cpumask_var() cannot be used before
12 initializing the slab allocator to allocate a cpumask.
14 So, use alloc_bootmem_cpumask_var() instead.
16 Also do some cleanups while at it: in init_irq_default_affinity() remove
17 an #ifdef via using cpumask_available().
19 Signed-off-by: Rakib Mullick <rakib.mullick@gmail.com>
20 Cc: Linus Torvalds <torvalds@linux-foundation.org>
21 Cc: Peter Zijlstra <peterz@infradead.org>
22 Cc: Thomas Gleixner <tglx@linutronix.de>
23 Link: http://lkml.kernel.org/r/20171026045800.27087-1-rakib.mullick@gmail.com
24 Link: http://lkml.kernel.org/r/20171101041451.12581-1-rakib.mullick@gmail.com
25 Signed-off-by: Ingo Molnar <mingo@kernel.org>
26 Cc: Janne Huttunen <janne.huttunen@nokia.com>
27 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
30 kernel/irq/irqdesc.c | 6 ++----
31 1 file changed, 2 insertions(+), 4 deletions(-)
33 --- a/kernel/irq/irqdesc.c
34 +++ b/kernel/irq/irqdesc.c
35 @@ -27,7 +27,7 @@ static struct lock_class_key irq_desc_lo
36 #if defined(CONFIG_SMP)
37 static int __init irq_affinity_setup(char *str)
39 - zalloc_cpumask_var(&irq_default_affinity, GFP_NOWAIT);
40 + alloc_bootmem_cpumask_var(&irq_default_affinity);
41 cpulist_parse(str, irq_default_affinity);
43 * Set at least the boot cpu. We don't want to end up with
44 @@ -40,10 +40,8 @@ __setup("irqaffinity=", irq_affinity_set
46 static void __init init_irq_default_affinity(void)
48 -#ifdef CONFIG_CPUMASK_OFFSTACK
49 - if (!irq_default_affinity)
50 + if (!cpumask_available(irq_default_affinity))
51 zalloc_cpumask_var(&irq_default_affinity, GFP_NOWAIT);
53 if (cpumask_empty(irq_default_affinity))
54 cpumask_setall(irq_default_affinity);