summaryrefslogtreecommitdiffstats
path: root/sys/powerpc
diff options
context:
space:
mode:
authornwhitehorn <nwhitehorn@FreeBSD.org>2010-03-09 02:00:53 +0000
committernwhitehorn <nwhitehorn@FreeBSD.org>2010-03-09 02:00:53 +0000
commit3f119cd4f7d6fa59e00fa8fa9284a7fb4131a3cd (patch)
treec919bc7bd91052efc1e21681c50438be71fc3f08 /sys/powerpc
parent93013817b06170ed5ed76ef83e4bc75efe85b100 (diff)
downloadFreeBSD-src-3f119cd4f7d6fa59e00fa8fa9284a7fb4131a3cd.zip
FreeBSD-src-3f119cd4f7d6fa59e00fa8fa9284a7fb4131a3cd.tar.gz
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
Diffstat (limited to 'sys/powerpc')
-rw-r--r--sys/powerpc/aim/interrupt.c6
-rw-r--r--sys/powerpc/booke/interrupt.c8
2 files changed, 8 insertions, 6 deletions
diff --git a/sys/powerpc/aim/interrupt.c b/sys/powerpc/aim/interrupt.c
index d7f489a..b436038 100644
--- a/sys/powerpc/aim/interrupt.c
+++ b/sys/powerpc/aim/interrupt.c
@@ -80,15 +80,17 @@ powerpc_interrupt(struct trapframe *framep)
switch (framep->exc) {
case EXC_EXI:
- 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();
break;
case EXC_DECR:
+ 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();
break;
default:
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();
}
OpenPOWER on IntegriCloud