On Wed, Mar 26, 2014 at 09:40:18PM +0100, Thomas Hellstrom wrote:
On 03/26/2014 08:08 PM, David Herrmann wrote:
"struct_mutex" is used to serialize all entry-points into the drm-device (and thus the driver) and also, often implicitly, as spin-lock for "struct drm_device" data protection.
No. DRM locking was added as an after-though, and is a horrendous mess. Nobody really knows what's protecting what, and that has caused a lot of grief in the past. Probably most so for the Intel driver that relied (relies?) on the struct_mutex to protect everything. The drm_global_mutex is used to serialize the non-lock-audited entry points into the drm device. The struct_mutex is used for data protection of most core drm structures and serializing here and there. Modern drivers have no locks held when entering their ioctls. Also we should not confuse mutexes and spinlocks in this context, as they have very different semantics.
As the guy who gets to live the locking mess called dev->struct_mutex I holeheartedly welcome any efforts to split out clear subparts away from it. I actually had this very idea of adding a master-data related mutex on my todo. I'll try to review this later if I get around, but definitely Acked! -Daniel