From owner-p4-projects@FreeBSD.ORG Wed Mar 29 21:27:04 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 7880D16A424; Wed, 29 Mar 2006 21:27:04 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3F39316A400 for ; Wed, 29 Mar 2006 21:27:04 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 09CF943D45 for ; Wed, 29 Mar 2006 21:27:04 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id k2TLR3WR076142 for ; Wed, 29 Mar 2006 21:27:03 GMT (envelope-from jhb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id k2TLR3hC076139 for perforce@freebsd.org; Wed, 29 Mar 2006 21:27:03 GMT (envelope-from jhb@freebsd.org) Date: Wed, 29 Mar 2006 21:27:03 GMT Message-Id: <200603292127.k2TLR3hC076139@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jhb@freebsd.org using -f From: John Baldwin To: Perforce Change Reviews Cc: Subject: PERFORCE change 94258 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Mar 2006 21:27:04 -0000 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