Module Name:    src
Committed By:   bouyer
Date:           Fri Dec 10 22:14:57 UTC 2010

Modified Files:
        src/sys/arch/i386/i386 [netbsd-4]: locore.S

Log Message:
Apply patch, requested by dholland in ticket #1410:
        sys/arch/i386/i386/locore.S: patch
In cpu_switch, avoid flipping interrupts on while holding the
scheduler lock. Doing so can cause locking against oneself via
endtsleep(). Fixes PR kern/38183, where the overt symptom was
that LOCKDEBUG + INSTALL_LARGE would panic during boot.
Should fix PR 38183.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.44.2.1 src/sys/arch/i386/i386/locore.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/i386/i386/locore.S
diff -u src/sys/arch/i386/i386/locore.S:1.44 src/sys/arch/i386/i386/locore.S:1.44.2.1
--- src/sys/arch/i386/i386/locore.S:1.44	Wed Oct 25 13:56:15 2006
+++ src/sys/arch/i386/i386/locore.S	Fri Dec 10 22:14:57 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.44 2006/10/25 13:56:15 jmmv Exp $	*/
+/*	$NetBSD: locore.S,v 1.44.2.1 2010/12/10 22:14:57 bouyer Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000, 2004 The NetBSD Foundation, Inc.
@@ -920,7 +920,7 @@
 	 * we're running at splhigh(), but it's otherwise okay to take
 	 * interrupts here.
 	 */
-	sti
+	/*sti -- no it isn't! */
 	leal	_C_LABEL(sched_qs)(,%ebx,8),%eax # select q
 
 	movl	L_FORW(%eax),%edi	# unlink from front of process q
@@ -1049,7 +1049,7 @@
 	SET_CURPCB(%esi)
 
 	/* Interrupts are okay again. */
-	sti
+	/*sti -- nope, not yet! */
 
 /*
  *  Check for restartable atomic sequences (RAS)
@@ -1065,6 +1065,7 @@
 #if defined(MULTIPROCESSOR) || defined(LOCKDEBUG)
 	call    _C_LABEL(sched_unlock_idle)
 #endif
+	sti	/* NOW we can do this, after releasing sched_lock */
 	cmpl	$0,CPUVAR(IPENDING)
 	jz	3f
 	pushl	$IPL_NONE		# spl0()
@@ -1129,7 +1130,7 @@
 	 * We're running at splhigh(), but it's otherwise okay to take
 	 * interrupts here.
 	 */
-	sti
+	/*sti -- no it isn't! */
 
 	/* Jump into the middle of cpu_switch */
 	xorl	%eax,%eax

Reply via email to