diff options
| author | Merlin Scholz <merlin@scholz.ruhr> | 2022-11-02 22:37:45 +0100 |
|---|---|---|
| committer | Merlin Scholz <merlin@scholz.ruhr> | 2023-07-10 00:22:48 +0200 |
| commit | 05478cd44f496942410fb36e4240708aa6c7a1fd (patch) | |
| tree | 61f16a67cff0dc155558fa22a3b331d8a5b161a3 | |
| parent | 316163c9d932124384f30d20871d8ad3fc5f2810 (diff) | |
Decouple LOCKDEBUG and LOCKDOC kernel flags
| -rw-r--r-- | sys/arch/i386/conf/LOCKDOC | 5 | ||||
| -rw-r--r-- | sys/arch/i386/conf/files.i386 | 2 | ||||
| -rw-r--r-- | sys/arch/x86/include/cpufunc.h | 12 | ||||
| -rw-r--r-- | sys/lockdoc/log.c | 9 | ||||
| -rw-r--r-- | sys/sys/lockdebug.h | 9 | ||||
| -rw-r--r-- | sys/sys/lockdoc.h | 1 |
6 files changed, 22 insertions, 16 deletions
diff --git a/sys/arch/i386/conf/LOCKDOC b/sys/arch/i386/conf/LOCKDOC index 7920a133061..14d7556a892 100644 --- a/sys/arch/i386/conf/LOCKDOC +++ b/sys/arch/i386/conf/LOCKDOC @@ -112,9 +112,8 @@ options BUFQ_PRIOCSCAN #options DIAGNOSTIC # inexpensive kernel consistency checks # XXX to be commented out on release branch options DEBUG # expensive debugging checks/support -options LOCKDEBUG # expensive locking checks/support. Also triggers LOCKDOC experiments -makeoptions LOCKDOC=1 -options LOCKDOC +#options LOCKDEBUG # expensive locking checks/support +options LOCKDOC # LOCKDOC test support #options DDB # in-kernel debugger #options DDB_ONPANIC=1 # see also sysctl(7): `ddb.onpanic' #options DDB_HISTORY_SIZE=512 # enable history editing in DDB diff --git a/sys/arch/i386/conf/files.i386 b/sys/arch/i386/conf/files.i386 index 9bc8094f250..20a74104e31 100644 --- a/sys/arch/i386/conf/files.i386 +++ b/sys/arch/i386/conf/files.i386 @@ -46,7 +46,7 @@ defparam opt_beep.h BEEP_ONHALT_PITCH=1500 defparam opt_beep.h BEEP_ONHALT_PERIOD=250 -file lockdoc/log.c lockdebug +file lockdoc/log.c lockdoc # Multiboot support defflag opt_multiboot.h MULTIBOOT diff --git a/sys/arch/x86/include/cpufunc.h b/sys/arch/x86/include/cpufunc.h index 8a4e7a7c0a0..ca9721ab3e8 100644 --- a/sys/arch/x86/include/cpufunc.h +++ b/sys/arch/x86/include/cpufunc.h @@ -572,11 +572,7 @@ void x86_enable_intr(void); #define x86_disable_intr() __x86_disable_intr(__FILE__, __LINE__, __func__) void __x86_disable_intr(const char *file, int line, const char *func); - -static __inline void lockdoc_x86_disable_intr(void) -{ - __asm volatile ("cli" ::: "memory"); -} +void lockdoc_x86_disable_intr(void); #else @@ -590,11 +586,7 @@ x86_disable_intr(void) #ifdef LOCKDOC #define x86_enable_intr() __x86_enable_intr(__FILE__, __LINE__, __func__) void __x86_enable_intr(const char *file, int line, const char *func); - -static __inline void lockdoc_x86_enable_intr(void) -{ - __asm volatile ("sti" ::: "memory"); -} +void lockdoc_x86_enable_intr(void); #else static inline void diff --git a/sys/lockdoc/log.c b/sys/lockdoc/log.c index 25c64b9c036..28c99ad8bdf 100644 --- a/sys/lockdoc/log.c +++ b/sys/lockdoc/log.c @@ -53,6 +53,10 @@ void __x86_disable_intr(const char *file, int line, const char *func){ lockdoc_x86_disable_intr(); } +void lockdoc_x86_disable_intr(void){ + __asm volatile ("cli" ::: "memory"); +} + void __x86_enable_intr(const char *file, int line, const char *func){ u_long eflags; @@ -60,7 +64,10 @@ void __x86_enable_intr(const char *file, int line, const char *func){ if (!(eflags & (1 << 9))){ // Check if interrupts were disabled in the first place log_lock(V_WRITE, (void*)PSEUDOLOCK_ADDR_HARDIRQ, file, line, LOCK_NONE); } - lockdoc_x86_disable_intr(); + lockdoc_x86_enable_intr(); } +void lockdoc_x86_enable_intr(void){ + __asm volatile ("sti" ::: "memory"); +} #endif /* LOCKDOC */
\ No newline at end of file diff --git a/sys/sys/lockdebug.h b/sys/sys/lockdebug.h index 9e25c2735e6..4b655f31e17 100644 --- a/sys/sys/lockdebug.h +++ b/sys/sys/lockdebug.h @@ -51,7 +51,9 @@ typedef struct lockops { void (*lo_dump)(const volatile void *, lockop_printer_t); } lockops_t; +#ifdef LOCKDOC #include <sys/lockdoc.h> // Has to be included *after* lockops_t definition +#endif /* LOCKDOC */ #define LOCKDEBUG_ABORT(f, ln, l, o, m) \ lockdebug_abort(f, ln, l, o, m) @@ -66,7 +68,7 @@ void lockdebug_show_all_locks(void (*)(const char *, ...) __printflike(1, 2), const char *); void lockdebug_show_lockstats(void (*)(const char *, ...) __printflike(1, 2)); -#if defined(LOCKDEBUG) && defined(LOCKDOC) +#ifdef LOCKDEBUG bool lockdebug_alloc(const char *, size_t, volatile void *, lockops_t *, uintptr_t); @@ -81,6 +83,10 @@ void lockdebug_barrier(const char *, size_t, volatile void *, int); void lockdebug_mem_check(const char *, size_t, void *, size_t); void lockdebug_wakeup(const char *, size_t, volatile void *, uintptr_t); +#endif + +#if defined(LOCKDEBUG) && defined(LOCKDOC) + #define LOCKDEBUG_ALLOC(lock, ops, addr) \ lockdebug_alloc(__func__, __LINE__, lock, ops, addr); \ lockdoc_alloc(__func__, __FILE__, __LINE__, lock, ops, addr) @@ -138,6 +144,7 @@ void lockdebug_mem_check(const char *, size_t, void *, size_t); #elif !defined(LOCKDEBUG) && defined(LOCKDOC) #define LOCKDEBUG_ALLOC(lock, ops, addr) \ + false; \ lockdoc_alloc(__func__, __FILE__, __LINE__, lock, ops, addr) #define LOCKDEBUG_FREE(dodebug, lock) \ lockdoc_free(__func__, __FILE__, __LINE__, lock) diff --git a/sys/sys/lockdoc.h b/sys/sys/lockdoc.h index 8f90a642d56..9f8b2ef387a 100644 --- a/sys/sys/lockdoc.h +++ b/sys/sys/lockdoc.h @@ -86,6 +86,7 @@ static inline void log_lock(int lock_op, const volatile void* ptr, const char *f x86_write_flags(eflags); } #else +#define log_memory(a, b, c, d) #define log_lock(a, b, c, d, e) #endif /* LOCKDOC */ |
