]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
drm/i915: Move assert of page pin vs bind count into i915_vma_unbind
authorChris Wilson <chris@chris-wilson.co.uk>
Sat, 31 Dec 2016 11:20:09 +0000 (11:20 +0000)
committerChris Wilson <chris@chris-wilson.co.uk>
Sat, 31 Dec 2016 11:41:45 +0000 (11:41 +0000)
The read of the page pin count and the bind count are unordered,
presenting races in the assert and it firing off incorrectly. Prevent
this by restricting the assert to the vma bind/unbind routines where we
have local cpu ordering between the two.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20161231112012.29263-1-chris@chris-wilson.co.uk
drivers/gpu/drm/i915/i915_drv.h
drivers/gpu/drm/i915/i915_vma.c

index 576b5718ed88bcd260a37b42ea3bf51ca7d84d6e..843f7c624091f9a15a9f4da6fdca9203e71be3b1 100644 (file)
@@ -3291,7 +3291,6 @@ __i915_gem_object_unpin_pages(struct drm_i915_gem_object *obj)
        GEM_BUG_ON(!obj->mm.pages);
 
        atomic_dec(&obj->mm.pages_pin_count);
-       GEM_BUG_ON(atomic_read(&obj->mm.pages_pin_count) < obj->bind_count);
 }
 
 static inline void
index 868d061e1a11d2ee636c6985388c09aad156efc0..e008e4e8b4817d0749e58952dc83710f21c6c8bc 100644 (file)
@@ -640,6 +640,7 @@ int i915_vma_unbind(struct i915_vma *vma)
         * reaped by the shrinker.
         */
        i915_gem_object_unpin_pages(obj);
+       GEM_BUG_ON(atomic_read(&obj->mm.pages_pin_count) < obj->bind_count);
 
 destroy:
        if (unlikely(i915_vma_is_closed(vma)))