summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_mutex.c
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2003-07-31 18:52:18 +0000
committerjhb <jhb@FreeBSD.org>2003-07-31 18:52:18 +0000
commit937519b3ea617431293ae28f3f5eab15a897d658 (patch)
treecd0692f501cb693c05cedb58349db6285dec2068 /sys/kern/kern_mutex.c
parenta3b9c0d55345861352cfe71080a09693ff39682f (diff)
downloadFreeBSD-src-937519b3ea617431293ae28f3f5eab15a897d658.zip
FreeBSD-src-937519b3ea617431293ae28f3f5eab15a897d658.tar.gz
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.
Diffstat (limited to 'sys/kern/kern_mutex.c')
-rw-r--r--sys/kern/kern_mutex.c12
1 files changed, 9 insertions, 3 deletions
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
OpenPOWER on IntegriCloud