summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_mutex.c
diff options
context:
space:
mode:
authorbmilekic <bmilekic@FreeBSD.org>2001-08-24 23:00:59 +0000
committerbmilekic <bmilekic@FreeBSD.org>2001-08-24 23:00:59 +0000
commit12d4e47ee80aea2e579660acb7dcc589cb20003c (patch)
treeb831e5ad45f3d540787882cabb999af9e8a1fb3d /sys/kern/kern_mutex.c
parent5f3f4b73afc657ea50ea59431bc761ce9e5abf85 (diff)
downloadFreeBSD-src-12d4e47ee80aea2e579660acb7dcc589cb20003c.zip
FreeBSD-src-12d4e47ee80aea2e579660acb7dcc589cb20003c.tar.gz
Force a commit on kern_mutex.c to explain reason for last commit but while
I'm at it also add a comment in mtx_validate() explaining the purpose of the last change. Basically, this fixes booting kernels compiled with MUTEX_DEBUG. What used to happen is before we setidt from init386() [still using BTX idt], we called mtx_init() on several mutex locks, notably Giant and some others. This is a problem for MUTEX_DEBUG because it enables mtx_validate() which calls kernacc(), some of which in turn requires Giant. Fix by calling kernacc() from mtx_validate() only if (!cold).
Diffstat (limited to 'sys/kern/kern_mutex.c')
-rw-r--r--sys/kern/kern_mutex.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/sys/kern/kern_mutex.c b/sys/kern/kern_mutex.c
index b34d049..646d99a 100644
--- a/sys/kern/kern_mutex.c
+++ b/sys/kern/kern_mutex.c
@@ -611,6 +611,11 @@ mtx_validate(struct mtx *m)
* we can re-enable the kernacc() checks.
*/
#ifndef __alpha__
+ /*
+ * Can't call kernacc() from early init386(), especially when
+ * initializing Giant mutex, because some stuff in kernacc()
+ * requires Giant itself.
+ */
if (!cold)
if (!kernacc((caddr_t)m, sizeof(m),
VM_PROT_READ | VM_PROT_WRITE))
OpenPOWER on IntegriCloud