All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915: Prefer to reschedule the free_object worker rather than block
@ 2017-03-28 15:18 Chris Wilson
  2017-03-28 17:06 ` ✗ Fi.CI.BAT: failure for " Patchwork
  2017-03-29  8:31 ` [PATCH] " Mika Kuoppala
  0 siblings, 2 replies; 4+ messages in thread
From: Chris Wilson @ 2017-03-28 15:18 UTC (permalink / raw)
  To: intel-gfx

Avoid blocking the kworker by putting back the freed object list if we
cannot immediately take the mutex. We will try again shortly, and flush
the work when desperate.

References: https://bugs.freedesktop.org/show_bug.cgi?id=100434
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_gem.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index ab77e38ec264..c2e5cb529b0f 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -4200,7 +4200,19 @@ static void __i915_gem_free_objects(struct drm_i915_private *i915,
 {
 	struct drm_i915_gem_object *obj, *on;
 
-	mutex_lock(&i915->drm.struct_mutex);
+	if (!mutex_trylock(&i915->drm.struct_mutex)) {
+		/* If we fail to acquire the struct_mutex, put back the
+		 * freed list and we will try again in the future. By
+		 * rescheduling the task we prevent us from blocking
+		 * the worker indefinitely on a prolonged wait for
+		 * struct_mutex.
+		 */
+		if (llist_add_batch(llist_reverse_order(freed), freed,
+				    &i915->mm.free_list))
+			schedule_work(&i915->mm.free_work);
+		return;
+	}
+
 	intel_runtime_pm_get(i915);
 	llist_for_each_entry(obj, freed, freed) {
 		struct i915_vma *vma, *vn;
-- 
2.11.0

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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-03-29  8:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-28 15:18 [PATCH] drm/i915: Prefer to reschedule the free_object worker rather than block Chris Wilson
2017-03-28 17:06 ` ✗ Fi.CI.BAT: failure for " Patchwork
2017-03-29  8:31 ` [PATCH] " Mika Kuoppala
2017-03-29  8:59   ` Chris Wilson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.