diff options
author | Hans Petter Selasky <hselasky@FreeBSD.org> | 2015-01-03 17:21:19 +0000 |
---|---|---|
committer | Hans Petter Selasky <hselasky@FreeBSD.org> | 2015-01-03 17:21:19 +0000 |
commit | 04a8159ddf963628ac1167da87ca08b9a0297a7a (patch) | |
tree | 6390b6c4bce4c1f5cc93614a891866c8f637c5a7 /sys/kern/kern_cons.c | |
parent | f75ecd9b19dda45be46edc370a4b386d12b323e5 (diff) | |
download | src-04a8159ddf963628ac1167da87ca08b9a0297a7a.tar.gz src-04a8159ddf963628ac1167da87ca08b9a0297a7a.zip |
Rework r276532 a bit. Always avoid recursing into the console drivers
clients, hence they might not handle it very well. This change allows
debugging mutex problems with kernel console drivers when
"debug.witness.skipspin=0" is set in the boot environment.
MFC after: 1 week
Notes
Notes:
svn path=/head/; revision=276626
Diffstat (limited to 'sys/kern/kern_cons.c')
-rw-r--r-- | sys/kern/kern_cons.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/sys/kern/kern_cons.c b/sys/kern/kern_cons.c index 75f9c18ee9dd..f91fe035f7a1 100644 --- a/sys/kern/kern_cons.c +++ b/sys/kern/kern_cons.c @@ -512,6 +512,13 @@ cnputs(char *p) int unlock_reqd = 0; if (use_cnputs_mtx) { + /* + * NOTE: Debug prints and/or witness printouts in + * console driver clients can cause the "cnputs_mtx" + * mutex to recurse. Simply return if that happens. + */ + if (mtx_owned(&cnputs_mtx)) + return; mtx_lock_spin(&cnputs_mtx); unlock_reqd = 1; } @@ -601,13 +608,7 @@ static void cn_drvinit(void *unused) { - /* - * NOTE: Debug prints and/or witness printouts in console - * driver clients can cause the "cnputs_mtx" mutex to - * recurse. Make sure the "MTX_RECURSE" flags is set! - */ - mtx_init(&cnputs_mtx, "cnputs_mtx", NULL, MTX_SPIN | - MTX_NOWITNESS | MTX_RECURSE); + mtx_init(&cnputs_mtx, "cnputs_mtx", NULL, MTX_SPIN | MTX_NOWITNESS); use_cnputs_mtx = 1; } |