svn commit: r205375 - in stable/8/sys/powerpc: aim booke

Nathan Whitehorn nwhitehorn at FreeBSD.org
Sat Mar 20 14:55:22 UTC 2010


Author: nwhitehorn
Date: Sat Mar 20 14:55:22 2010
New Revision: 205375
URL: http://svn.freebsd.org/changeset/base/205375

Log:
  MFC r204903:
  
  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

Modified:
  stable/8/sys/powerpc/aim/interrupt.c
  stable/8/sys/powerpc/booke/interrupt.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/powerpc/aim/interrupt.c
==============================================================================
--- stable/8/sys/powerpc/aim/interrupt.c	Sat Mar 20 14:53:52 2010	(r205374)
+++ stable/8/sys/powerpc/aim/interrupt.c	Sat Mar 20 14:55:22 2010	(r205375)
@@ -80,15 +80,17 @@ powerpc_interrupt(struct trapframe *fram
 
 	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:

Modified: stable/8/sys/powerpc/booke/interrupt.c
==============================================================================
--- stable/8/sys/powerpc/booke/interrupt.c	Sat Mar 20 14:53:52 2010	(r205374)
+++ stable/8/sys/powerpc/booke/interrupt.c	Sat Mar 20 14:55:22 2010	(r205375)
@@ -118,9 +118,11 @@ powerpc_decr_interrupt(struct trapframe 
 	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 
 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();
 }


More information about the svn-src-all mailing list