summaryrefslogtreecommitdiff
path: root/sys/kern/kern_time.c
diff options
context:
space:
mode:
authorNiklas Hallqvist <niklas@cvs.openbsd.org>2005-05-25 23:17:48 +0000
committerNiklas Hallqvist <niklas@cvs.openbsd.org>2005-05-25 23:17:48 +0000
commitd6ec0bc1862a4fed11c7f4ac537413b2c7e89de4 (patch)
tree6c1ed544e4a8e11ea3e107d10a95bad1273dc5a4 /sys/kern/kern_time.c
parentfee642f79221488ebcacbd0ca219a563c8607281 (diff)
This patch is mortly art's work and was done *a year* ago. Art wants to thank
everyone for the prompt review and ok of this work ;-) Yeah, that includes me too, or maybe especially me. I am sorry. Change the sched_lock to a mutex. This fixes, among other things, the infamous "telnet localhost &" problem. The real bug in that case was that the sched_lock which is by design a non-recursive lock, was recursively acquired, and not enough releases made us hold the lock in the idle loop, blocking scheduling on the other processors. Some of the other processors would hold the biglock though, which made it impossible for cpu 0 to enter the kernel... A nice deadlock. Let me just say debugging this for days just to realize that it was all fixed in an old diff noone ever ok'd was somewhat of an anti-climax. This diff also changes splsched to be correct for all our architectures.
Diffstat (limited to 'sys/kern/kern_time.c')
-rw-r--r--sys/kern/kern_time.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/kern/kern_time.c b/sys/kern/kern_time.c
index 567341a2f85..d5e29b55362 100644
--- a/sys/kern/kern_time.c
+++ b/sys/kern/kern_time.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_time.c,v 1.45 2004/07/28 17:15:12 tholo Exp $ */
+/* $OpenBSD: kern_time.c,v 1.46 2005/05/25 23:17:47 niklas Exp $ */
/* $NetBSD: kern_time.c,v 1.20 1996/02/18 11:57:06 fvdl Exp $ */
/*
@@ -560,8 +560,12 @@ sys_setitimer(p, v, retval)
}
p->p_realtimer = aitv;
} else {
+ int s;
+
itimerround(&aitv.it_interval);
+ s = splclock();
p->p_stats->p_timer[SCARG(uap, which)] = aitv;
+ splx(s);
}
return (0);