locks under printf(9) and WITNESS [Was: new panic in cpu_reset() with WITNESS]

From: Andriy Gapon <avg_at_FreeBSD.org>
Date: Sat, 21 Jan 2012 16:37:11 +0200
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
Received on Sat Jan 21 2012 - 13:37:14 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:23 UTC