From owner-freebsd-current@FreeBSD.ORG Mon Jan 23 13:04:55 2012 Return-Path: Delivered-To: current@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1141D106566B; Mon, 23 Jan 2012 13:04:55 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebius.int.ru (glebius.int.ru [81.19.64.117]) by mx1.freebsd.org (Postfix) with ESMTP id 85CDB8FC0A; Mon, 23 Jan 2012 13:04:54 +0000 (UTC) Received: from cell.glebius.int.ru (localhost [127.0.0.1]) by cell.glebius.int.ru (8.14.5/8.14.5) with ESMTP id q0ND4rUc037501; Mon, 23 Jan 2012 17:04:53 +0400 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.5/8.14.5/Submit) id q0ND4rSi037500; Mon, 23 Jan 2012 17:04:53 +0400 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Mon, 23 Jan 2012 17:04:53 +0400 From: Gleb Smirnoff To: Andriy Gapon Message-ID: <20120123130453.GH16676@glebius.int.ru> References: <20120117110242.GD12760@glebius.int.ru> <20120120154158.GD16676@FreeBSD.org> <4F1ABFF3.9090305@FreeBSD.org> <4F1ACD97.5080506@FreeBSD.org> <4F1AF55F.4090803@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <4F1AF55F.4090803@FreeBSD.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: current@FreeBSD.org Subject: Re: locks under printf(9) and WITNESS [Was: new panic in cpu_reset() with WITNESS] X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Jan 2012 13:04:55 -0000 On Sat, Jan 21, 2012 at 07:26:55PM +0200, Andriy Gapon wrote: A> > BTW, we have a quite strange situation with spin locks in console output path. A> > cnputs_mtx is marked as MTX_NOWITNESS, supposedly because cnputs (printf) can be A> > called in any locking context (even during normal operation). But there are a A> > number of console-specific locks (scrlock, uart_hwmtx, "syscons video lock") A> > which are acquired under cnputs_mtx, but which are *not* marked as A> > MTX_NOWITNESS. More, they are specified in the witness order_lists as if we A> > certainly know a correct order for them. A> > I think that the msgbuf mutex also deserves mentioning in this context. A> > A> > I think that all of these spin locks should be marked as MTX_NOWITNESS (as long A> > as they stay normal spinlocks), because printf(9) should be usable wherever I A> > stick it in the code. A> > A> > P.S. The above only matters for WITNESS and !WITNESS_SKIPSPIN and I am not sure A> > if this combination really matters. A> > A> A> Here's my take at it: A> diff --git a/sys/kern/kern_cons.c b/sys/kern/kern_cons.c A> index 5346bc3..97f0f16 100644 ... This patch works. -- Totus tuus, Glebius.