svn commit: r276626 - head/sys/kern
Gleb Smirnoff
glebius at FreeBSD.org
Sun Jan 4 22:08:51 UTC 2015
Hi!
On Sat, Jan 03, 2015 at 05:21:20PM +0000, Hans Petter Selasky wrote:
H> Author: hselasky
H> Date: Sat Jan 3 17:21:19 2015
H> New Revision: 276626
H> URL: https://svnweb.freebsd.org/changeset/base/276626
H>
H> Log:
H> Rework r276532 a bit. Always avoid recursing into the console drivers
H> clients, hence they might not handle it very well. This change allows
H> debugging mutex problems with kernel console drivers when
H> "debug.witness.skipspin=0" is set in the boot environment.
H>
H> MFC after: 1 week
I'd ask Andriy avg@ to review r276532 and this change. AFAIR, he attacked
this problem in 2011/2012 and it appeared much more complex than just adding
MTX_RECURSE flag.
H> Modified:
H> head/sys/kern/kern_cons.c
H>
H> Modified: head/sys/kern/kern_cons.c
H> ==============================================================================
H> --- head/sys/kern/kern_cons.c Sat Jan 3 16:48:08 2015 (r276625)
H> +++ head/sys/kern/kern_cons.c Sat Jan 3 17:21:19 2015 (r276626)
H> @@ -512,6 +512,13 @@ cnputs(char *p)
H> int unlock_reqd = 0;
H>
H> if (use_cnputs_mtx) {
H> + /*
H> + * NOTE: Debug prints and/or witness printouts in
H> + * console driver clients can cause the "cnputs_mtx"
H> + * mutex to recurse. Simply return if that happens.
H> + */
H> + if (mtx_owned(&cnputs_mtx))
H> + return;
H> mtx_lock_spin(&cnputs_mtx);
H> unlock_reqd = 1;
H> }
H> @@ -601,13 +608,7 @@ static void
H> cn_drvinit(void *unused)
H> {
H>
H> - /*
H> - * NOTE: Debug prints and/or witness printouts in console
H> - * driver clients can cause the "cnputs_mtx" mutex to
H> - * recurse. Make sure the "MTX_RECURSE" flags is set!
H> - */
H> - mtx_init(&cnputs_mtx, "cnputs_mtx", NULL, MTX_SPIN |
H> - MTX_NOWITNESS | MTX_RECURSE);
H> + mtx_init(&cnputs_mtx, "cnputs_mtx", NULL, MTX_SPIN | MTX_NOWITNESS);
H> use_cnputs_mtx = 1;
H> }
H>
H>
--
Totus tuus, Glebius.
More information about the svn-src-head
mailing list