aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2017-07-15 05:53:28 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2017-07-18 03:17:22 -0400
commit3379c04cfa11043e26953c784a7202709b19658e (patch)
tree3a4e1323112a7aef8db37c00ac69fe54ef593e39 /drivers/gpu
parent98755a51fbfd12a9eb3379bc51941375934545b4 (diff)
drm: Don't complain too much about struct_mutex.
For modern drivers the DRM core doesn't use struct_mutex at all, which means it's defacto a driver-private lock. But since we still need it for legacy drivers we can't initialize it in drivers, which means all the different instances share one lockdep key. Despite that they might be placed in totally different places in the locking hierarchy. This results in a lot of bogus lockdep splats when running stuff on systems with multiple gpus. Partially remedy the situation by only doing might_lock checks on drivers that do use struct_mutex still for gem locking. A more complete solution would be to do the mutex_init in the drm core only for legacy drivers, plus add it to each modern driver that still needs it, which would also give each its own lockdep key. Trying to do that dynamically doesn't work, because lockdep requires it's keys to be statically allocated. v2: {} everywhere (Chris) Cc: Hans de Goede <hdegoede@redhat.com> Cc: Ben Skeggs <bskeggs@redhat.com> Cc: Jiri Slaby <jirislaby@gmail.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Ingo Molnar <mingo@redhat.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20170715095328.25671-1-daniel.vetter@ffwll.ch
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/drm_gem.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c
index 8dc11064253d..5df028a6dd9f 100644
--- a/drivers/gpu/drm/drm_gem.c
+++ b/drivers/gpu/drm/drm_gem.c
@@ -826,13 +826,15 @@ drm_gem_object_put_unlocked(struct drm_gem_object *obj)
826 return; 826 return;
827 827
828 dev = obj->dev; 828 dev = obj->dev;
829 might_lock(&dev->struct_mutex);
830 829
831 if (dev->driver->gem_free_object_unlocked) 830 if (dev->driver->gem_free_object_unlocked) {
832 kref_put(&obj->refcount, drm_gem_object_free); 831 kref_put(&obj->refcount, drm_gem_object_free);
833 else if (kref_put_mutex(&obj->refcount, drm_gem_object_free, 832 } else {
833 might_lock(&dev->struct_mutex);
834 if (kref_put_mutex(&obj->refcount, drm_gem_object_free,
834 &dev->struct_mutex)) 835 &dev->struct_mutex))
835 mutex_unlock(&dev->struct_mutex); 836 mutex_unlock(&dev->struct_mutex);
837 }
836} 838}
837EXPORT_SYMBOL(drm_gem_object_put_unlocked); 839EXPORT_SYMBOL(drm_gem_object_put_unlocked);
838 840