Mercurial > libjeffpc
changeset 784:78c359f9eee8
synch: print read/write indication for held rwlocks
Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
author | Josef 'Jeff' Sipek <jeffpc@josefsipek.net> |
---|---|
date | Sun, 11 Aug 2019 13:37:00 -0400 |
parents | ec30705b2104 |
children | 918290b29837 |
files | synch.c |
diffstat | 1 files changed, 24 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/synch.c Sun Aug 11 13:35:45 2019 -0400 +++ b/synch.c Sun Aug 11 13:37:00 2019 -0400 @@ -137,6 +137,27 @@ return buf; } +static inline char *get_held_chars(struct held_lock *held, char buf[2]) +{ + char *ptr = buf; + + switch (held->info->type) { + case SYNCH_TYPE_MUTEX: + break; + case SYNCH_TYPE_RW: + *ptr = held->rwlock_wr ? 'w' : 'r'; + ptr++; + break; + case SYNCH_TYPE_COND: + break; + } + + /* null terminate for good measure */ + *ptr = '\0'; + + return buf; +} + static void print_invalid_call(const char *fxn, const struct lock_context *where) { panic("lockdep: invalid call to %s at %s:%d", fxn, where->file, @@ -193,12 +214,14 @@ struct lock_info *info = cur->info; struct lock *lock = container_of(info, struct lock, info); char synch_chars[2]; + char held_chars[2]; - cmn_err(CE_CRIT, "lockdep: %s #%zd: %s (%p) %s <%s> acquired at %s:%d", + cmn_err(CE_CRIT, "lockdep: %s #%zd: %s (%p) %s <%s%s> acquired at %s:%d", (cur == highlight) ? "->" : " ", i, info->name, lock, synch_type_str(info->type), get_synch_chars(info, synch_chars), + get_held_chars(cur, held_chars), cur->where.file, cur->where.line); } }