tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: panic: locking xyz against myself (linux DRM?!)



   Date: Sun, 26 Jul 2015 07:48:22 +1000
   from: matthew green <mrg%eterna.com.au@localhost>

   > Now, whenever the system is up for a few days, and I didn't think of restarting firefox for a while, it eventually crashes with:
   > > panic: kernel diagnostic assertion "((mutex->wwm_state != WW_OWNED) || (mutex->wwm_u.owner != curlwp))" failed: file "/usr/src/sys/external/bsd/drm2/linux/
   > linux_ww_mutex.c", line 760 locking 0xfffffe804fc70220 against myself: 0xfffffe811c5b2840
   [ ... ]
   >
   > Any ideas?  Does anyone else have the same problem?
   > 
   > I can extract information from the crash dump if required.

   this is PR 49862 that we don't have any good idea about yet. :-(

I've been offering the attached patch to try to debug the source of
the problem before the symptom you described happens.  I haven't
gotten any diagnostics back from anyone yet.  If you can, please try
it out and let me know.
Agent pid 1518
Index: sys/sys/lockdebug.h
===================================================================
RCS file: /cvsroot/src/sys/sys/lockdebug.h,v
retrieving revision 1.14
diff -p -u -r1.14 lockdebug.h
--- sys/sys/lockdebug.h	27 Apr 2013 08:12:34 -0000	1.14
+++ sys/sys/lockdebug.h	28 Jun 2015 14:37:58 -0000
@@ -86,11 +113,20 @@ void	lockdebug_wakeup(volatile void *, u
 
 #else	/* LOCKDEBUG */
 
+#include <sys/lwp.h>
+
 #define	LOCKDEBUG_ALLOC(lock, ops, addr)		false
 #define	LOCKDEBUG_FREE(dodebug, lock)			/* nothing */
 #define	LOCKDEBUG_WANTLOCK(dodebug, lock, where, s)	/* nothing */
+#ifdef DIAGNOSTIC
+#define	LOCKDEBUG_LOCKED(dodebug, lock, al, where, s)	\
+	do { if (s) curlwp->l_shlocks++; else curlwp->l_exlocks++; } while (0)
+#define	LOCKDEBUG_UNLOCKED(dodebug, lock, where, s)	\
+	do { if (s) curlwp->l_shlocks--; else curlwp->l_exlocks--; } while (0)
+#else
 #define	LOCKDEBUG_LOCKED(dodebug, lock, al, where, s)	/* nothing */
 #define	LOCKDEBUG_UNLOCKED(dodebug, lock, where, s)	/* nothing */
+#endif
 #define	LOCKDEBUG_BARRIER(lock, slp)			/* nothing */
 #define	LOCKDEBUG_MEM_CHECK(base, sz)			/* nothing */
 #define	LOCKDEBUG_WAKEUP(dodebug, lock, where)		/* nothing */
Index: sys/sys/userret.h
===================================================================
RCS file: /cvsroot/src/sys/sys/userret.h,v
retrieving revision 1.26
diff -p -u -r1.26 userret.h
--- sys/sys/userret.h	7 Apr 2013 07:54:53 -0000	1.26
+++ sys/sys/userret.h	28 Jun 2015 14:37:58 -0000
@@ -83,6 +83,10 @@ mi_userret(struct lwp *l)
 #ifndef __HAVE_PREEMPTION
 	KASSERT(curcpu()->ci_biglock_count == 0);
 #endif
+#ifndef LOCKDEBUG
+	KASSERTMSG(l->l_exlocks == 0, "%hu exlocks held", l->l_exlocks);
+	KASSERTMSG(l->l_shlocks == 0, "%hu shlocks held", l->l_shlocks);
+#endif
 
 	/*
 	 * Handle "exceptional" events: pending signals, stop/exit actions,


Home | Main Index | Thread Index | Old Index