Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/i915: Catch premature unpinning of pages

Try to catch the violation of unpinning the backing storage whilst still
bound to the GPU.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: http://patchwork.freedesktop.org/patch/msgid/20161019101147.17342-5-chris@chris-wilson.co.uk
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

+3 -2
+3 -2
drivers/gpu/drm/i915/i915_drv.h
··· 3181 3181 3182 3182 static inline void i915_gem_object_pin_pages(struct drm_i915_gem_object *obj) 3183 3183 { 3184 - BUG_ON(obj->pages == NULL); 3184 + GEM_BUG_ON(obj->pages == NULL); 3185 3185 obj->pages_pin_count++; 3186 3186 } 3187 3187 3188 3188 static inline void i915_gem_object_unpin_pages(struct drm_i915_gem_object *obj) 3189 3189 { 3190 - BUG_ON(obj->pages_pin_count == 0); 3190 + GEM_BUG_ON(obj->pages_pin_count == 0); 3191 3191 obj->pages_pin_count--; 3192 + GEM_BUG_ON(obj->pages_pin_count < obj->bind_count); 3192 3193 } 3193 3194 3194 3195 enum i915_map_type {