diff options
author | jhb <jhb@FreeBSD.org> | 2001-07-31 20:57:57 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2001-07-31 20:57:57 +0000 |
commit | a5cd152fc8ed181324d153376a2ca99d5a9de2dc (patch) | |
tree | c3b04921ba1e9d95b79a56369ea4ac5f06ac8385 /sys/kern | |
parent | 198dfe1ce372964cd0190a0caa7d115f92f9da6c (diff) | |
download | FreeBSD-src-a5cd152fc8ed181324d153376a2ca99d5a9de2dc.zip FreeBSD-src-a5cd152fc8ed181324d153376a2ca99d5a9de2dc.tar.gz |
Add a safety belt to mawait() for the (cold || panicstr) case identical to
the one in msleep() such that we return immediately rather than blocking.
Submitted by: peter
Prodded by: sheldonh
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/kern_synch.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c index 530b67e..c51a233 100644 --- a/sys/kern/kern_synch.c +++ b/sys/kern/kern_synch.c @@ -554,6 +554,18 @@ mawait(struct mtx *mtx, int priority, int timo) KASSERT(timo > 0 || mtx_owned(&Giant) || mtx != NULL, ("sleeping without a mutex")); mtx_lock_spin(&sched_lock); + if (cold || panicstr) { + /* + * After a panic, or during autoconfiguration, + * just give interrupts a chance, then just return; + * don't run any other procs or panic below, + * in case this is the idle process and already asleep. + */ + if (mtx != NULL && priority & PDROP) + mtx_unlock_flags(mtx, MTX_NOSWITCH); + mtx_unlock_spin(&sched_lock); + return (0); + } DROP_GIANT_NOSWITCH(); if (mtx != NULL) { mtx_assert(mtx, MA_OWNED | MA_NOTRECURSED); |