Re: WITNESS not always working

From: Bjoern A. Zeeb <bzeeb-lists_at_lists.zabbadoz.net>
Date: Sun, 13 Sep 2026 19:24:52 UTC
On Sun, 13 Sep 2026, Jonathan T. Looney wrote:

> On Sun, Sep 13, 2026 at 12:55 PM Bjoern A. Zeeb <
> bzeeb-lists@lists.zabbadoz.net> wrote:
>
>>
>>
>> Does anyone have any idea as to why witness may not do its job (sometimes)?
>
>
> The most obvious place I’ve seen incorrect results has been when multiple
> different locks use the same name. Is it possible that is a factor here?

That may still be the case:

for LinuxKPI I added https://reviews.freebsd.org/D59231 in order to remove NOWITNESS
options;  and for most we use mutex_name() and spin_lock_name() macros in those
cases to have a unique "name ## file ## line"-name rather than the single "name"-name.

I had mentioned some of this in
https://lists.freebsd.org/archives/freebsd-hackers/2026-August/006828.html
already.



My current problem, and I should have added INVARIANTS to the subject as
well is that lock assertions also do not fire (as detailed in the first
sentences of the original email).


I am about to test a plain main without any changes and if that also fails
will write a simple native kernel module to test some of this as I am trying
to narrow down if this is a problem with LinuxKPI based things, with kernel
modules, or something other random.


It's the second time for a similar problem I haven't noticed anymore in
months but I fixed before and completely forgot about it in a different
branch.

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=298417

LinuxKPI 802.11 missing locks and rtw89 asserting them.  Should happen each
and evey time but it does not (for me) and frankly we get way too little
reports for any stable branch that people would notice this.
And I've been loading and unloading that driver at least 200 times in the
last months as one of the rtw89 cards is in one of my test devices.

The "hanging" observations in the PRs likely comes from the fact that upon
the assert/panic and using any drm-kmod makes the system blank/hang and we
do not get a ddb> prompt on the console or take 10-15 seconds before reboot.

I know I added #warnings and #errors a few weeks ago to the compile to make
sure the INVARIANTS code is covered indeed.


I am just baffled; hence reaching out.

-- 
For there shall arise false Christs, and false prophets, and shall shew
great signs and wonders; insomuch that, if it were possible, they shall
deceive the very elect. Behold, I have told you before. [Mat. 24:24-25]