linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH]  [irq] Fix boot failure when irqaffinity is passed.
@ 2017-10-26  4:58 Rakib Mullick
  2017-10-31 11:29 ` Ingo Molnar
  2017-11-01  4:14 ` [PATCH] irq/core: Fix boot crash when the irqaffinity= boot parameter is passed on CPUMASK_OFFSTACK=y kernels(v1) Rakib Mullick
  0 siblings, 2 replies; 5+ messages in thread
From: Rakib Mullick @ 2017-10-26  4:58 UTC (permalink / raw)
  To: mingo, tglx; +Cc: linux-kernel

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 <rakib.mullick@gmail.com>
---
 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);
 }
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH]  [irq] Fix boot failure when irqaffinity is passed.
  2017-10-26  4:58 [PATCH] [irq] Fix boot failure when irqaffinity is passed Rakib Mullick
@ 2017-10-31 11:29 ` Ingo Molnar
  2017-11-01  4:22   ` Rakib Mullick
  2017-11-01  4:14 ` [PATCH] irq/core: Fix boot crash when the irqaffinity= boot parameter is passed on CPUMASK_OFFSTACK=y kernels(v1) Rakib Mullick
  1 sibling, 1 reply; 5+ messages in thread
From: Ingo Molnar @ 2017-10-31 11:29 UTC (permalink / raw)
  To: Rakib Mullick; +Cc: tglx, linux-kernel


* Rakib Mullick <rakib.mullick@gmail.com> 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 <rakib.mullick@gmail.com>
> ---
>  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 <rakib.mullick@gmail.com>
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 <rakib.mullick@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20171026045800.27087-1-rakib.mullick@gmail.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 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);
 }

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH]  irq/core: Fix boot crash when the irqaffinity= boot parameter is passed on CPUMASK_OFFSTACK=y kernels(v1)
@ 2017-11-01  4:14 ` Rakib Mullick
  2017-11-01 11:09   ` [tip:irq/core] " tip-bot for Rakib Mullick
  0 siblings, 1 reply; 5+ messages in thread
From: Rakib Mullick @ 2017-11-01  4:14 UTC (permalink / raw)
  To: mingo, linux-kernel; +Cc: Thomas Gleixner, Linus Torvalds, Peter Zijlstra

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.

Change since v0:
	* Fix build warning.

Signed-off-by: Rakib Mullick <rakib.mullick@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20171026045800.27087-1-rakib.mullick@gmail.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
Patch created against -rc7 (commit 0b07194bb55ed836c2). I found tip had a merge
conflict, so used -rc7 instead.

 kernel/irq/irqdesc.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c
index 82afb7e..e97bbae 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)
+	if (!cpumask_available(irq_default_affinity))
 		zalloc_cpumask_var(&irq_default_affinity, GFP_NOWAIT);
-#endif
 	if (cpumask_empty(irq_default_affinity))
 		cpumask_setall(irq_default_affinity);
 }
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] [irq] Fix boot failure when irqaffinity is passed.
  2017-10-31 11:29 ` Ingo Molnar
@ 2017-11-01  4:22   ` Rakib Mullick
  0 siblings, 0 replies; 5+ messages in thread
From: Rakib Mullick @ 2017-11-01  4:22 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Thomas Gleixner, LKML

On Tue, Oct 31, 2017 at 5:29 PM, Ingo Molnar <mingo@kernel.org> wrote:
>
>
> 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]
>
Ah, sorry I didn't look into the build log. It happened due to removal
of #ifdef's. Now, it's been fixed by using cpumask_available().

> Also, please pick up the improved changelog below for the next version of the
> patch.
>
Thanks for the improved changelog, I have sent a new version here:
https://lkml.org/lkml/2017/11/1/6.

Thanks,
Rakib.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [tip:irq/core] irq/core: Fix boot crash when the irqaffinity= boot parameter is passed on CPUMASK_OFFSTACK=y kernels(v1)
  2017-11-01  4:14 ` [PATCH] irq/core: Fix boot crash when the irqaffinity= boot parameter is passed on CPUMASK_OFFSTACK=y kernels(v1) Rakib Mullick
@ 2017-11-01 11:09   ` tip-bot for Rakib Mullick
  0 siblings, 0 replies; 5+ messages in thread
From: tip-bot for Rakib Mullick @ 2017-11-01 11:09 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: mingo, rakib.mullick, tglx, peterz, torvalds, hpa, linux-kernel

Commit-ID:  10d94ff4d558b96bfc4f55bb0051ae4d938246fe
Gitweb:     https://git.kernel.org/tip/10d94ff4d558b96bfc4f55bb0051ae4d938246fe
Author:     Rakib Mullick <rakib.mullick@gmail.com>
AuthorDate: Wed, 1 Nov 2017 10:14:51 +0600
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Wed, 1 Nov 2017 09:56:39 +0100

irq/core: Fix boot crash when the irqaffinity= boot parameter is passed on CPUMASK_OFFSTACK=y kernels(v1)

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 #ifdef via using cpumask_available().

Signed-off-by: Rakib Mullick <rakib.mullick@gmail.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/20171026045800.27087-1-rakib.mullick@gmail.com
Link: http://lkml.kernel.org/r/20171101041451.12581-1-rakib.mullick@gmail.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 kernel/irq/irqdesc.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c
index 982a357..f2edcf8 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)
+	if (!cpumask_available(irq_default_affinity))
 		zalloc_cpumask_var(&irq_default_affinity, GFP_NOWAIT);
-#endif
 	if (cpumask_empty(irq_default_affinity))
 		cpumask_setall(irq_default_affinity);
 }

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-11-01 11:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-26  4:58 [PATCH] [irq] Fix boot failure when irqaffinity is passed Rakib Mullick
2017-10-31 11:29 ` Ingo Molnar
2017-11-01  4:22   ` Rakib Mullick
2017-11-01  4:14 ` [PATCH] irq/core: Fix boot crash when the irqaffinity= boot parameter is passed on CPUMASK_OFFSTACK=y kernels(v1) Rakib Mullick
2017-11-01 11:09   ` [tip:irq/core] " tip-bot for Rakib Mullick

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