tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
lockdebug improvement to pass/log return address in more places
Folks:
I'm trying to track down an early UVM panic where I can't get into
DDB (why is an orthogonal issue... I'm not sure yet as to why), and
unfortunately LOCKDEBUG isn't giving me enough useful info when it
panics (in this case attempting to lock a non-existent lock).
What does everyone think of the following patch to help improve
the situation at least a little?
Thanks!
--rafal
Index: subr_lockdebug.c
===================================================================
RCS file: /cvsroot/src/sys/kern/subr_lockdebug.c,v
retrieving revision 1.32
diff -u -p -r1.32 subr_lockdebug.c
--- subr_lockdebug.c 3 May 2008 06:24:55 -0000 1.32
+++ subr_lockdebug.c 6 May 2008 17:35:58 -0000
@@ -242,13 +242,13 @@ lockdebug_lookup1(volatile void *lock, l
* Find a lockdebug structure by a pointer to a lock and return it locked.
*/
static inline lockdebug_t *
-lockdebug_lookup(volatile void *lock, lockdebuglk_t **lk)
+lockdebug_lookup(volatile void *lock, lockdebuglk_t **lk, uintptr_t where)
{
lockdebug_t *ld;
ld = lockdebug_lookup1(lock, lk);
if (ld == NULL)
- panic("lockdebug_lookup: uninitialized lock (lock=%p)", lock);
+ panic("lockdebug_lookup: uninitialized lock (lock=%p,
from=%08lx)", lock, where);
return ld;
}
@@ -382,7 +382,8 @@ lockdebug_free(volatile void *lock)
if (panicstr != NULL || ld_panic)
return;
- ld = lockdebug_lookup(lock, &lk);
+ ld = lockdebug_lookup(lock, &lk,
+ (uintptr_t) __builtin_return_address(0));
if (ld == NULL) {
panic("lockdebug_free: destroying uninitialized lock %p"
"(ld_lock=%p)", lock, ld->ld_lock);
@@ -473,7 +474,7 @@ lockdebug_wantlock(volatile void *lock,
if (panicstr != NULL || ld_panic)
return;
- if ((ld = lockdebug_lookup(lock, &lk)) == NULL)
+ if ((ld = lockdebug_lookup(lock, &lk, where)) == NULL)
return;
if ((ld->ld_flags & LD_LOCKED) != 0 || ld->ld_shares != 0) {
@@ -522,7 +523,7 @@ lockdebug_locked(volatile void *lock, ui
if (panicstr != NULL || ld_panic)
return;
- if ((ld = lockdebug_lookup(lock, &lk)) == NULL)
+ if ((ld = lockdebug_lookup(lock, &lk, where)) == NULL)
return;
if (shared) {
@@ -569,7 +570,7 @@ lockdebug_unlocked(volatile void *lock,
if (panicstr != NULL || ld_panic)
return;
- if ((ld = lockdebug_lookup(lock, &lk)) == NULL)
+ if ((ld = lockdebug_lookup(lock, &lk, where)) == NULL)
return;
if (shared) {
@@ -839,7 +840,8 @@ lockdebug_abort(volatile void *lock, loc
lockdebug_t *ld;
lockdebuglk_t *lk;
- if ((ld = lockdebug_lookup(lock, &lk)) != NULL) {
+ if ((ld = lockdebug_lookup(lock, &lk,
+ (uintptr_t) __builtin_return_address(0))) != NULL) {
lockdebug_abort1(ld, lk, func, msg, true);
/* NOTREACHED */
}
--
Time is an illusion; lunchtime, doubly so. |/\/\| Rafal Boni
-- Ford Prefect |\/\/|
rafal%pobox.com@localhost
Home |
Main Index |
Thread Index |
Old Index