]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
x86: Remove local_irq_enable()/local_irq_disable() in fixup_irqs()
authorSuresh Siddha <suresh.b.siddha@intel.com>
Mon, 26 Oct 2009 22:24:36 +0000 (14:24 -0800)
committerIngo Molnar <mingo@elte.hu>
Mon, 2 Nov 2009 14:56:37 +0000 (15:56 +0100)
To ensure that we handle all the pending interrupts (destined
for this cpu that is going down) in the interrupt subsystem
before the cpu goes offline, fixup_irqs() does:

local_irq_enable();
mdelay(1);
local_irq_disable();

Enabling interrupts is not a good thing as this cpu is already
offline. So this patch replaces that logic with,

mdelay(1);
check APIC_IRR bits
Retrigger the irq at the new destination if any interrupt has arrived
via IPI.

For IO-APIC level triggered interrupts, this retrigger IPI will
appear as an edge interrupt. ack_apic_level() will detect this
condition and IO-APIC RTE's remoteIRR is cleared using directed
EOI(using IO-APIC EOI register) on Intel platforms and for
others it uses the existing mask+edge logic followed by
unmask+level.

We can also remove mdelay() and then send spuriuous interrupts
to new cpu targets for all the irqs that were handled previously
by this cpu that is going offline. While it works, I have seen
spurious interrupt messages (nothing wrong but still annoying
messages during cpu offline, which can be seen during
suspend/resume etc)

Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
Acked-by: Gary Hade <garyhade@us.ibm.com>
Cc: Eric W. Biederman <ebiederm@xmission.com>
LKML-Reference: <20091026230002.043281924@sbs-t61.sc.intel.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
arch/x86/kernel/irq.c

index b10a5e1da06c92d50963271dd6655b3993819e2a..8a82728d47c1e274a4e8dfeba68f44c9cb53b980 100644 (file)
@@ -281,7 +281,7 @@ EXPORT_SYMBOL_GPL(vector_used_by_percpu_irq);
 /* A cpu has been removed from cpu_online_mask.  Reset irq affinities. */
 void fixup_irqs(void)
 {
-       unsigned int irq;
+       unsigned int irq, vector;
        static int warned;
        struct irq_desc *desc;
 
@@ -336,9 +336,33 @@ void fixup_irqs(void)
                        printk("Cannot set affinity for irq %i\n", irq);
        }
 
-       /* That doesn't seem sufficient.  Give it 1ms. */
-       local_irq_enable();
+       /*
+        * We can remove mdelay() and then send spuriuous interrupts to
+        * new cpu targets for all the irqs that were handled previously by
+        * this cpu. While it works, I have seen spurious interrupt messages
+        * (nothing wrong but still...).
+        *
+        * So for now, retain mdelay(1) and check the IRR and then send those
+        * interrupts to new targets as this cpu is already offlined...
+        */
        mdelay(1);
-       local_irq_disable();
+
+       for (vector = FIRST_EXTERNAL_VECTOR; vector < NR_VECTORS; vector++) {
+               unsigned int irr;
+
+               if (__get_cpu_var(vector_irq)[vector] < 0)
+                       continue;
+
+               irr = apic_read(APIC_IRR + (vector / 32 * 0x10));
+               if (irr  & (1 << (vector % 32))) {
+                       irq = __get_cpu_var(vector_irq)[vector];
+
+                       desc = irq_to_desc(irq);
+                       spin_lock(&desc->lock);
+                       if (desc->chip->retrigger)
+                               desc->chip->retrigger(irq);
+                       spin_unlock(&desc->lock);
+               }
+       }
 }
 #endif