From owner-freebsd-current@FreeBSD.ORG Sat Jan 21 14:37:14 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 BBF9B106564A; Sat, 21 Jan 2012 14:37:14 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id D4E9D8FC16; Sat, 21 Jan 2012 14:37:13 +0000 (UTC) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id QAA14777; Sat, 21 Jan 2012 16:37:12 +0200 (EET) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1Roc48-000JT8-1X; Sat, 21 Jan 2012 16:37:12 +0200 Message-ID: <4F1ACD97.5080506@FreeBSD.org> Date: Sat, 21 Jan 2012 16:37:11 +0200 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:9.0) Gecko/20111222 Thunderbird/9.0 MIME-Version: 1.0 To: current@FreeBSD.org References: <20120117110242.GD12760@glebius.int.ru> <20120120154158.GD16676@FreeBSD.org> <4F1ABFF3.9090305@FreeBSD.org> In-Reply-To: <4F1ABFF3.9090305@FreeBSD.org> X-Enigmail-Version: undefined Content-Type: text/plain; charset=KOI8-R Content-Transfer-Encoding: 7bit Cc: Gleb Smirnoff Subject: 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: Sat, 21 Jan 2012 14:37:14 -0000 BTW, we have a quite strange situation with spin locks in console output path. cnputs_mtx is marked as MTX_NOWITNESS, supposedly because cnputs (printf) can be called in any locking context (even during normal operation). But there are a number of console-specific locks (scrlock, uart_hwmtx, "syscons video lock") which are acquired under cnputs_mtx, but which are *not* marked as MTX_NOWITNESS. More, they are specified in the witness order_lists as if we certainly know a correct order for them. I think that the msgbuf mutex also deserves mentioning in this context. I think that all of these spin locks should be marked as MTX_NOWITNESS (as long as they stay normal spinlocks), because printf(9) should be usable wherever I stick it in the code. P.S. The above only matters for WITNESS and !WITNESS_SKIPSPIN and I am not sure if this combination really matters. -- Andriy Gapon