Re: WITNESS not always working

From: Warner Losh <imp_at_bsdimp.com>
Date: Sun, 13 Sep 2026 17:02:00 UTC
On Sun, Sep 13, 2026 at 10:55 AM Bjoern A. Zeeb <
bzeeb-lists@lists.zabbadoz.net> wrote:

> Hi,
>
> I have a problem with lock assertions and apparently it's been ongoing
> for a while.
>
> I am working on Linux derived drivers with lock assertions and we have
> users hitting them.  Yet I have not hit them in months of using the
> drivers.
>
> This time it was even more curious:
>
> I've done a rebase and a full rebuilt of my work branch, booted the kernel,
> loaded the driver (manually) and it went kaboom on a lock assertion right
> away.
>
> I reset from ddb and bootes the same kernel and (manually) loaded the
> driver again and nothing happened.  I unloaded the driver which is a
> current PR and nothing, so I checked again and;
>
> I use the GENERIC-MMCCAM kernel config which includes GENERIC which
> includes
> std.debug so this is alright:
> # sysctl kern.features.witness kern.features.invariants
> kern.features.witness: 1
> kern.features.invariants: 1
>
>
> Does anyone have any idea as to why witness may not do its job (sometimes)?
>

I've had to increase the witness buffer size a few times on complex
hardware setups with a lot of kernel locks...

I've also been burned by spinlocks.

Warner