From owner-p4-projects Tue Apr 2 8:35:32 2002 Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 88C0337B41F; Tue, 2 Apr 2002 08:35:25 -0800 (PST) Delivered-To: perforce@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id D981A37B405 for ; Tue, 2 Apr 2002 08:35:24 -0800 (PST) Received: (from perforce@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g32GZOi51248 for perforce@freebsd.org; Tue, 2 Apr 2002 08:35:24 -0800 (PST) (envelope-from jhb@freebsd.org) Date: Tue, 2 Apr 2002 08:35:24 -0800 (PST) Message-Id: <200204021635.g32GZOi51248@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: perforce set sender to jhb@freebsd.org using -f From: John Baldwin Subject: PERFORCE change 8891 for review To: Perforce Change Reviews Sender: owner-p4-projects@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG http://people.freebsd.org/~peter/p4db/chv.cgi?CH=8891 Change 8891 by jhb@jhb_laptop on 2002/04/02 08:35:07 Integrate a few fixes from jhb_lock. Affected files ... ... //depot/projects/smpng/sys/kern/subr_witness.c#36 integrate Differences ... ==== //depot/projects/smpng/sys/kern/subr_witness.c#36 (text+ko) ==== @@ -477,6 +477,11 @@ td = curthread; 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 + * all spin locks. + */ if (td->td_critnest != 0 && (flags & LOP_TRYLOCK) == 0) panic("blockable sleep lock (%s) %s @ %s:%d", class->lc_name, lock->lo_name, file, line); @@ -593,7 +598,18 @@ if ((lock1->li_flags & LI_SLEPT) != 0 && lock == &Giant.mtx_object) continue; - if (!isitmydescendant(w, w1)) + /* + * If we are locking a sleepable lock and this lock + * isn't sleepable and isn't Giant, we want to treat + * it as a lock order violation to enfore a general + * lock order of sleepable locks before non-sleepable + * locks. Thus, we only bother checking the lock + * order hierarchy if we pass the initial test. + */ + if (!((lock->lo_flags & LO_SLEEPABLE) != 0 && + ((lock1->li_lock->lo_flags & LO_SLEEPABLE) == 0 && + lock1->li_lock != &Giant.mtx_object)) && + !isitmydescendant(w, w1)) continue; /* * We have a lock order violation, check to see if it @@ -827,10 +843,10 @@ td->td_proc->p_pid, instance->li_lock->lo_name, (*lock_list)->ll_count - 1); - (*lock_list)->ll_count--; - for (j = i; j < (*lock_list)->ll_count; j++) + for (j = i; j < (*lock_list)->ll_count - 1; j++) (*lock_list)->ll_children[j] = (*lock_list)->ll_children[j + 1]; + (*lock_list)->ll_count--; intr_restore(s); if ((*lock_list)->ll_count == 0) { lle = *lock_list; To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe p4-projects" in the body of the message