PERFORCE change 94258 for review

John Baldwin jhb at FreeBSD.org
Wed Mar 29 21:27:04 UTC 2006


http://perforce.freebsd.org/chv.cgi?CH=94258

Change 94258 by jhb at 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


More information about the p4-projects mailing list