diff options
author | Niklas Hallqvist <niklas@cvs.openbsd.org> | 2005-05-25 23:17:48 +0000 |
---|---|---|
committer | Niklas Hallqvist <niklas@cvs.openbsd.org> | 2005-05-25 23:17:48 +0000 |
commit | d6ec0bc1862a4fed11c7f4ac537413b2c7e89de4 (patch) | |
tree | 6c1ed544e4a8e11ea3e107d10a95bad1273dc5a4 /sys/miscfs | |
parent | fee642f79221488ebcacbd0ca219a563c8607281 (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/miscfs')
-rw-r--r-- | sys/miscfs/procfs/procfs_ctl.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/miscfs/procfs/procfs_ctl.c b/sys/miscfs/procfs/procfs_ctl.c index c38270f3c33..7a1c92b0bb3 100644 --- a/sys/miscfs/procfs/procfs_ctl.c +++ b/sys/miscfs/procfs/procfs_ctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: procfs_ctl.c,v 1.13 2004/05/20 18:32:38 tedu Exp $ */ +/* $OpenBSD: procfs_ctl.c,v 1.14 2005/05/25 23:17:47 niklas Exp $ */ /* $NetBSD: procfs_ctl.c,v 1.14 1996/02/09 22:40:48 christos Exp $ */ /* @@ -48,6 +48,7 @@ #include <sys/resourcevar.h> #include <sys/signalvar.h> #include <sys/ptrace.h> +#include <sys/sched.h> #include <miscfs/procfs/procfs.h> /* @@ -110,6 +111,7 @@ procfs_control(curp, p, op) int op; { int error; + int s; /* * Attach - attaches the target process for debugging @@ -248,8 +250,10 @@ procfs_control(curp, p, op) #endif } + SCHED_LOCK(s); if (p->p_stat == SSTOP) setrunnable(p); + SCHED_UNLOCK(s); return (0); } #endif @@ -265,6 +269,7 @@ procfs_doctl(curp, p, pfs, uio) int error; char msg[PROCFS_CTLLEN+1]; const vfs_namemap_t *nm; + int s; if (uio->uio_rw != UIO_WRITE) return (EOPNOTSUPP); @@ -297,7 +302,9 @@ procfs_doctl(curp, p, pfs, uio) if (TRACE_WAIT_P(curp, p)) { p->p_xstat = nm->nm_val; FIX_SSTEP(p); + SCHED_LOCK(s); setrunnable(p); + SCHED_UNLOCK(s); } else { psignal(p, nm->nm_val); } |