From 937519b3ea617431293ae28f3f5eab15a897d658 Mon Sep 17 00:00:00 2001 From: jhb Date: Thu, 31 Jul 2003 18:52:18 +0000 Subject: If a spin lock is held for too long and WITNESS is enabled, then call witness_display_spinlock() to see if we can find out where the current owner of the spin lock last acquired the lock. --- sys/kern/kern_mutex.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'sys/kern/kern_mutex.c') diff --git a/sys/kern/kern_mutex.c b/sys/kern/kern_mutex.c index bf157eb..bbfac1b 100644 --- a/sys/kern/kern_mutex.c +++ b/sys/kern/kern_mutex.c @@ -690,12 +690,18 @@ _mtx_lock_spin(struct mtx *m, int opts, const char *file, int line) if (i < 60000000) DELAY(1); #ifdef DDB - else if (!db_active) + else if (!db_active) { #else - else + else { #endif - panic("spin lock %s held by %p for > 5 seconds", + printf("spin lock %s held by %p for > 5 seconds\n", m->mtx_object.lo_name, (void *)m->mtx_lock); +#ifdef WITNESS + witness_display_spinlock(&m->mtx_object, + mtx_owner(m)); +#endif + panic("spin lock held too long"); + } #ifdef __i386__ ia32_pause(); #endif -- cgit v1.1