drm/i915: Check locking in i915_gem_request_unreference
authorDaniel Vetter <[email protected]>
Wed, 26 Nov 2014 09:26:05 +0000 (10:26 +0100)
committerDaniel Vetter <[email protected]>
Wed, 3 Dec 2014 08:35:18 +0000 (09:35 +0100)
With refcounting it looks like you can just drop that refcount, but
that's not really the case. So make sure no one forgets.

Motivated by the unlocked call in the mmio flip code.

Cc: John Harrison <[email protected]>
Cc: Thomas Daniel <[email protected]>
Signed-off-by: Daniel Vetter <[email protected]>
drivers/gpu/drm/i915/i915_drv.h

index 23a1afd2f7cab7e7f1073972a5b4616caf70a315..9a9372a42c97a3005f08fe4536addfa3161836f9 100644 (file)
@@ -2046,6 +2046,7 @@ i915_gem_request_reference(struct drm_i915_gem_request *req)
 static inline void
 i915_gem_request_unreference(struct drm_i915_gem_request *req)
 {
+       WARN_ON(!mutex_is_locked(&req->ring->dev->struct_mutex));
        kref_put(&req->ref, i915_gem_request_free);
 }