summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Evans <bde@FreeBSD.org>1997-03-13 18:09:38 +0000
committerBruce Evans <bde@FreeBSD.org>1997-03-13 18:09:38 +0000
commit70e16c24be58f17f54a4cb9cb46496322c548e93 (patch)
tree835bf351a9fe9e6a0db7ce7d9e84e49296c8c1b0
parent2d950f8de65854a2b36f174ff03e59f27bb2b7ca (diff)
Notes
-rw-r--r--sys/kern/kern_synch.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c
index a14299374584..2109920daf30 100644
--- a/sys/kern/kern_synch.c
+++ b/sys/kern/kern_synch.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)kern_synch.c 8.9 (Berkeley) 5/19/95
- * $Id: kern_synch.c,v 1.25 1996/09/22 06:35:24 gpalmer Exp $
+ * $Id: kern_synch.c,v 1.26 1996/10/17 02:57:39 dyson Exp $
*/
#include "opt_ktrace.h"
@@ -527,8 +527,28 @@ mi_switch()
register struct proc *p = curproc; /* XXX */
register struct rlimit *rlim;
register long s, u;
+ int x;
struct timeval tv;
+ /*
+ * XXX this spl is almost unnecessary. It is partly to allow for
+ * sloppy callers that don't do it (issignal() via CURSIG() is the
+ * main offender). It is partly to work around a bug in the i386
+ * cpu_switch() (the ipl is not preserved). We ran for years
+ * without it. I think there was only a interrupt latency problem.
+ * The main caller, tsleep(), does an splx() a couple of instructions
+ * after calling here. The buggy caller, issignal(), usually calls
+ * here at spl0() and sometimes returns at splhigh(). The process
+ * then runs for a little too long at splhigh(). The ipl gets fixed
+ * when the process returns to user mode (or earlier).
+ *
+ * It would probably be better to always call here at spl0(). Callers
+ * are prepared to give up control to another process, so they must
+ * be prepared to be interrupted. The clock stuff here may not
+ * actually need splstatclock().
+ */
+ x = splstatclock();
+
#ifdef DEBUG
if (p->p_simple_locks)
panic("sleep: holding simple lock");
@@ -573,6 +593,7 @@ mi_switch()
cnt.v_swtch++;
cpu_switch(p);
microtime(&runtime);
+ splx(x);
}
/*