All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 01/31] drm/i915: Defer modeset cleanup to a secondary task
@ 2018-06-25  9:48 Chris Wilson
  2018-06-25  9:48 ` [PATCH 02/31] drm/i915/execlists: Check for ce->state before destroy Chris Wilson
                   ` (36 more replies)
  0 siblings, 37 replies; 78+ messages in thread
From: Chris Wilson @ 2018-06-25  9:48 UTC (permalink / raw)
  To: intel-gfx

If we avoid cleaning up the old state immediately in
intel_atomic_commit_tail() and defer it to a second task, we can avoid
taking heavily contended locks when the caller is ready to procede.
Subsequent modesets will wait for the cleanup operation (either directly
via the ordered modeset wq or indirectly through the atomic helperr)
which keeps the number of inflight cleanup tasks in check.

As an example, during reset an immediate modeset is performed to disable
the displays before the HW is reset, which must avoid struct_mutex to
avoid recursion. Moving the cleanup to a separate task, defers acquiring
the struct_mutex to after the GPU is running again, allowing it to
complete. Even in a few patches time (optimist!) when we no longer
require struct_mutex to unpin the framebuffers, it will still be good
practice to minimise the number of contention points along reset. The
mutex dependency still exists (as one modeset flushes the other), but in
the short term it resolves the deadlock for simple reset cases.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/intel_display.c | 30 +++++++++++++++++++++-------
 1 file changed, 23 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 3d849ec17f5c..3709fa1b6318 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -12554,6 +12554,19 @@ static void intel_atomic_commit_fence_wait(struct intel_atomic_state *intel_stat
 	finish_wait(&dev_priv->gpu_error.wait_queue, &wait_reset);
 }
 
+static void intel_atomic_cleanup_work(struct work_struct *work)
+{
+	struct drm_atomic_state *state =
+		container_of(work, struct drm_atomic_state, commit_work);
+	struct drm_i915_private *i915 = to_i915(state->dev);
+
+	drm_atomic_helper_cleanup_planes(&i915->drm, state);
+	drm_atomic_helper_commit_cleanup_done(state);
+	drm_atomic_state_put(state);
+
+	intel_atomic_helper_free_state(i915);
+}
+
 static void intel_atomic_commit_tail(struct drm_atomic_state *state)
 {
 	struct drm_device *dev = state->dev;
@@ -12714,13 +12727,16 @@ static void intel_atomic_commit_tail(struct drm_atomic_state *state)
 		intel_display_power_put(dev_priv, POWER_DOMAIN_MODESET);
 	}
 
-	drm_atomic_helper_cleanup_planes(dev, state);
-
-	drm_atomic_helper_commit_cleanup_done(state);
-
-	drm_atomic_state_put(state);
-
-	intel_atomic_helper_free_state(dev_priv);
+	/*
+	 * Defer the cleanup of the old state to a separate worker to not
+	 * impede the current task (userspace for blocking modesets) that
+	 * are executed inline. For out-of-line asynchronous modesets/flips,
+	 * deferring to a new worker seems overkill, but we would place a
+	 * schedule point (cond_resched()) here anyway to keep latencies
+	 * down.
+	 */
+	INIT_WORK(&state->commit_work, intel_atomic_cleanup_work);
+	schedule_work(&state->commit_work);
 }
 
 static void intel_atomic_commit_work(struct work_struct *work)
-- 
2.18.0

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

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

end of thread, other threads:[~2018-06-28 13:03 UTC | newest]

Thread overview: 78+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-25  9:48 [PATCH 01/31] drm/i915: Defer modeset cleanup to a secondary task Chris Wilson
2018-06-25  9:48 ` [PATCH 02/31] drm/i915/execlists: Check for ce->state before destroy Chris Wilson
2018-06-25  9:48 ` [PATCH 03/31] drm/i915/execlists: Pull submit after dequeue under timeline lock Chris Wilson
2018-06-25 10:51   ` Tvrtko Ursulin
2018-06-25 10:55     ` Chris Wilson
2018-06-25  9:48 ` [PATCH 04/31] drm/i915/execlists: Pull CSB reset under the timeline.lock Chris Wilson
2018-06-26 10:59   ` Tvrtko Ursulin
2018-06-26 11:04     ` Chris Wilson
2018-06-26 11:50   ` [PATCH v4] " Chris Wilson
2018-06-27  9:33     ` Tvrtko Ursulin
2018-06-25  9:48 ` [PATCH 05/31] drm/i915/execlists: Process one CSB update at a time Chris Wilson
2018-06-27  9:46   ` Tvrtko Ursulin
2018-06-27 10:26     ` Chris Wilson
2018-06-27 10:43   ` [PATCH v2] " Chris Wilson
2018-06-25  9:48 ` [PATCH 06/31] drm/i915/execlists: Unify CSB access pointers Chris Wilson
2018-06-27  9:52   ` Tvrtko Ursulin
2018-06-27 10:35     ` Chris Wilson
2018-06-27 13:03       ` Tvrtko Ursulin
2018-06-27 13:09         ` Chris Wilson
2018-06-27 13:24           ` Tvrtko Ursulin
2018-06-27 13:32             ` Chris Wilson
2018-06-27 11:21     ` [PATCH] drm/i915/execlists: Reset CSB write pointer after reset Chris Wilson
2018-06-25  9:48 ` [PATCH 07/31] drm/i915/execlists: Direct submission of new requests (avoid tasklet/ksoftirqd) Chris Wilson
2018-06-27 10:40   ` Tvrtko Ursulin
2018-06-27 10:58     ` Chris Wilson
2018-06-27 13:15       ` Tvrtko Ursulin
2018-06-27 13:29         ` Chris Wilson
2018-06-27 15:21           ` Tvrtko Ursulin
2018-06-27 15:28             ` Chris Wilson
2018-06-28 11:56               ` Tvrtko Ursulin
2018-06-28 12:07                 ` Chris Wilson
2018-06-28 12:11                   ` Chris Wilson
2018-06-28 12:29                     ` Tvrtko Ursulin
2018-06-28 12:35                       ` Chris Wilson
2018-06-28 13:03                         ` Tvrtko Ursulin
2018-06-25  9:48 ` [PATCH 08/31] drm/i915: Move rate-limiting request retire to after submission Chris Wilson
2018-06-27 10:57   ` Tvrtko Ursulin
2018-06-27 11:16     ` Chris Wilson
2018-06-27 13:28       ` Tvrtko Ursulin
2018-06-27 13:37         ` Chris Wilson
2018-06-25  9:48 ` [PATCH 09/31] drm/i915: Wait for engines to idle before retiring Chris Wilson
2018-06-27 11:32   ` Tvrtko Ursulin
2018-06-27 11:41     ` Chris Wilson
2018-06-25  9:48 ` [PATCH 10/31] drm/i915: Move engine request retirement to intel_engine_cs Chris Wilson
2018-06-25  9:48 ` [PATCH 11/31] drm/i915: Hold request reference for submission until retirement Chris Wilson
2018-06-25  9:48 ` [PATCH 12/31] drm/i915: Reduce spinlock hold time during notify_ring() interrupt Chris Wilson
2018-06-27 13:08   ` Mika Kuoppala
2018-06-27 13:14     ` Chris Wilson
2018-06-27 14:01       ` Mika Kuoppala
2018-06-25  9:48 ` [PATCH 13/31] drm/i915: Move the irq_counter inside the spinlock Chris Wilson
2018-06-27 14:23   ` Mika Kuoppala
2018-06-25  9:48 ` [PATCH 14/31] drm/i915: Only signal from interrupt when requested Chris Wilson
2018-06-27 14:52   ` Mika Kuoppala
2018-06-25  9:48 ` [PATCH 15/31] drm/i915/execlists: Switch to rb_root_cached Chris Wilson
2018-06-25  9:48 ` [PATCH 16/31] drm/i915: Reserve some priority bits for internal use Chris Wilson
2018-06-25  9:48 ` [PATCH 17/31] drm/i915: Combine multiple internal plists into the same i915_priolist bucket Chris Wilson
2018-06-25  9:48 ` [PATCH 18/31] drm/i915: Priority boost for new clients Chris Wilson
2018-06-25  9:48 ` [PATCH 19/31] drm/i915: Priority boost switching to an idle ring Chris Wilson
2018-06-25  9:48 ` [PATCH 20/31] drm/i915: Refactor export_fence() after i915_vma_move_to_active() Chris Wilson
2018-06-25  9:48 ` [PATCH 21/31] drm/i915: Export i915_request_skip() Chris Wilson
2018-06-25  9:48 ` [PATCH 22/31] drm/i915: Start returning an error from i915_vma_move_to_active() Chris Wilson
2018-06-25  9:48 ` [PATCH 23/31] drm/i915: Track vma activity per fence.context, not per engine Chris Wilson
2018-06-25  9:48 ` [PATCH 24/31] drm/i915: Track the last-active inside the i915_vma Chris Wilson
2018-06-25  9:48 ` [PATCH 25/31] drm/i915: Stop tracking MRU activity on VMA Chris Wilson
2018-06-25  9:48 ` [PATCH 26/31] drm/i915: Introduce i915_address_space.mutex Chris Wilson
2018-06-25  9:48 ` [PATCH 27/31] drm/i915: Move fence register tracking to GGTT Chris Wilson
2018-06-25  9:48 ` [PATCH 28/31] drm/i915: Convert fences to use a GGTT lock rather than struct_mutex Chris Wilson
2018-06-25  9:48 ` [PATCH 29/31] drm/i915: Tidy i915_gem_suspend() Chris Wilson
2018-06-25  9:48 ` [PATCH 30/31] drm/i915: Pull all the reset functionality together into i915_reset.c Chris Wilson
2018-06-25  9:48 ` [PATCH 31/31] drm/i915: Remove GPU reset dependence on struct_mutex Chris Wilson
2018-06-25 10:32 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [01/31] drm/i915: Defer modeset cleanup to a secondary task Patchwork
2018-06-25 10:44 ` ✗ Fi.CI.SPARSE: " Patchwork
2018-06-25 10:57 ` ✓ Fi.CI.BAT: success " Patchwork
2018-06-25 14:44 ` ✗ Fi.CI.IGT: failure " Patchwork
2018-06-26  9:28   ` Chris Wilson
2018-06-26 11:51 ` ✗ Fi.CI.BAT: failure for series starting with [01/31] drm/i915: Defer modeset cleanup to a secondary task (rev2) Patchwork
2018-06-27 11:00 ` ✗ Fi.CI.BAT: failure for series starting with [01/31] drm/i915: Defer modeset cleanup to a secondary task (rev3) Patchwork
2018-06-27 12:27 ` ✗ Fi.CI.BAT: failure for series starting with [01/31] drm/i915: Defer modeset cleanup to a secondary task (rev4) Patchwork

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.