summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/arch/i386/conf/LOCKDOC5
-rw-r--r--sys/arch/i386/conf/files.i3862
-rw-r--r--sys/arch/x86/include/cpufunc.h12
-rw-r--r--sys/lockdoc/log.c9
-rw-r--r--sys/sys/lockdebug.h22
-rw-r--r--sys/sys/lockdoc.h1
6 files changed, 22 insertions, 29 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 cabf5ab270b..8614c7696ab 100644
--- a/sys/arch/i386/conf/files.i386
+++ b/sys/arch/i386/conf/files.i386
@@ -48,7 +48,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 85410c9eb9a..5fe30d0b48a 100644
--- a/sys/arch/x86/include/cpufunc.h
+++ b/sys/arch/x86/include/cpufunc.h
@@ -379,11 +379,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
@@ -397,11 +393,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 63ba89adbb7..020a44d8ee8 100644
--- a/sys/sys/lockdebug.h
+++ b/sys/sys/lockdebug.h
@@ -52,7 +52,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)
@@ -67,7 +69,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);
@@ -82,6 +84,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)
@@ -109,19 +115,6 @@ void lockdebug_wakeup(const char *, size_t, volatile void *, uintptr_t);
#elif defined(LOCKDEBUG) && !defined(LOCKDOC)
-bool lockdebug_alloc(const char *, size_t, volatile void *, lockops_t *,
- uintptr_t);
-void lockdebug_free(const char *, size_t, volatile void *);
-void lockdebug_wantlock(const char *, size_t, const volatile void *,
- uintptr_t, int);
-void lockdebug_locked(const char *, size_t, volatile void *, void *,
- uintptr_t, int);
-void lockdebug_unlocked(const char *, size_t, volatile void *,
- uintptr_t, int);
-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);
-
#define LOCKDEBUG_ALLOC(lock, ops, addr) \
lockdebug_alloc(__func__, __LINE__, lock, ops, addr)
#define LOCKDEBUG_FREE(dodebug, lock) \
@@ -142,6 +135,7 @@ void lockdebug_wakeup(const char *, size_t, volatile void *, uintptr_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 */