diff options
Diffstat (limited to 'sys')
| -rw-r--r-- | sys/kern/kern_rwlock.c | 3 | ||||
| -rw-r--r-- | sys/sys/lockdoc.h | 41 | ||||
| -rw-r--r-- | sys/sys/lockdoc_event.h | 11 |
3 files changed, 54 insertions, 1 deletions
diff --git a/sys/kern/kern_rwlock.c b/sys/kern/kern_rwlock.c index fbdbcdad870..cf9924728ea 100644 --- a/sys/kern/kern_rwlock.c +++ b/sys/kern/kern_rwlock.c @@ -53,6 +53,7 @@ __KERNEL_RCSID(0, "$NetBSD: kern_rwlock.c,v 1.54 2019/05/09 05:00:31 ozaki-r Exp #include <sys/atomic.h> #include <sys/lock.h> #include <sys/pserialize.h> +#include <sys/lockdoc.h> #include <dev/lockstat.h> @@ -570,6 +571,8 @@ rw_vector_tryenter(krwlock_t *rw, const krw_t op) RW_DASSERT(rw, (op != RW_READER && RW_OWNER(rw) == curthread) || (op == RW_READER && RW_COUNT(rw) != 0)); + + log_lock(P_WRITE, rw, __FILE__, __LINE__, LOCK_NONE); return 1; } diff --git a/sys/sys/lockdoc.h b/sys/sys/lockdoc.h index ee9ffdb8820..b101b05bd4a 100644 --- a/sys/sys/lockdoc.h +++ b/sys/sys/lockdoc.h @@ -24,8 +24,47 @@ static inline void log_memory(int alloc, const char *datatype, const void *ptr, } -static inline void log_lock(int lock_op, const kmutex_t* ptr, const char *file, int line, int irq_sync) { +static inline void log_lock(int lock_op, const void* ptr, const char *file, int line, int irq_sync) { + memset(&la_buffer,0,sizeof(la_buffer)); + + // TODO fail shows 0x016c instead of 0x6c + // action + la_buffer.action = LOCKDOC_LOCK_OP; + + // operation + la_buffer.lock_op = lock_op; + + // pointer + la_buffer.ptr = (unsigned long)ptr; + + // size only relevant for memory access + + // TODO type + //strncpy(la_buffer.type, ,LOG_CHAR_BUFFER_LEN); + la_buffer.type[LOG_CHAR_BUFFER_LEN - 1] = '\0'; + + // TODO lock_member + strncpy(la_buffer.lock_member,"dummy",LOG_CHAR_BUFFER_LEN); + la_buffer.lock_member[LOG_CHAR_BUFFER_LEN - 1] = '\0'; + + + // file + strncpy(la_buffer.file,file,LOG_CHAR_BUFFER_LEN); + la_buffer.file[LOG_CHAR_BUFFER_LEN - 1] = '\0'; + + + // line + la_buffer.line = line; + + // TODO function + strncpy(la_buffer.function,"dummy",LOG_CHAR_BUFFER_LEN); + la_buffer.function[LOG_CHAR_BUFFER_LEN - 1] = '\0'; + + // TODO preempt_count + // TODO irq_sync + // TODO flags + outb_(PING_CHAR,IO_PORT_LOG); } #else diff --git a/sys/sys/lockdoc_event.h b/sys/sys/lockdoc_event.h index 5dc402cf435..6addbe5b3ab 100644 --- a/sys/sys/lockdoc_event.h +++ b/sys/sys/lockdoc_event.h @@ -24,6 +24,17 @@ * has to be copied to the according fail experiment * as well as to convert! */ +enum LOCKDOC_OP { + LOCKDOC_ALLOC = 'a', + LOCKDOC_FREE = 'f', + LOCKDOC_LOCK_OP = 'l', + LOCKDOC_CURRENT_TASK = 't', + LOCKDOC_PREEMPT_COUNT = 'p', + LOCKDOC_PID_OFFSET = 'o', + LOCKDOC_KERNEL_VERSION = 'v', + LOCKDOC_READ = 'r', + LOCKDOC_WRITE = 'w' +}; enum LOCK_OP { P_READ = 0, |
