@@ -163,7 +163,7 @@ static inline int __i915_gem_object_lock(struct drm_i915_gem_object *obj,
ret = 0;
if (ret == -EDEADLK)
- ww->contended = obj;
+ ww->contended = i915_gem_object_get(obj);
return ret;
}
@@ -1370,9 +1370,16 @@ int __must_check i915_gem_ww_ctx_backoff(struct i915_gem_ww_ctx *ww)
else
dma_resv_lock_slow(ww->contended->base.resv, &ww->ctx);
+ /*
+ * Unlocking the contended lock again, as might not need it in
+ * the retried transaction. This does not increase starvation,
+ * but it's opening up for a wakeup flood if there are many
+ * transactions relaxing on this object.
+ */
if (!ret)
- list_add_tail(&ww->contended->obj_link, &ww->obj_list);
+ dma_resv_unlock(ww->contended->base.resv);
+ i915_gem_object_put(ww->contended);
ww->contended = NULL;
return ret;