From 3f119cd4f7d6fa59e00fa8fa9284a7fb4131a3cd Mon Sep 17 00:00:00 2001 From: nwhitehorn Date: Tue, 9 Mar 2010 02:00:53 +0000 Subject: Place interrupt handling in a critical section and remove double counting in incrementing the interrupt nesting level. This fixes a number of bugs in which the interrupt thread could be preempted by an IPI, indefinitely delaying acknowledgement of the interrupt to the PIC, causing interrupt starvation and hangs. Reported by: linimon Reviewed by: marcel, jhb MFC after: 1 week --- sys/powerpc/booke/interrupt.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'sys/powerpc/booke/interrupt.c') diff --git a/sys/powerpc/booke/interrupt.c b/sys/powerpc/booke/interrupt.c index 01ee3d9..2367bf9 100644 --- a/sys/powerpc/booke/interrupt.c +++ b/sys/powerpc/booke/interrupt.c @@ -118,9 +118,11 @@ powerpc_decr_interrupt(struct trapframe *framep) struct thread *td; td = PCPU_GET(curthread); + critical_enter(); atomic_add_int(&td->td_intr_nesting_level, 1); decr_intr(framep); atomic_subtract_int(&td->td_intr_nesting_level, 1); + critical_exit(); } /* @@ -129,10 +131,8 @@ powerpc_decr_interrupt(struct trapframe *framep) void powerpc_extr_interrupt(struct trapframe *framep) { - struct thread *td; - td = PCPU_GET(curthread); - atomic_add_int(&td->td_intr_nesting_level, 1); + critical_enter(); PIC_DISPATCH(pic, framep); - atomic_subtract_int(&td->td_intr_nesting_level, 1); + critical_exit(); } -- cgit v1.1