From owner-freebsd-current@FreeBSD.ORG Thu Jul 8 17:10:13 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1B4DE16A4CE for ; Thu, 8 Jul 2004 17:10:13 +0000 (GMT) Received: from mail6.speakeasy.net (mail6.speakeasy.net [216.254.0.206]) by mx1.FreeBSD.org (Postfix) with ESMTP id EDEA443D2D for ; Thu, 8 Jul 2004 17:10:12 +0000 (GMT) (envelope-from jhb@FreeBSD.org) Received: (qmail 10391 invoked from network); 8 Jul 2004 17:10:12 -0000 Received: from dsl027-160-063.atl1.dsl.speakeasy.net (HELO server.baldwin.cx) ([216.27.160.63]) (envelope-sender ) encrypted SMTP for ; 8 Jul 2004 17:09:40 -0000 Received: from 10.50.41.229 (gw1.twc.weather.com [216.133.140.1]) by server.baldwin.cx (8.12.11/8.12.11) with ESMTP id i68H9QIF078290; Thu, 8 Jul 2004 13:09:31 -0400 (EDT) (envelope-from jhb@FreeBSD.org) From: John Baldwin To: freebsd-current@FreeBSD.org Date: Thu, 8 Jul 2004 13:10:37 -0400 User-Agent: KMail/1.6 References: <20040707182018.GA45659@atrbg11.informatik.tu-muenchen.de> In-Reply-To: <20040707182018.GA45659@atrbg11.informatik.tu-muenchen.de> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200407081310.37603.jhb@FreeBSD.org> X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on server.baldwin.cx cc: rwatson@FreeBSD.org cc: Daniel Lang Subject: [PATCH] Witness breakage X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Jul 2004 17:10:13 -0000 On Wednesday 07 July 2004 02:20 pm, Daniel Lang wrote: > Hi, > > as announced, here is the PR I just filed: kern/68779 > it includes a gdb stack trace and some very basic analysys. > The crash dump and kernel are currently available, so if > anyone is interested in some particular data, please let me > know in the next few hours. > > Thanks and best regards, > Daniel Ok, I think I've found at least one bug in witness that came in with the witness_checkorder() changes a few months ago that can be triggered by preemption because of thread migration. For those seeing witness problems, please try this patch: --- //depot/projects/smpng/sys/kern/subr_witness.c 2004/06/23 20:40:08 +++ //depot/user/jhb/lock/kern/subr_witness.c 2004/07/08 17:04:53 @@ -701,22 +701,34 @@ if (class->lc_flags & LC_SLEEPLOCK) { /* * Since spin locks include a critical section, this check - * impliclty enforces a lock order of all sleep locks before + * impliclity enforces a lock order of all sleep locks before * all spin locks. */ if (td->td_critnest != 0) panic("blockable sleep lock (%s) %s @ %s:%d", class->lc_name, lock->lo_name, file, line); + + /* + * If this is the first lock acquired then just return as + * no order checking is needed. + */ + if (td->td_sleeplocks == NULL) + return; lock_list = &td->td_sleeplocks; - } else + } else { + /* + * If this is the first lock, just return as no order + * checking is needed. We check this in both if clauses + * here as unifying the check would require us to use a + * critical section to ensure we don't migrate while doing + * the check. Note that if this is not the first lock, we + * are already in a critical section and are safe for the + * rest of the check. + */ + if (PCPU_GET(spinlocks) == NULL) + return; lock_list = PCPU_PTR(spinlocks); - - /* - * Is this the first lock acquired? If so, then no order checking - * is needed. - */ - if (*lock_list == NULL) - return; + } /* * Check to see if we are recursing on a lock we already own. If -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" = http://www.FreeBSD.org