From owner-svn-src-head@FreeBSD.ORG Sat Jan 3 17:21:20 2015 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5E9CA5A4; Sat, 3 Jan 2015 17:21:20 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4AA2F64A76; Sat, 3 Jan 2015 17:21:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t03HLKlt060965; Sat, 3 Jan 2015 17:21:20 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t03HLKHp060964; Sat, 3 Jan 2015 17:21:20 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201501031721.t03HLKHp060964@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Sat, 3 Jan 2015 17:21:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r276626 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Jan 2015 17:21:20 -0000 Author: hselasky Date: Sat Jan 3 17:21:19 2015 New Revision: 276626 URL: https://svnweb.freebsd.org/changeset/base/276626 Log: 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 Modified: head/sys/kern/kern_cons.c Modified: head/sys/kern/kern_cons.c ============================================================================== --- head/sys/kern/kern_cons.c Sat Jan 3 16:48:08 2015 (r276625) +++ head/sys/kern/kern_cons.c Sat Jan 3 17:21:19 2015 (r276626) @@ -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; }