[PATCH 5/5] drm/i915: Explode in CI if we leak obj->mm.pages
Chris Wilson
chris at chris-wilson.co.uk
Sun Jan 20 20:57:13 UTC 2019
Promote the delayed WARN_ON(has_pinned_pages) to a GEM_BUG_ON() at the
point of freeing the object so that we can a stacktrace of the offending
caller (and not from the worker).
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
drivers/gpu/drm/i915/i915_gem.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index b359390ba22c..17a31aff6c32 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -4359,8 +4359,7 @@ static void __i915_gem_free_objects(struct drm_i915_private *i915,
if (obj->ops->release)
obj->ops->release(obj);
- if (WARN_ON(i915_gem_object_has_pinned_pages(obj)))
- atomic_set(&obj->mm.pages_pin_count, 0);
+ atomic_set(&obj->mm.pages_pin_count, 0); /* paper over leaks */
__i915_gem_object_put_pages(obj, I915_MM_NORMAL);
GEM_BUG_ON(i915_gem_object_has_pages(obj));
@@ -4463,6 +4462,8 @@ void i915_gem_free_object(struct drm_gem_object *gem_obj)
if (obj->mm.quirked)
__i915_gem_object_unpin_pages(obj);
+ GEM_BUG_ON(atomic_read(&obj->mm.pages_pin_count) > READ_ONCE(obj->bind_count));
+
if (discard_backing_storage(obj))
obj->mm.madv = I915_MADV_DONTNEED;
--
2.20.1
More information about the Intel-gfx-trybot
mailing list