Lock around uses of devclass_*() and replace leftover
CTLFLAG_NEEDGIANTs with CTLFLAG_MPSAFE.
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential D46700
sound: Use bus_topo_lock() where appropriate christos on Sep 19 2024, 11:39 AM. Authored by Tags None Referenced Files
Subscribers
Details Lock around uses of devclass_*() and replace leftover 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
Comment Actions
Comment Actions Code changes look good, I wonder if the two highlighted comments are now obsolete. There's no more giant locked sound devices and now that we use bus functions to lock newbus access, we shouldn't need it for anything else, right?
Comment Actions Ah, OK. I thought we'd sunsetted them. Is there a reason not to plan this sunset for them? Comment Actions I once sent an email in freebsd-arch@ [1] to purge some old drivers, which IIRC are all Giant locked [2], and some people reacted against this. [1] https://lists.freebsd.org/archives/freebsd-arch/2024-April/000641.html |
Is this obsolete now?