metag: cpu hotplug: route_irq: preserve irq mask
authorJames Hogan <james.hogan@imgtec.com>
Mon, 1 Jul 2013 14:36:38 +0000 (15:36 +0100)
committerJames Hogan <james.hogan@imgtec.com>
Tue, 2 Jul 2013 13:12:22 +0000 (14:12 +0100)
The route_irq() function needs to preserve the irq mask by using the
_irqsave/irqrestore variants of raw spin lock functions instead of the
_irq variants. This is because it is called from __cpu_disable() (via
migrate_irqs()), which is called with IRQs disabled, so using the _irq
variants re-enables IRQs.

This appears to have been causing occasional hits of the
BUG_ON(!irqs_disabled()) in __irq_work_run() during CPU hotplug soak
testing:
  BUG: failure at kernel/irq_work.c:122/__irq_work_run()!

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
arch/metag/kernel/irq.c

index d91b1e9..2a2c9d5 100644 (file)
@@ -279,11 +279,12 @@ static void route_irq(struct irq_data *data, unsigned int irq, unsigned int cpu)
 {
        struct irq_desc *desc = irq_to_desc(irq);
        struct irq_chip *chip = irq_data_get_irq_chip(data);
+       unsigned long flags;
 
-       raw_spin_lock_irq(&desc->lock);
+       raw_spin_lock_irqsave(&desc->lock, flags);
        if (chip->irq_set_affinity)
                chip->irq_set_affinity(data, cpumask_of(cpu), false);
-       raw_spin_unlock_irq(&desc->lock);
+       raw_spin_unlock_irqrestore(&desc->lock, flags);
 }
 
 /*