diff mbox series

[3/5] drm/i915/gt: Only retire on the last breadcrumb if the last request

Message ID 20210107221724.10036-3-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show
Series [1/5] drm/i915/selftests: Skip unstable timing measurements | expand

Commit Message

Chris Wilson Jan. 7, 2021, 10:17 p.m. UTC
We use the completion of the last active breadcrumb to retire the
requests along a timeline. This is purely opportunistic as nothing
guarantees that any particular timeline is terminated by a breadcrumb;
except for the parking the engine. We explicitly add a breadcrumb to
parking the engine so that we park quickly and do an explicit retire
upon signaling to reduce the latency dramatically.

With scheduling, we anticipate retiring completed timelines as a matter
of course. Performing the same action from inside the breadcrumbs is
intended to provide similar functionality for legacy ringbuffer
submission.

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

Comments

Andi Shyti Jan. 8, 2021, 3:55 p.m. UTC | #1
Hi Chris,

On Thu, Jan 07, 2021 at 10:17:22PM +0000, Chris Wilson wrote:
> We use the completion of the last active breadcrumb to retire the
> requests along a timeline. This is purely opportunistic as nothing
> guarantees that any particular timeline is terminated by a breadcrumb;
> except for the parking the engine. We explicitly add a breadcrumb to
> parking the engine so that we park quickly and do an explicit retire
> upon signaling to reduce the latency dramatically.
> 
> With scheduling, we anticipate retiring completed timelines as a matter
> of course. Performing the same action from inside the breadcrumbs is
> intended to provide similar functionality for legacy ringbuffer
> submission.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

Reviewed-by: Andi Shyti <andi.shyti@intel.com>

Andi
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/gt/intel_breadcrumbs.c b/drivers/gpu/drm/i915/gt/intel_breadcrumbs.c
index 7137b6f24f55..6996e22ba65b 100644
--- a/drivers/gpu/drm/i915/gt/intel_breadcrumbs.c
+++ b/drivers/gpu/drm/i915/gt/intel_breadcrumbs.c
@@ -257,17 +257,19 @@  static void signal_irq_work(struct irq_work *work)
 			list_del_rcu(&rq->signal_link);
 			release = remove_signaling_context(b, ce);
 			spin_unlock(&ce->signal_lock);
+			if (release) {
+				if (list_is_last_rcu(&rq->link,
+						     &ce->timeline->requests))
+					add_retire(b, ce->timeline);
+
+				intel_context_put(ce);
+			}
 
 			if (__dma_fence_signal(&rq->fence))
 				/* We own signal_node now, xfer to local list */
 				signal = slist_add(&rq->signal_node, signal);
 			else
 				i915_request_put(rq);
-
-			if (release) {
-				add_retire(b, ce->timeline);
-				intel_context_put(ce);
-			}
 		}
 	}
 	atomic_dec(&b->signaler_active);