We already lock the softc using PCM_[UN]LOCK() so there is no reason to
use Giant anymore.
Sponsored by: The FreeBSD Foundation
MFC after: 2 days
Differential D46698
sound: Retire PCM_GIANT christos on Sep 19 2024, 11:00 AM. Authored by Tags None Referenced Files
Subscribers
Details
We already lock the softc using PCM_[UN]LOCK() so there is no reason to Sponsored by: The FreeBSD Foundation
Diff Detail
Event Timeline
Comment Actions
There is other state that might be synchronized by Giant: global variables, the list of pcm drivers. For instance, code which references pcm_devclass should be locked with bus_topo_lock() (which is just Giant under the hood).
Comment Actions Yes. Since you may have other threads that attach / detach devices, you need the bus_topo_lock() ... bus_topo_unlock() around this to prevent races with devices detaching while it's running. topo lock will likely stop being Giant soonish, so it's good to the wrappers. There's no need to mark things using it as Giant, since that's for automatic locking and we're explicitly locking things here. Comment Actions pcm_devclass wasn't Giant locked anywhere already, except in the clone routines. Wouldn't it be better to do it in a separate patch?
|