summaryrefslogtreecommitdiffstats
path: root/sys/powerpc/include/mutex.h
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/powerpc/include/mutex.h
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/powerpc/include/mutex.h')
-rw-r--r--sys/powerpc/include/mutex.h2
1 files changed, 0 insertions, 2 deletions
diff --git a/sys/powerpc/include/mutex.h b/sys/powerpc/include/mutex.h
index 9b04128..a6e295d 100644
--- a/sys/powerpc/include/mutex.h
+++ b/sys/powerpc/include/mutex.h
@@ -36,8 +36,6 @@
#ifdef _KERNEL
-#define mtx_legal2block() \
- ((alpha_pal_rdps() & ALPHA_PSL_IPL_MASK) == ALPHA_PSL_IPL_0)
#define mtx_intr_enable(mutex) (mutex)->mtx_saveintr = ALPHA_PSL_IPL_0
/*
OpenPOWER on IntegriCloud