From be2dfd58fefe6d365ba423763538224c7eaae6d3 Mon Sep 17 00:00:00 2001 From: Mark Johnston Date: Wed, 18 May 2016 03:34:02 +0000 Subject: [PATCH] Remove the MUTEX_DEBUG kernel option. It has no counterpart among the other lock primitives and has been a no-op for years. Mutex consistency checks are generally done whenver INVARIANTS is enabled. --- sys/conf/NOTES | 2 -- sys/conf/options | 1 - sys/kern/kern_mutex.c | 36 ------------------------------------ 3 files changed, 39 deletions(-) diff --git a/sys/conf/NOTES b/sys/conf/NOTES index 33a487201d8e..fd66dfddfd74 100644 --- a/sys/conf/NOTES +++ b/sys/conf/NOTES @@ -298,7 +298,6 @@ options SX_NOINLINE # performance and increase the frequency of kernel panics by # design. If you aren't sure that you need it then you don't. # Relies on the PREEMPTION option. DON'T TURN THIS ON. -# MUTEX_DEBUG enables various extra assertions in the mutex code. # SLEEPQUEUE_PROFILING enables rudimentary profiling of the hash table # used to hold active sleep queues as well as sleep wait message # frequency. @@ -314,7 +313,6 @@ options SX_NOINLINE # WITNESS_SKIPSPIN disables the witness checks on spin mutexes. options PREEMPTION options FULL_PREEMPTION -options MUTEX_DEBUG options WITNESS options WITNESS_KDB options WITNESS_SKIPSPIN diff --git a/sys/conf/options b/sys/conf/options index fa35b30aa3ba..20d30b6e7415 100644 --- a/sys/conf/options +++ b/sys/conf/options @@ -590,7 +590,6 @@ MAXCPU opt_global.h MAXMEMDOM opt_global.h MAXPHYS opt_global.h MCLSHIFT opt_global.h -MUTEX_DEBUG opt_global.h MUTEX_NOINLINE opt_global.h LOCK_PROFILING opt_global.h LOCK_PROFILING_FAST opt_global.h diff --git a/sys/kern/kern_mutex.c b/sys/kern/kern_mutex.c index d9e5872e2a4f..3f62d171528d 100644 --- a/sys/kern/kern_mutex.c +++ b/sys/kern/kern_mutex.c @@ -844,37 +844,6 @@ __mtx_assert(const volatile uintptr_t *c, int what, const char *file, int line) } #endif -/* - * The MUTEX_DEBUG-enabled mtx_validate() - * - * Most of these checks have been moved off into the LO_INITIALIZED flag - * maintained by the witness code. - */ -#ifdef MUTEX_DEBUG - -void mtx_validate(struct mtx *); - -void -mtx_validate(struct mtx *m) -{ - -/* - * XXX: When kernacc() does not require Giant we can reenable this check - */ -#ifdef notyet - /* - * 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)) - panic("Can't read and write to mutex %p", m); -#endif -} -#endif - /* * General init routine used by the MTX_SYSINIT() macro. */ @@ -908,11 +877,6 @@ _mtx_init(volatile uintptr_t *c, const char *name, const char *type, int opts) ("%s: mtx_lock not aligned for %s: %p", __func__, name, &m->mtx_lock)); -#ifdef MUTEX_DEBUG - /* Diagnostic and error correction */ - mtx_validate(m); -#endif - /* Determine lock class and lock flags. */ if (opts & MTX_SPIN) class = &lock_class_mtx_spin;