Skip to contentSkip to conversation

x86, cpu hotplug, Fix stack frame warning in check_irq_vectors_for_cpu_disable()

PATCH In review Prarit Bhargava 3 participants 3 messages Jan 28, 2014 – Jan 31, 2014 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86, cpu hotplug, Fix stack frame warning in check_irq_vectors_for_cpu_disable()

Further discussion here: http://marc.info/?l=linux-kernel&m=139073901101034&w=2

kbuild, 0day kernel build service, outputs the warning:

arch/x86/kernel/irq.c:333:1: warning: the frame size of 2056 bytes is larger than 2048 bytes [-Wframe-larger-than=]

because check_irq_vectors_for_cpu_disable() allocates two cpumasks on the
stack. Fix this by moving the two cpumasks to a global file context.

Cc Andi Kleen <[email protected]>
Cc Michel Lespinasse <[email protected]>
Cc Seiji Aguchi <[email protected]>
Cc Yang Zhang <[email protected]>
Cc Paul Gortmaker <[email protected]>
Cc Janet Morgan <[email protected]>
Cc Tony Luck <[email protected]>
Cc Ruiv Wang <[email protected]>
Cc Gong Chen <[email protected]>
Cc H. Peter Anvin <[email protected]>
Cc Gong Chen <[email protected]>
Cc Fengguang Wu <[email protected]>
---
 arch/x86/kernel/irq.c |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
arch/x86/kernel/irq.c +8 -1
index 4207e8d..3910078 100644
@@ -262,6 +262,14 @@ __visible void smp_trace_x86_platform_ipi(struct pt_regs *regs)
 EXPORT_SYMBOL_GPL(vector_used_by_percpu_irq);
 
 #ifdef CONFIG_HOTPLUG_CPU
+
+/* These two declarations are only used in check_irq_vectors_for_cpu_disable()
+ * below, which is protected by stop_machine().  Putting them on the stack
+ * results in a stack frame overflow.  Dynamically allocating could result in a
+ * failure so declare these two cpumasks as global.
+ */
+static struct cpumask affinity_new, online_new;
+
 /*
  * This cpu is going to be removed and its vectors migrated to the remaining
  * online cpus.  Check to see if there are enough vectors in the remaining cpus.
@@ -273,7 +281,6 @@ int check_irq_vectors_for_cpu_disable(void)
 	unsigned int this_cpu, vector, this_count, count;
 	struct irq_desc *desc;
 	struct irq_data *data;
-	struct cpumask affinity_new, online_new;
 
 	this_cpu = smp_processor_id();
 	cpumask_copy(&online_new, cpu_online_mask);
Signature · 1 line
1.7.9.3
Tested-by on v1 1/1
#1 lore raw
Quoted 11 lines · Prarit Bhargava

Further discussion here: http://marc.info/?l=linux-kernel&m=139073901101034&w=2

kbuild, 0day kernel build service, outputs the warning:

arch/x86/kernel/irq.c:333:1: warning: the frame size of 2056 bytes is larger than 2048 bytes [-Wframe-larger-than=]

because check_irq_vectors_for_cpu_disable() allocates two cpumasks on the
stack. Fix this by moving the two cpumasks to a global file context.

#2 lore raw

[tip:x86/urgent] x86, cpu hotplug: Fix stack frame warning in check_irq_vectors_for_cpu_disable()

In reply to Prarit Bhargava
x86, cpu hotplug: Fix stack frame warning in check_irq_vectors_for_cpu_disable()
Commit-ID:  39424e89d64661faa0a2e00c5ad1e6dbeebfa972
Gitweb:     http://git.kernel.org/tip/39424e89d64661faa0a2e00c5ad1e6dbeebfa972
Author:     Prarit Bhargava <[email protected]>
AuthorDate: Tue, 28 Jan 2014 08:22:11 -0500
Committer:  H. Peter Anvin <[email protected]>
CommitDate: Thu, 30 Jan 2014 16:40:13 -0800

x86, cpu hotplug: Fix stack frame warning in check_irq_vectors_for_cpu_disable()

Further discussion here: http://marc.info/?l=linux-kernel&m=139073901101034&w=2

kbuild, 0day kernel build service, outputs the warning:

arch/x86/kernel/irq.c:333:1: warning: the frame size of 2056 bytes is larger than 2048 bytes [-Wframe-larger-than=]

because check_irq_vectors_for_cpu_disable() allocates two cpumasks on the
stack. Fix this by moving the two cpumasks to a global file context.

---
 arch/x86/kernel/irq.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
arch/x86/kernel/irq.c +8 -1
index dbb6087..d99f31d 100644
@@ -266,6 +266,14 @@ __visible void smp_trace_x86_platform_ipi(struct pt_regs *regs)
 EXPORT_SYMBOL_GPL(vector_used_by_percpu_irq);
 
 #ifdef CONFIG_HOTPLUG_CPU
+
+/* These two declarations are only used in check_irq_vectors_for_cpu_disable()
+ * below, which is protected by stop_machine().  Putting them on the stack
+ * results in a stack frame overflow.  Dynamically allocating could result in a
+ * failure so declare these two cpumasks as global.
+ */
+static struct cpumask affinity_new, online_new;
+
 /*
  * This cpu is going to be removed and its vectors migrated to the remaining
  * online cpus.  Check to see if there are enough vectors in the remaining cpus.
@@ -277,7 +285,6 @@ int check_irq_vectors_for_cpu_disable(void)
 	unsigned int this_cpu, vector, this_count, count;
 	struct irq_desc *desc;
 	struct irq_data *data;
-	struct cpumask affinity_new, online_new;
 
 	this_cpu = smp_processor_id();
 	cpumask_copy(&online_new, cpu_online_mask);