From owner-p4-projects@FreeBSD.ORG Thu Sep 1 17:43:50 2005 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 2DE5216A421; Thu, 1 Sep 2005 17:43:50 +0000 (GMT) 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 4BFD516A41F for ; Thu, 1 Sep 2005 17:43:49 +0000 (GMT) (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 0FBAC43D46 for ; Thu, 1 Sep 2005 17:43:49 +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 j81Hhm0I042606 for ; Thu, 1 Sep 2005 17:43:48 GMT (envelope-from jhb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id j81HhmeS042603 for perforce@freebsd.org; Thu, 1 Sep 2005 17:43:48 GMT (envelope-from jhb@freebsd.org) Date: Thu, 1 Sep 2005 17:43:48 GMT Message-Id: <200509011743.j81HhmeS042603@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 82969 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: Thu, 01 Sep 2005 17:43:51 -0000 http://perforce.freebsd.org/chv.cgi?CH=82969 Change 82969 by jhb@jhb_slimer on 2005/09/01 17:43:10 If Giant is acquired while another mutex is held, force a LOR since Giant must always come before other mutexes. Affected files ... .. //depot/projects/smpng/sys/kern/subr_witness.c#135 edit Differences ... ==== //depot/projects/smpng/sys/kern/subr_witness.c#135 (text+ko) ==== @@ -259,9 +259,15 @@ static struct lock_list_entry w_locklistdata[LOCK_CHILDCOUNT]; static struct witness_order_list_entry order_lists[] = { + /* + * sx locks + */ { "proctree", &lock_class_sx }, { "allproc", &lock_class_sx }, { NULL, NULL }, + /* + * Various mutexes + */ { "Giant", &lock_class_mtx_sleep }, { "filedesc structure", &lock_class_mtx_sleep }, { "pipe mutex", &lock_class_mtx_sleep }, @@ -869,13 +875,22 @@ * order violation to enfore a general lock order of * sleepable locks before non-sleepable locks. */ - if (!((lock->lo_flags & LO_SLEEPABLE) != 0 && + if (((lock->lo_flags & LO_SLEEPABLE) != 0 && (lock1->li_lock->lo_flags & LO_SLEEPABLE) == 0)) - /* - * Check the lock order hierarchy for a reveresal. - */ - if (!isitmydescendant(w, w1)) + goto reversal; + /* + * If we are locking Giant and this is a non-sleepable + * lock, then treat it as a reversal. + */ + if ((lock1->li_lock->lo_flags & LO_SLEEPABLE) == 0 && + lock == &Giant.mtx_object) + goto reversal; + /* + * Check the lock order hierarchy for a reveresal. + */ + if (!isitmydescendant(w, w1)) continue; + reversal: /* * We have a lock order violation, check to see if it * is allowed or has already been yelled about.