diff mbox

4.9-rc1 lockdep warning suggesting a deadlock between nouveau and i915 with prime video outputs active

Message ID 149995469805.29380.5405466287939095053@mail.alporthouse.com (mailing list archive)
State New, archived
Headers show

Commit Message

Chris Wilson July 13, 2017, 2:04 p.m. UTC
Quoting Jiri Slaby (2017-07-13 14:57:31)
> Stealing this thread as an opensuse user hit that too:
> https://bugzilla.suse.com/show_bug.cgi?id=1045105

It's a false positive. I did once upon a time send some patches to move
the lockdep warning to kref so that didn't need to call it from drm
before an unlocked path. Basically you want



Though now we probably want to move that might_lock() into refcount.
-Chris
diff mbox

Patch

diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c
index 8dc11064253d..3118aed844f1 100644
--- a/drivers/gpu/drm/drm_gem.c
+++ b/drivers/gpu/drm/drm_gem.c
@@ -826,7 +826,6 @@  drm_gem_object_put_unlocked(struct drm_gem_object *obj)
                return;
 
        dev = obj->dev;
-       might_lock(&dev->struct_mutex);
 
        if (dev->driver->gem_free_object_unlocked)
                kref_put(&obj->refcount, drm_gem_object_free);
diff --git a/include/linux/kref.h b/include/linux/kref.h
index 29220724bf1c..4b1133cd5d20 100644
--- a/include/linux/kref.h
+++ b/include/linux/kref.h
@@ -77,6 +77,8 @@  static inline int kref_put_mutex(struct kref *kref,
                                 void (*release)(struct kref *kref),
                                 struct mutex *lock)
 {
+       might_lock(lock);
+
        if (refcount_dec_and_mutex_lock(&kref->refcount, lock)) {
                release(kref);
                return 1;