PERFORCE change 82969 for review
John Baldwin
jhb at FreeBSD.org
Thu Sep 1 17:43:51 GMT 2005
http://perforce.freebsd.org/chv.cgi?CH=82969
Change 82969 by jhb at 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.
More information about the p4-projects
mailing list