locks under printf(9) and WITNESS [Was: new panic in cpu_reset()
avg at FreeBSD.org
Sat Jan 21 14:37:14 UTC 2012
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.
More information about the freebsd-current