Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 Mar 2006 21:27:03 GMT
From:      John Baldwin <jhb@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 94258 for review
Message-ID:  <200603292127.k2TLR3hC076139@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=94258

Change 94258 by jhb@jhb_slimer on 2006/03/29 21:26:34

	Always do a more friendly panic in the TD_IS_SLEEPING case in
	propagate_priority and if DDB is compiled in dump a stack trace
	of the offending thread before calling panic(2).

Affected files ...

.. //depot/projects/smpng/sys/kern/subr_turnstile.c#23 edit

Differences ...

==== //depot/projects/smpng/sys/kern/subr_turnstile.c#23 (text+ko) ====

@@ -186,15 +186,21 @@
 		MPASS(td->td_proc->p_magic == P_MAGIC);
 
 		/*
-		 * XXX: The owner of a turnstile can be stale if it is the
-		 * first thread to grab a rlock of a rw lock.  In that case
-		 * it is possible for us to be at SSLEEP or some other
-		 * weird state.  We should probably just return if the state
-		 * isn't SRUN or SLOCK.
+		 * If the thread is asleep, then we are probably about
+		 * to deadlock.  To make debugging this easier, just
+		 * panic and tell the user which thread misbehaved so
+		 * they can hopefully get a stack trace from the truly
+		 * misbehaving thread.
 		 */
-		KASSERT(!TD_IS_SLEEPING(td),
-		    ("sleeping thread (tid %d) owns a non-sleepable lock",
-		    td->td_tid));
+		if (TD_IS_SLEEPING(td)) {
+			printf(
+		"Sleeping thread (tid %d, pid %d) owns a non-sleepable lock\n",
+			    td->td_tid, td->td_proc->p_pid);
+#ifdef DDB
+			db_trace_thread(td, -1);
+#endif
+			panic("b00m");
+		}
 
 		/*
 		 * If this thread already has higher priority than the



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200603292127.k2TLR3hC076139>