mirror of
https://github.com/opnsense/src.git
synced 2026-02-22 01:11:30 -05:00
- Move the definition of LOCK_DEBUG back to sys/lock.h from sys/_lock.h.
- Change LOCK_DEBUG so that it is always on if KTR is compiled in regardless of the state of KTR_COMPILE. This means that we no longer need to include sys/ktr.h before sys/lock.h to ensure a valid setting for LOCK_DEBUG. - Change the use of LOCK_DEBUG so that it is now always defined and its value is used instead of merely its definition. That is, instead of #ifdef LOCK_DEBUG, code should now use #if LOCK_DEBUG > 0. - Use this latest to #error out in sys/mutex.h if sys/lock.h isn't included before sys/mutex.h to ensure that the proper versions of the mutex operations are used. - As a result of (2) sys/mutex.h no longer includes sys/ktr.h in the KERNEL case. Requested by: bde (1)
This commit is contained in:
parent
e37d2a8c82
commit
fb63feef6f
3 changed files with 20 additions and 23 deletions
|
|
@ -31,22 +31,6 @@
|
|||
#ifndef _SYS_LOCK_TYPES_H_
|
||||
#define _SYS_LOCK_TYPES_H_
|
||||
|
||||
#ifdef _KERNEL
|
||||
/*
|
||||
* If any of WITNESS, INVARIANTS, or KTR_LOCK KTR tracing has been enabled,
|
||||
* then turn on LOCK_DEBUG. When this option is on, extra debugging
|
||||
* facilities such as tracking the file and line number of lock operations
|
||||
* are enabled. Also, mutex locking operations are not inlined to avoid
|
||||
* bloat from all the extra debugging code. We also have to turn on all the
|
||||
* calling conventions for this debugging code in modules so that modules can
|
||||
* work with both debug and non-debug kernels.
|
||||
*/
|
||||
#if defined(KLD_MODULE) || defined(WITNESS) || defined(INVARIANTS) || defined(INVARIANT_SUPPORT) || (defined(KTR) && (KTR_COMPILE & KTR_LOCK))
|
||||
#define LOCK_DEBUG
|
||||
#endif
|
||||
|
||||
#endif /* _KERNEL */
|
||||
|
||||
struct lock_object {
|
||||
struct lock_class *lo_class;
|
||||
const char *lo_name;
|
||||
|
|
|
|||
|
|
@ -123,11 +123,26 @@ struct lock_list_entry {
|
|||
u_int ll_count;
|
||||
};
|
||||
|
||||
/*
|
||||
* If any of WITNESS, INVARIANTS, or KTR_LOCK KTR tracing has been enabled,
|
||||
* then turn on LOCK_DEBUG. When this option is on, extra debugging
|
||||
* facilities such as tracking the file and line number of lock operations
|
||||
* are enabled. Also, mutex locking operations are not inlined to avoid
|
||||
* bloat from all the extra debugging code. We also have to turn on all the
|
||||
* calling conventions for this debugging code in modules so that modules can
|
||||
* work with both debug and non-debug kernels.
|
||||
*/
|
||||
#if defined(KLD_MODULE) || defined(WITNESS) || defined(INVARIANTS) || defined(INVARIANT_SUPPORT) || defined(KTR)
|
||||
#define LOCK_DEBUG 1
|
||||
#else
|
||||
#define LOCK_DEBUG 0
|
||||
#endif
|
||||
|
||||
/*
|
||||
* In the LOCK_DEBUG case, use the filename and line numbers for debugging
|
||||
* operations. Otherwise, use default values to avoid the unneeded bloat.
|
||||
*/
|
||||
#ifdef LOCK_DEBUG
|
||||
#if LOCK_DEBUG > 0
|
||||
#define LOCK_FILE __FILE__
|
||||
#define LOCK_LINE __LINE__
|
||||
#else
|
||||
|
|
|
|||
|
|
@ -34,11 +34,6 @@
|
|||
|
||||
#ifndef LOCORE
|
||||
#include <sys/queue.h>
|
||||
|
||||
#ifdef _KERNEL
|
||||
#include <sys/ktr.h>
|
||||
#endif /* _KERNEL_ */
|
||||
|
||||
#include <sys/_lock.h>
|
||||
#include <sys/_mutex.h>
|
||||
|
||||
|
|
@ -242,7 +237,10 @@ void _mtx_assert(struct mtx *m, int what, const char *file, int line);
|
|||
#define mtx_unlock(m) mtx_unlock_flags((m), 0)
|
||||
#define mtx_unlock_spin(m) mtx_unlock_spin_flags((m), 0)
|
||||
|
||||
#ifdef LOCK_DEBUG
|
||||
#ifndef LOCK_DEBUG
|
||||
#error LOCK_DEBUG not defined, include <sys/lock.h> before <sys/mutex.h>
|
||||
#endif
|
||||
#if LOCK_DEBUG > 0
|
||||
#define mtx_lock_flags(m, opts) \
|
||||
_mtx_lock_flags((m), (opts), LOCK_FILE, LOCK_LINE)
|
||||
#define mtx_unlock_flags(m, opts) \
|
||||
|
|
|
|||
Loading…
Reference in a new issue