Introduce a new global driver lock to use it in place of Giant. Also
lock around uses around uses of devclass_get_maxunit(), replace leftover
CTLFLAG_NEEDGIANTs with CTLFLAG_MPSAFE.
Sponsored by: The FreeBSD Foundation
MFC after: 2 days
Differential D46700
sound: Introduce global driver lock christos on Sep 19 2024, 11:39 AM. Authored by Tags None Referenced Files
Subscribers
Details
Introduce a new global driver lock to use it in place of Giant. Also Sponsored by: The FreeBSD Foundation
Diff Detail
Event TimelineComment Actions Anything which is calling devclass_get_maxunit() should be holding bus_topo_lock, AKA, Giant. This change is incomplete. Comment Actions Quibble: Giant is a detail now that consumers need not know. So removing NEEDSGIANT is good, so long as one explicitly uses bus_topo_lock() around references to devclass_get_maxunit the whole loop in sysctl_hw_snd_maxautovchans. I should add asserts to devclass_get_maxunit()... It's not strictly required for it, but to use the results, one must hold the topo lock.
Comment Actions Lock only around uses of devclass_get_maxunit(). Will write a separate patches
Comment Actions Use new global driver lock instead of bus_topo_*. However, sound(4) still relies on the PCM_GIANT_* macros. Should those be Comment Actions Retire PCM_GIANT_ENTER() and PCM_GIANT_LEAVE/PCM_GIANT_EXIT() and replace with Comment Actions Use a shared lock instead. Fixes some bugs I missed (didn't realize I wasn't Comment Actions After discussion with markj@, keep PCM_GIANT_* and just use the new |