summaryrefslogtreecommitdiffstats
path: root/sys/i386
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2001-03-09 07:24:17 +0000
committerjhb <jhb@FreeBSD.org>2001-03-09 07:24:17 +0000
commitf108bc4208540dee14fdc0004145f51fbd89e4ac (patch)
treec17b215dead08d254c13ea2b0af0c3b27e263d82 /sys/i386
parent60a613e429ca74441c30dd73cee4855e47b71114 (diff)
downloadFreeBSD-src-f108bc4208540dee14fdc0004145f51fbd89e4ac.zip
FreeBSD-src-f108bc4208540dee14fdc0004145f51fbd89e4ac.tar.gz
Fix mtx_legal2block. The only time that it is bad to block on a mutex is
if we hold a spin mutex, since we can trivially get into deadlocks if we start switching out of processes that hold spinlocks. Checking to see if interrupts were disabled was a sort of cheap way of doing this since most of the time interrupts were only disabled when holding a spin lock. At least on the i386. To fix this properly, use a per-process counter p_spinlocks that counts the number of spin locks currently held, and instead of checking to see if interrupts are disabled in the witness code, check to see if we hold any spin locks. Since child processes always start up with the sched lock magically held in fork_exit(), we initialize p_spinlocks to 1 for child processes. Note that proc0 doesn't go through fork_exit(), so it starts with no spin locks held. Consulting from: cp
Diffstat (limited to 'sys/i386')
-rw-r--r--sys/i386/include/mutex.h1
1 files changed, 0 insertions, 1 deletions
diff --git a/sys/i386/include/mutex.h b/sys/i386/include/mutex.h
index a5f88de..4184cde 100644
--- a/sys/i386/include/mutex.h
+++ b/sys/i386/include/mutex.h
@@ -40,7 +40,6 @@
/* Global locks */
extern struct mtx clock_lock;
-#define mtx_legal2block() (read_eflags() & PSL_I)
#define mtx_intr_enable(mutex) (mutex)->mtx_saveintr |= PSL_I
/*
OpenPOWER on IntegriCloud