From 76dcbd6f9fb7f59dc49bc4eb453c03eac97b91ee Mon Sep 17 00:00:00 2001 From: Bosko Milekic Date: Fri, 24 Aug 2001 23:00:59 +0000 Subject: [PATCH] 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). --- sys/kern/kern_mutex.c | 5 +++++ sys/kern/subr_turnstile.c | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/sys/kern/kern_mutex.c b/sys/kern/kern_mutex.c index b34d049c591e..646d99a8f0e2 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)) diff --git a/sys/kern/subr_turnstile.c b/sys/kern/subr_turnstile.c index b34d049c591e..646d99a8f0e2 100644 --- a/sys/kern/subr_turnstile.c +++ b/sys/kern/subr_turnstile.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))