aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVivek Goyal <vgoyal@in.ibm.com>2006-03-25 10:31:16 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-25 12:10:57 -0500
commitda7ed9f98f6f3f18664f8ab24303f9428b9d78f8 (patch)
tree692653ace76f945b130eeb991b8e3857caf866b6
parentb1fc513d81b0f50f9543428ce95ec63ae70ab184 (diff)
[PATCH] x86_64: timer interrupt lockup due to pending interrupt
o check_timer() routine fails while second kernel is booting after a crash on an opetron box. Problem happens because timer vector (0x31) seems to be locked. o After a system crash, it is not safe to service interrupts any more, hence interrupts are disabled. This leads to pending interrupts at LAPIC. LAPIC sends these interrupts to the CPU during early boot of second kernel. Other pending interrupts are discarded saying unexpected trap but timer interrupt is serviced and CPU does not issue an LAPIC EOI because it think this interrupt came from i8259 and sends ack to 8259. This leads to vector 0x31 locking as LAPIC does not clear respective ISR and keeps on waiting for EOI. o This patch issues extra EOI for the pending interrupts who have ISR set. o Though today only timer seems to be the special case because in early boot it thinks interrupts are coming from i8259 and uses mask_and_ack_8259A() as ack handler and does not issue LAPIC EOI. But probably doing it in generic manner for all vectors makes sense. Signed-off-by: Vivek Goyal <vgoyal@in.ibm.com> Signed-off-by: Andi Kleen <ak@suse.de> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--arch/x86_64/kernel/apic.c20
-rw-r--r--include/asm-x86_64/apicdef.h1
2 files changed, 21 insertions, 0 deletions
diff --git a/arch/x86_64/kernel/apic.c b/arch/x86_64/kernel/apic.c
index e5b14c57eaa0..d54620147e8e 100644
--- a/arch/x86_64/kernel/apic.c
+++ b/arch/x86_64/kernel/apic.c
@@ -342,6 +342,7 @@ void __init init_bsp_APIC(void)
342void __cpuinit setup_local_APIC (void) 342void __cpuinit setup_local_APIC (void)
343{ 343{
344 unsigned int value, maxlvt; 344 unsigned int value, maxlvt;
345 int i, j;
345 346
346 value = apic_read(APIC_LVR); 347 value = apic_read(APIC_LVR);
347 348
@@ -371,6 +372,25 @@ void __cpuinit setup_local_APIC (void)
371 apic_write(APIC_TASKPRI, value); 372 apic_write(APIC_TASKPRI, value);
372 373
373 /* 374 /*
375 * After a crash, we no longer service the interrupts and a pending
376 * interrupt from previous kernel might still have ISR bit set.
377 *
378 * Most probably by now CPU has serviced that pending interrupt and
379 * it might not have done the ack_APIC_irq() because it thought,
380 * interrupt came from i8259 as ExtInt. LAPIC did not get EOI so it
381 * does not clear the ISR bit and cpu thinks it has already serivced
382 * the interrupt. Hence a vector might get locked. It was noticed
383 * for timer irq (vector 0x31). Issue an extra EOI to clear ISR.
384 */
385 for (i = APIC_ISR_NR - 1; i >= 0; i--) {
386 value = apic_read(APIC_ISR + i*0x10);
387 for (j = 31; j >= 0; j--) {
388 if (value & (1<<j))
389 ack_APIC_irq();
390 }
391 }
392
393 /*
374 * Now that we are all set up, enable the APIC 394 * Now that we are all set up, enable the APIC
375 */ 395 */
376 value = apic_read(APIC_SPIV); 396 value = apic_read(APIC_SPIV);
diff --git a/include/asm-x86_64/apicdef.h b/include/asm-x86_64/apicdef.h
index decaa2d540e8..5a48e9bcf218 100644
--- a/include/asm-x86_64/apicdef.h
+++ b/include/asm-x86_64/apicdef.h
@@ -39,6 +39,7 @@
39#define APIC_SPIV_FOCUS_DISABLED (1<<9) 39#define APIC_SPIV_FOCUS_DISABLED (1<<9)
40#define APIC_SPIV_APIC_ENABLED (1<<8) 40#define APIC_SPIV_APIC_ENABLED (1<<8)
41#define APIC_ISR 0x100 41#define APIC_ISR 0x100
42#define APIC_ISR_NR 0x8 /* Number of 32 bit ISR registers. */
42#define APIC_TMR 0x180 43#define APIC_TMR 0x180
43#define APIC_IRR 0x200 44#define APIC_IRR 0x200
44#define APIC_ESR 0x280 45#define APIC_ESR 0x280