Re: i8259 IRQ problems

From: Maciej W. Rozycki (macro@ds2.pg.gda.pl)
Date: Fri Mar 24 2000 - 10:46:04 EST


On Fri, 24 Mar 2000, Manfred Spraul wrote:

> I'm not sure:
> 1) what happens if the cpu runs with disabled local interrupts, the
> local apic accepts multiple interrupts. The cpu reenables the local
> interrupts.
> Now the tlb flush interrupts should be handled first.
>
> 2) we are in the middle of a level triggered interrupt.
> We do not ack the interrupt until the end of the interrupt handler. And
> the APIC will deliver higher priority interrupts immediately, but lower
> priority interrupts wait for the EOI.

 My memory hasn't served me well this time. You are right and I was
wrong. The local APIC uses a priority model and dispenses higher vectors
first. Given we keep level-triggered interrupts unacked for a long time
now, this really an issue. Two intensive level-triggered interrupts can
starve the tlb flush and also local timer interrupts completely...

> The task priority remains 0, but the local apic maintains a "Processor
> priority register", and this one changes automagically.

 Of course. Ingo, how about the following patch? It works for me.

-- 
+  Maciej W. Rozycki, Technical University of Gdansk, Poland   +
+--------------------------------------------------------------+
+        e-mail: macro@ds2.pg.gda.pl, PGP key available        +

diff -u --recursive --new-file linux-2.3.99-pre3-7.macro/arch/i386/kernel/io_apic.c linux-2.3.99-pre3-7/arch/i386/kernel/io_apic.c --- linux-2.3.99-pre3-7.macro/arch/i386/kernel/io_apic.c Fri Mar 24 01:08:48 2000 +++ linux-2.3.99-pre3-7/arch/i386/kernel/io_apic.c Fri Mar 24 13:10:13 2000 @@ -524,14 +524,14 @@ static int current_vector = IRQ0_TRAP_VECTOR, offset = 0; if (IO_APIC_VECTOR(irq) > 0) return IO_APIC_VECTOR(irq); - if (current_vector == 0xFF) + if (current_vector == LAST_APIC_VECTOR) panic("ran out of interrupt sources!"); next: current_vector += 8; if (current_vector == SYSCALL_VECTOR) goto next; - if (current_vector > 0xFF) { + if (current_vector > LAST_APIC_VECTOR) { offset++; current_vector = IRQ0_TRAP_VECTOR + offset; } diff -u --recursive --new-file linux-2.3.99-pre3-7.macro/include/asm-i386/hw_irq.h linux-2.3.99-pre3-7/include/asm-i386/hw_irq.h --- linux-2.3.99-pre3-7.macro/include/asm-i386/hw_irq.h Fri Mar 24 03:20:48 2000 +++ linux-2.3.99-pre3-7/include/asm-i386/hw_irq.h Fri Mar 24 13:08:57 2000 @@ -27,18 +27,18 @@ */ /* - * Special IRQ vectors used by the SMP architecture, 0x30-0x4f + * Special IRQ vectors used by the SMP architecture, 0xe0-0xff * * some of the following vectors are 'rare', they are merged * into a single vector (CALL_FUNCTION_VECTOR) to save vector space. * TLB, reschedule and local APIC vectors are performance-critical. */ -#define INVALIDATE_TLB_VECTOR 0x30 -#define LOCAL_TIMER_VECTOR 0x31 -#define RESCHEDULE_VECTOR 0x40 +#define INVALIDATE_TLB_VECTOR 0xe0 +#define LOCAL_TIMER_VECTOR 0xe1 +#define RESCHEDULE_VECTOR 0xf0 /* 'rare' vectors: */ -#define CALL_FUNCTION_VECTOR 0x41 +#define CALL_FUNCTION_VECTOR 0xf1 /* * These IRQs should never really happen on perfect hardware running @@ -48,15 +48,16 @@ * normally, so we violate the 'only 2 vectors per priority level' * rule here. */ -#define SPURIOUS_APIC_VECTOR 0x3f -#define ERROR_APIC_VECTOR 0x43 +#define SPURIOUS_APIC_VECTOR 0xef +#define ERROR_APIC_VECTOR 0xf3 /* - * First APIC vector available to drivers: (vectors 0x51-0xfe) - * we start at 0x51 to spread out vectors between priority levels + * First APIC vector available to drivers: (vectors 0x31-0xdf) + * we start at 0x31 to spread out vectors between priority levels * evenly. (note that 0x80 is the syscall vector) */ -#define IRQ0_TRAP_VECTOR 0x51 +#define IRQ0_TRAP_VECTOR 0x31 +#define LAST_APIC_VECTOR 0xdf extern int irq_vector[NR_IRQS]; #define IO_APIC_VECTOR(irq) irq_vector[irq]

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Fri Mar 31 2000 - 21:00:13 EST