This patch reduces the BUG_ON when pin_count reaches max to a warning.
The reason we want to just warn is because the unpin_work_fn work
function can get starved out during soft lockup. When the unpin worker
is starved, the pin_count rises, and the gem BUG_ON races the soft
lockup crash reporter.

The original intent of this BUG was to catch overflow cases when all of
the small bitfields in drm_i915_gem_object were combined into one
bitfield (commit 778c35444). Since pin leaks aren't an issue in steady
state, it should be fine to downgrade the error.

Signed-off-by: Sean Paul <seanp...@chromium.org>
---
 drivers/gpu/drm/i915/i915_gem.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 6d2180c..65ff55d 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -3016,7 +3016,10 @@ i915_gem_object_pin(struct drm_i915_gem_object *obj,
 {
        int ret;
 
-       BUG_ON(obj->pin_count == DRM_I915_GEM_OBJECT_MAX_PIN_COUNT);
+       if (obj->pin_count == DRM_I915_GEM_OBJECT_MAX_PIN_COUNT) {
+               WARN(obj->pin_count, "pin count has reached its max\n");
+               return obj->pin_count;
+       }
 
        if (obj->gtt_space != NULL) {
                if ((alignment && obj->gtt_offset & (alignment - 1)) ||
-- 
1.7.7.3

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to