PERFORCE change 88898 for review
John Baldwin
jhb at FreeBSD.org
Thu Dec 29 12:06:18 PST 2005
http://perforce.freebsd.org/chv.cgi?CH=88898
Change 88898 by jhb at jhb_slimer on 2005/12/29 20:05:30
You can't call printf while holding the witness mutex or you can
trigger a deadlock (which I've reproduced several times today ;-P)
with the spin locks used in console drivers. Fix the one printf
I recently added which had this bug.
Affected files ...
.. //depot/projects/smpng/sys/kern/subr_witness.c#145 edit
Differences ...
==== //depot/projects/smpng/sys/kern/subr_witness.c#145 (text+ko) ====
@@ -1409,18 +1409,8 @@
return (w);
}
}
- /*
- * We issue a warning for any spin locks not defined in the static
- * order list as a way to discourage their use (folks should really
- * be using non-spin mutexes most of the time). However, several
- * 3rd part device drivers use spin locks because that is all they
- * have available on Windows and Linux and they think that normal
- * mutexes are insufficient.
- */
- if ((lock_class->lc_flags & LC_SPINLOCK) && witness_spin_warn)
- printf("WITNESS: spin lock %s not in order list", description);
if ((w = witness_get()) == NULL)
- return (NULL);
+ goto out;
w->w_name = description;
w->w_class = lock_class;
w->w_refcount = 1;
@@ -1437,6 +1427,17 @@
lock_class->lc_name);
}
mtx_unlock_spin(&w_mtx);
+out:
+ /*
+ * We issue a warning for any spin locks not defined in the static
+ * order list as a way to discourage their use (folks should really
+ * be using non-spin mutexes most of the time). However, several
+ * 3rd part device drivers use spin locks because that is all they
+ * have available on Windows and Linux and they think that normal
+ * mutexes are insufficient.
+ */
+ if ((lock_class->lc_flags & LC_SPINLOCK) && witness_spin_warn)
+ printf("WITNESS: spin lock %s not in order list", description);
return (w);
}
@@ -1988,7 +1989,7 @@
FOREACH_THREAD_IN_PROC(p, td) {
if (!witness_thread_has_locks(td))
continue;
- printf("Process %d (%s) thread %p (%d)\n", p->p_pid,
+ db_printf("Process %d (%s) thread %p (%d)\n", p->p_pid,
p->p_comm, td, td->td_tid);
witness_list(td);
}
More information about the p4-projects
mailing list