diff options
author | Mike Travis <travis@sgi.com> | 2008-12-16 20:33:58 -0500 |
---|---|---|
committer | Mike Travis <travis@sgi.com> | 2008-12-16 20:40:57 -0500 |
commit | d7b381bb7b1ad69ff008ea063d26e988b686c8de (patch) | |
tree | a5c8cd362ff64cabc9b60c88a984f77d98007fc7 | |
parent | b78936e14ee47b6b2d628501a0eab5270db80132 (diff) |
x86: fixup_irqs() doesnt need an argument.
Impact: cleanup, remove on-stack cpumask.
The "map" arg is always cpu_online_mask. Importantly, set_affinity
always ands the argument with cpu_online_mask anyway, so we don't need
to do it in fixup_irqs(), avoiding a temporary.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Mike Travis <travis@sgi.com>
-rw-r--r-- | arch/x86/include/asm/irq.h | 2 | ||||
-rw-r--r-- | arch/x86/kernel/irq_32.c | 13 | ||||
-rw-r--r-- | arch/x86/kernel/irq_64.c | 15 | ||||
-rw-r--r-- | arch/x86/kernel/smpboot.c | 2 |
4 files changed, 17 insertions, 15 deletions
diff --git a/arch/x86/include/asm/irq.h b/arch/x86/include/asm/irq.h index bae0eda95486..8766d30fb746 100644 --- a/arch/x86/include/asm/irq.h +++ b/arch/x86/include/asm/irq.h | |||
@@ -37,7 +37,7 @@ extern int irqbalance_disable(char *str); | |||
37 | 37 | ||
38 | #ifdef CONFIG_HOTPLUG_CPU | 38 | #ifdef CONFIG_HOTPLUG_CPU |
39 | #include <linux/cpumask.h> | 39 | #include <linux/cpumask.h> |
40 | extern void fixup_irqs(cpumask_t map); | 40 | extern void fixup_irqs(void); |
41 | #endif | 41 | #endif |
42 | 42 | ||
43 | extern unsigned int do_IRQ(struct pt_regs *regs); | 43 | extern unsigned int do_IRQ(struct pt_regs *regs); |
diff --git a/arch/x86/kernel/irq_32.c b/arch/x86/kernel/irq_32.c index 9cf9cbbf7a02..9dc5588f336a 100644 --- a/arch/x86/kernel/irq_32.c +++ b/arch/x86/kernel/irq_32.c | |||
@@ -233,27 +233,28 @@ unsigned int do_IRQ(struct pt_regs *regs) | |||
233 | #ifdef CONFIG_HOTPLUG_CPU | 233 | #ifdef CONFIG_HOTPLUG_CPU |
234 | #include <mach_apic.h> | 234 | #include <mach_apic.h> |
235 | 235 | ||
236 | void fixup_irqs(cpumask_t map) | 236 | /* A cpu has been removed from cpu_online_mask. Reset irq affinities. */ |
237 | void fixup_irqs(void) | ||
237 | { | 238 | { |
238 | unsigned int irq; | 239 | unsigned int irq; |
239 | static int warned; | 240 | static int warned; |
240 | struct irq_desc *desc; | 241 | struct irq_desc *desc; |
241 | 242 | ||
242 | for_each_irq_desc(irq, desc) { | 243 | for_each_irq_desc(irq, desc) { |
243 | cpumask_t mask; | 244 | const struct cpumask *affinity; |
244 | 245 | ||
245 | if (!desc) | 246 | if (!desc) |
246 | continue; | 247 | continue; |
247 | if (irq == 2) | 248 | if (irq == 2) |
248 | continue; | 249 | continue; |
249 | 250 | ||
250 | cpus_and(mask, desc->affinity, map); | 251 | affinity = &desc->affinity; |
251 | if (any_online_cpu(mask) == NR_CPUS) { | 252 | if (cpumask_any_and(affinity, cpu_online_mask) >= nr_cpu_ids) { |
252 | printk("Breaking affinity for irq %i\n", irq); | 253 | printk("Breaking affinity for irq %i\n", irq); |
253 | mask = map; | 254 | affinity = cpu_all_mask; |
254 | } | 255 | } |
255 | if (desc->chip->set_affinity) | 256 | if (desc->chip->set_affinity) |
256 | desc->chip->set_affinity(irq, &mask); | 257 | desc->chip->set_affinity(irq, affinity); |
257 | else if (desc->action && !(warned++)) | 258 | else if (desc->action && !(warned++)) |
258 | printk("Cannot set affinity for irq %i\n", irq); | 259 | printk("Cannot set affinity for irq %i\n", irq); |
259 | } | 260 | } |
diff --git a/arch/x86/kernel/irq_64.c b/arch/x86/kernel/irq_64.c index 27f2307b0a34..fca2991443f5 100644 --- a/arch/x86/kernel/irq_64.c +++ b/arch/x86/kernel/irq_64.c | |||
@@ -83,16 +83,17 @@ asmlinkage unsigned int do_IRQ(struct pt_regs *regs) | |||
83 | } | 83 | } |
84 | 84 | ||
85 | #ifdef CONFIG_HOTPLUG_CPU | 85 | #ifdef CONFIG_HOTPLUG_CPU |
86 | void fixup_irqs(cpumask_t map) | 86 | /* A cpu has been removed from cpu_online_mask. Reset irq affinities. */ |
87 | void fixup_irqs(void) | ||
87 | { | 88 | { |
88 | unsigned int irq; | 89 | unsigned int irq; |
89 | static int warned; | 90 | static int warned; |
90 | struct irq_desc *desc; | 91 | struct irq_desc *desc; |
91 | 92 | ||
92 | for_each_irq_desc(irq, desc) { | 93 | for_each_irq_desc(irq, desc) { |
93 | cpumask_t mask; | ||
94 | int break_affinity = 0; | 94 | int break_affinity = 0; |
95 | int set_affinity = 1; | 95 | int set_affinity = 1; |
96 | const struct cpumask *affinity; | ||
96 | 97 | ||
97 | if (!desc) | 98 | if (!desc) |
98 | continue; | 99 | continue; |
@@ -102,23 +103,23 @@ void fixup_irqs(cpumask_t map) | |||
102 | /* interrupt's are disabled at this point */ | 103 | /* interrupt's are disabled at this point */ |
103 | spin_lock(&desc->lock); | 104 | spin_lock(&desc->lock); |
104 | 105 | ||
106 | affinity = &desc->affinity; | ||
105 | if (!irq_has_action(irq) || | 107 | if (!irq_has_action(irq) || |
106 | cpus_equal(desc->affinity, map)) { | 108 | cpumask_equal(affinity, cpu_online_mask)) { |
107 | spin_unlock(&desc->lock); | 109 | spin_unlock(&desc->lock); |
108 | continue; | 110 | continue; |
109 | } | 111 | } |
110 | 112 | ||
111 | cpus_and(mask, desc->affinity, map); | 113 | if (cpumask_any_and(affinity, cpu_online_mask) >= nr_cpu_ids) { |
112 | if (cpus_empty(mask)) { | ||
113 | break_affinity = 1; | 114 | break_affinity = 1; |
114 | mask = map; | 115 | affinity = cpu_all_mask; |
115 | } | 116 | } |
116 | 117 | ||
117 | if (desc->chip->mask) | 118 | if (desc->chip->mask) |
118 | desc->chip->mask(irq); | 119 | desc->chip->mask(irq); |
119 | 120 | ||
120 | if (desc->chip->set_affinity) | 121 | if (desc->chip->set_affinity) |
121 | desc->chip->set_affinity(irq, &mask); | 122 | desc->chip->set_affinity(irq, affinity); |
122 | else if (!(warned++)) | 123 | else if (!(warned++)) |
123 | set_affinity = 0; | 124 | set_affinity = 0; |
124 | 125 | ||
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c index 9d58134e0231..8b6f675b363b 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c | |||
@@ -1346,7 +1346,7 @@ void cpu_disable_common(void) | |||
1346 | lock_vector_lock(); | 1346 | lock_vector_lock(); |
1347 | remove_cpu_from_maps(cpu); | 1347 | remove_cpu_from_maps(cpu); |
1348 | unlock_vector_lock(); | 1348 | unlock_vector_lock(); |
1349 | fixup_irqs(cpu_online_map); | 1349 | fixup_irqs(); |
1350 | } | 1350 | } |
1351 | 1351 | ||
1352 | int native_cpu_disable(void) | 1352 | int native_cpu_disable(void) |