Commit 7a5580a2 authored by Chris Wilson's avatar Chris Wilson

drm/i915: Move assert of page pin vs bind count into i915_vma_unbind

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: default avatarChris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20161231112012.29263-1-chris@chris-wilson.co.uk
parent f50b79f0
...@@ -3291,7 +3291,6 @@ __i915_gem_object_unpin_pages(struct drm_i915_gem_object *obj) ...@@ -3291,7 +3291,6 @@ __i915_gem_object_unpin_pages(struct drm_i915_gem_object *obj)
GEM_BUG_ON(!obj->mm.pages); GEM_BUG_ON(!obj->mm.pages);
atomic_dec(&obj->mm.pages_pin_count); atomic_dec(&obj->mm.pages_pin_count);
GEM_BUG_ON(atomic_read(&obj->mm.pages_pin_count) < obj->bind_count);
} }
static inline void static inline void
......
...@@ -640,6 +640,7 @@ int i915_vma_unbind(struct i915_vma *vma) ...@@ -640,6 +640,7 @@ int i915_vma_unbind(struct i915_vma *vma)
* reaped by the shrinker. * reaped by the shrinker.
*/ */
i915_gem_object_unpin_pages(obj); i915_gem_object_unpin_pages(obj);
GEM_BUG_ON(atomic_read(&obj->mm.pages_pin_count) < obj->bind_count);
destroy: destroy:
if (unlikely(i915_vma_is_closed(vma))) if (unlikely(i915_vma_is_closed(vma)))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment