Commit d7b381bb authored by Mike Travis's avatar Mike Travis

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: default avatarRusty Russell <rusty@rustcorp.com.au>
Signed-off-by: default avatarMike Travis <travis@sgi.com>
parent b78936e1
...@@ -37,7 +37,7 @@ extern int irqbalance_disable(char *str); ...@@ -37,7 +37,7 @@ extern int irqbalance_disable(char *str);
#ifdef CONFIG_HOTPLUG_CPU #ifdef CONFIG_HOTPLUG_CPU
#include <linux/cpumask.h> #include <linux/cpumask.h>
extern void fixup_irqs(cpumask_t map); extern void fixup_irqs(void);
#endif #endif
extern unsigned int do_IRQ(struct pt_regs *regs); extern unsigned int do_IRQ(struct pt_regs *regs);
......
...@@ -233,27 +233,28 @@ unsigned int do_IRQ(struct pt_regs *regs) ...@@ -233,27 +233,28 @@ unsigned int do_IRQ(struct pt_regs *regs)
#ifdef CONFIG_HOTPLUG_CPU #ifdef CONFIG_HOTPLUG_CPU
#include <mach_apic.h> #include <mach_apic.h>
void fixup_irqs(cpumask_t map) /* A cpu has been removed from cpu_online_mask. Reset irq affinities. */
void fixup_irqs(void)
{ {
unsigned int irq; unsigned int irq;
static int warned; static int warned;
struct irq_desc *desc; struct irq_desc *desc;
for_each_irq_desc(irq, desc) { for_each_irq_desc(irq, desc) {
cpumask_t mask; const struct cpumask *affinity;
if (!desc) if (!desc)
continue; continue;
if (irq == 2) if (irq == 2)
continue; continue;
cpus_and(mask, desc->affinity, map); affinity = &desc->affinity;
if (any_online_cpu(mask) == NR_CPUS) { if (cpumask_any_and(affinity, cpu_online_mask) >= nr_cpu_ids) {
printk("Breaking affinity for irq %i\n", irq); printk("Breaking affinity for irq %i\n", irq);
mask = map; affinity = cpu_all_mask;
} }
if (desc->chip->set_affinity) if (desc->chip->set_affinity)
desc->chip->set_affinity(irq, &mask); desc->chip->set_affinity(irq, affinity);
else if (desc->action && !(warned++)) else if (desc->action && !(warned++))
printk("Cannot set affinity for irq %i\n", irq); printk("Cannot set affinity for irq %i\n", irq);
} }
......
...@@ -83,16 +83,17 @@ asmlinkage unsigned int do_IRQ(struct pt_regs *regs) ...@@ -83,16 +83,17 @@ asmlinkage unsigned int do_IRQ(struct pt_regs *regs)
} }
#ifdef CONFIG_HOTPLUG_CPU #ifdef CONFIG_HOTPLUG_CPU
void fixup_irqs(cpumask_t map) /* A cpu has been removed from cpu_online_mask. Reset irq affinities. */
void fixup_irqs(void)
{ {
unsigned int irq; unsigned int irq;
static int warned; static int warned;
struct irq_desc *desc; struct irq_desc *desc;
for_each_irq_desc(irq, desc) { for_each_irq_desc(irq, desc) {
cpumask_t mask;
int break_affinity = 0; int break_affinity = 0;
int set_affinity = 1; int set_affinity = 1;
const struct cpumask *affinity;
if (!desc) if (!desc)
continue; continue;
...@@ -102,23 +103,23 @@ void fixup_irqs(cpumask_t map) ...@@ -102,23 +103,23 @@ void fixup_irqs(cpumask_t map)
/* interrupt's are disabled at this point */ /* interrupt's are disabled at this point */
spin_lock(&desc->lock); spin_lock(&desc->lock);
affinity = &desc->affinity;
if (!irq_has_action(irq) || if (!irq_has_action(irq) ||
cpus_equal(desc->affinity, map)) { cpumask_equal(affinity, cpu_online_mask)) {
spin_unlock(&desc->lock); spin_unlock(&desc->lock);
continue; continue;
} }
cpus_and(mask, desc->affinity, map); if (cpumask_any_and(affinity, cpu_online_mask) >= nr_cpu_ids) {
if (cpus_empty(mask)) {
break_affinity = 1; break_affinity = 1;
mask = map; affinity = cpu_all_mask;
} }
if (desc->chip->mask) if (desc->chip->mask)
desc->chip->mask(irq); desc->chip->mask(irq);
if (desc->chip->set_affinity) if (desc->chip->set_affinity)
desc->chip->set_affinity(irq, &mask); desc->chip->set_affinity(irq, affinity);
else if (!(warned++)) else if (!(warned++))
set_affinity = 0; set_affinity = 0;
......
...@@ -1346,7 +1346,7 @@ void cpu_disable_common(void) ...@@ -1346,7 +1346,7 @@ void cpu_disable_common(void)
lock_vector_lock(); lock_vector_lock();
remove_cpu_from_maps(cpu); remove_cpu_from_maps(cpu);
unlock_vector_lock(); unlock_vector_lock();
fixup_irqs(cpu_online_map); fixup_irqs();
} }
int native_cpu_disable(void) int native_cpu_disable(void)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment