From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752887AbdJaL3v (ORCPT ); Tue, 31 Oct 2017 07:29:51 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:55172 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751399AbdJaL3u (ORCPT ); Tue, 31 Oct 2017 07:29:50 -0400 X-Google-Smtp-Source: ABhQp+TBpXN6G4tsqQZlb62O1jKXpShQ3mEHmGwYBOTpwzosSGSYKrHK50VYdUGYjdVX0tgnCeszHg== Date: Tue, 31 Oct 2017 12:29:46 +0100 From: Ingo Molnar To: Rakib Mullick Cc: tglx@linutronix.de, linux-kernel@vger.kernel.org Subject: Re: [PATCH] [irq] Fix boot failure when irqaffinity is passed. Message-ID: <20171031112946.e4t6s2at4cwza4ej@gmail.com> References: <20171026045800.27087-1-rakib.mullick@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20171026045800.27087-1-rakib.mullick@gmail.com> User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Rakib Mullick wrote: > When irqaffinity kernel param is passed in a CPUMASK_OFFSTACK=y build > kernel, it fails to boot. zalloc_cpumask_var() cannot be used before > initializing mm stuff (slab allocator) to allocate cpumask. So, use > alloc_bootmem_cpumask_var(). Also in init_irq_default_affinity() removes > unneeded ifdef, these ifdef conditions are handled at defination site. > > Signed-off-by: Rakib Mullick > --- > kernel/irq/irqdesc.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c > index 982a357..db6380d 100644 > --- a/kernel/irq/irqdesc.c > +++ b/kernel/irq/irqdesc.c > @@ -27,7 +27,7 @@ static struct lock_class_key irq_desc_lock_class; > #if defined(CONFIG_SMP) > static int __init irq_affinity_setup(char *str) > { > - zalloc_cpumask_var(&irq_default_affinity, GFP_NOWAIT); > + alloc_bootmem_cpumask_var(&irq_default_affinity); > cpulist_parse(str, irq_default_affinity); > /* > * Set at least the boot cpu. We don't want to end up with > @@ -40,10 +40,8 @@ __setup("irqaffinity=", irq_affinity_setup); > > static void __init init_irq_default_affinity(void) > { > -#ifdef CONFIG_CPUMASK_OFFSTACK > if (!irq_default_affinity) > zalloc_cpumask_var(&irq_default_affinity, GFP_NOWAIT); > -#endif > if (cpumask_empty(irq_default_affinity)) > cpumask_setall(irq_default_affinity); > } Not applied, because this patch causes the following build warning: kernel/irq/irqdesc.c:43:6: warning: the address of ‘irq_default_affinity’ will always evaluate as ‘true’ [-Waddress] Also, please pick up the improved changelog below for the next version of the patch. Thanks, Ingo ===============> >>From 57b19413bbe77f0da6f161a5b2b68a73b42ba157 Mon Sep 17 00:00:00 2001 From: Rakib Mullick Date: Thu, 26 Oct 2017 10:58:00 +0600 Subject: [PATCH] irq/core: Fix boot crash when the irqaffinity= boot parameter is passed on CPUMASK_OFFSTACK=y kernels When the irqaffinity= kernel parameter is passed in a CPUMASK_OFFSTACK=y kernel, it fails to boot, because zalloc_cpumask_var() cannot be used before initializing the slab allocator to allocate a cpumask. So, use alloc_bootmem_cpumask_var() instead. Also do some cleanups while at it: in init_irq_default_affinity() remove an unnecessary #ifdef. Signed-off-by: Rakib Mullick Cc: Thomas Gleixner Cc: Linus Torvalds Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/20171026045800.27087-1-rakib.mullick@gmail.com Signed-off-by: Ingo Molnar --- kernel/irq/irqdesc.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c index 982a3576fb01..db6380d4517d 100644 --- a/kernel/irq/irqdesc.c +++ b/kernel/irq/irqdesc.c @@ -27,7 +27,7 @@ static struct lock_class_key irq_desc_lock_class; #if defined(CONFIG_SMP) static int __init irq_affinity_setup(char *str) { - zalloc_cpumask_var(&irq_default_affinity, GFP_NOWAIT); + alloc_bootmem_cpumask_var(&irq_default_affinity); cpulist_parse(str, irq_default_affinity); /* * Set at least the boot cpu. We don't want to end up with @@ -40,10 +40,8 @@ __setup("irqaffinity=", irq_affinity_setup); static void __init init_irq_default_affinity(void) { -#ifdef CONFIG_CPUMASK_OFFSTACK if (!irq_default_affinity) zalloc_cpumask_var(&irq_default_affinity, GFP_NOWAIT); -#endif if (cpumask_empty(irq_default_affinity)) cpumask_setall(irq_default_affinity); }