NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: kern/58933: panic in athn after wifi router rebooted, diagnostic assertion "ci->ci_mtx_count == -1" failed
The following reply was made to PR kern/58933; it has been noted by GNATS.
From: Taylor R Campbell <riastradh%NetBSD.org@localhost>
To: Jason Thorpe <thorpej%NetBSD.org@localhost>
Cc: gnats-bugs%NetBSD.org@localhost, netbsd-bugs%NetBSD.org@localhost,
"T K Spindler (moof)" <dogcow%babymeat.com@localhost>
Subject: Re: kern/58933: panic in athn after wifi router rebooted, diagnostic assertion "ci->ci_mtx_count == -1" failed
Date: Tue, 24 Dec 2024 22:46:01 +0000
> #7 0xffffffff802e1d67 in athn_usb_wait_async (usc=3D0xffffd30030945000)
> at /usr/src/sys/dev/usb/if_athn_usb.c:907
> ...
> #11 athn_usb_media_change (ifp=3D0xffffd30030945d40)
> at /usr/src/sys/dev/usb/if_athn_usb.c:1391
> #12 0xffffffff806406f7 in ifmedia_change (ifm=3Difm@entry=3D0xffffd300309=
45a30,
> ifp=3Difp@entry=3D0xffffd30030945d40) at /usr/src/sys/net/if_media.c:=
244
This is happening because athn(4) still uses legacy ifmedia locking,
which holds a spin lock.
Fixing this properly requires teaching athn(4) to coordinate locking
with ifmedia and ifmedia_init_with_lock, and that's going to be a pain
to merge with the wifi branch (but we need to do it eventually,
whether or not merge happens).
But, athn-specific issues aside, I wonder whether ifmedia's approach
to legacy drivers is right here. Maybe for legacy drivers it should
be the kernel lock (which is released across sleep, instead of
forbidden to hold across sleep), like we usually do for legacy
MP-unsafe subsystems.
But I don't know enough about the ifmedia locking to know whether the
lock has to serialize entire transactions (in which case the kernel
lock is not good enough), or just has to make logic appear
single-threaded.
What do you think, thorpej?
I think changing legacy ifmedia drivers from spin lock to kernel lock,
if it's the right thing, should be pretty narrowly scoped and safe to
pull up to release branches too.
Home |
Main Index |
Thread Index |
Old Index