mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] x86: allocate cpumask during check irq vectors
@ 2014-01-24 20:11 Yinghai Lu
  2014-01-25  2:05 ` Chen, Gong
  0 siblings, 1 reply; 2+ messages in thread
From: Yinghai Lu @ 2014-01-24 20:11 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: Thomas Gleixner, Ingo Molnar, linux-kernel, Yinghai Lu, Prarit Bhargava

Fix warning:
arch/x86/kernel/irq.c: In function check_irq_vectors_for_cpu_disable:
arch/x86/kernel/irq.c:337:1: warning: the frame size of 2052 bytes is larger than 2048 bytes

when NR_CPUS=8192

We should use zalloc_cpumask_var() instead.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Cc: Prarit Bhargava <prarit@redhat.com>

diff --git a/arch/x86/kernel/irq.c b/arch/x86/kernel/irq.c
index dbb6087..b114ee4 100644
--- a/arch/x86/kernel/irq.c
+++ b/arch/x86/kernel/irq.c
@@ -277,11 +277,14 @@ 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;
+	cpumask_var_t affinity_new, online_new;
+
+	zalloc_cpumask_var(&affinity_new, GFP_KERNEL);
+	zalloc_cpumask_var(&online_new, GFP_KERNEL);
 
 	this_cpu = smp_processor_id();
-	cpumask_copy(&online_new, cpu_online_mask);
-	cpu_clear(this_cpu, online_new);
+	cpumask_copy(online_new, cpu_online_mask);
+	cpumask_clear_cpu(this_cpu, online_new);
 
 	this_count = 0;
 	for (vector = FIRST_EXTERNAL_VECTOR; vector < NR_VECTORS; vector++) {
@@ -289,8 +292,8 @@ int check_irq_vectors_for_cpu_disable(void)
 		if (irq >= 0) {
 			desc = irq_to_desc(irq);
 			data = irq_desc_get_irq_data(desc);
-			cpumask_copy(&affinity_new, data->affinity);
-			cpu_clear(this_cpu, affinity_new);
+			cpumask_copy(affinity_new, data->affinity);
+			cpumask_clear_cpu(this_cpu, affinity_new);
 
 			/* Do not count inactive or per-cpu irqs. */
 			if (!irq_has_action(irq) || irqd_is_per_cpu(data))
@@ -311,8 +314,8 @@ int check_irq_vectors_for_cpu_disable(void)
 			 * mask is not zero; that is the down'd cpu is the
 			 * last online cpu in a user set affinity mask.
 			 */
-			if (cpumask_empty(&affinity_new) ||
-			    !cpumask_subset(&affinity_new, &online_new))
+			if (cpumask_empty(affinity_new) ||
+			    !cpumask_subset(affinity_new, online_new))
 				this_count++;
 		}
 	}

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

* Re: [PATCH] x86: allocate cpumask during check irq vectors
  2014-01-24 20:11 [PATCH] x86: allocate cpumask during check irq vectors Yinghai Lu
@ 2014-01-25  2:05 ` Chen, Gong
  0 siblings, 0 replies; 2+ messages in thread
From: Chen, Gong @ 2014-01-25  2:05 UTC (permalink / raw)
  To: Yinghai Lu
  Cc: H. Peter Anvin, Thomas Gleixner, Ingo Molnar, linux-kernel,
	Prarit Bhargava

[-- Attachment #1: Type: text/plain, Size: 1572 bytes --]

On Fri, Jan 24, 2014 at 12:11:07PM -0800, Yinghai Lu wrote:
> Date:	Fri, 24 Jan 2014 12:11:07 -0800
> From: Yinghai Lu <yinghai@kernel.org>
> To: "H. Peter Anvin" <hpa@zytor.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@elte.hu>,
>  linux-kernel@vger.kernel.org, Yinghai Lu <yinghai@kernel.org>, Prarit
>  Bhargava <prarit@redhat.com>
> Subject: [PATCH] x86: allocate cpumask during check irq vectors
> X-Mailer: git-send-email 1.8.4
> 
> Fix warning:
> arch/x86/kernel/irq.c: In function check_irq_vectors_for_cpu_disable:
> arch/x86/kernel/irq.c:337:1: warning: the frame size of 2052 bytes is larger than 2048 bytes
> 
> when NR_CPUS=8192
> 
> We should use zalloc_cpumask_var() instead.
> 
> Signed-off-by: Yinghai Lu <yinghai@kernel.org>
> Cc: Prarit Bhargava <prarit@redhat.com>
> 
> diff --git a/arch/x86/kernel/irq.c b/arch/x86/kernel/irq.c
> index dbb6087..b114ee4 100644
> --- a/arch/x86/kernel/irq.c
> +++ b/arch/x86/kernel/irq.c
> @@ -277,11 +277,14 @@ 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;
> +	cpumask_var_t affinity_new, online_new;
> +
> +	zalloc_cpumask_var(&affinity_new, GFP_KERNEL);
> +	zalloc_cpumask_var(&online_new, GFP_KERNEL);
>  
Hi, Yinghai

The original author Prarit Bhargava had committed a similar
patch and I ever said this function is protected by stop_machine
so GFP_KERNEL is not reliable. It should be GFP_ATOMIC.


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

end of thread, other threads:[~2014-01-25  2:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-24 20:11 [PATCH] x86: allocate cpumask during check irq vectors Yinghai Lu
2014-01-25  2:05 ` Chen, Gong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome