From: Chris Wilson <chris@chris-wilson.co.uk>
To: intel-gfx@lists.freedesktop.org
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Subject: [Intel-gfx] [PATCH 02/10] drm/i915/gt: Skip over completed active execlists, again
Date: Wed, 20 Jan 2021 12:21:57 +0000 [thread overview]
Message-ID: <20210120122205.2808-2-chris@chris-wilson.co.uk> (raw)
In-Reply-To: <20210120122205.2808-1-chris@chris-wilson.co.uk>
Now that we are careful to always force-restore contexts upon rewinding
(where necessary), we can restore our optimisation to skip over
completed active execlists when dequeuing.
Referenecs: 35f3fd8182ba ("drm/i915/execlists: Workaround switching back to a completed context")
References: 8ab3a3812aa9 ("drm/i915/gt: Incrementally check for rewinding")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
---
.../drm/i915/gt/intel_execlists_submission.c | 34 +++++++++----------
1 file changed, 16 insertions(+), 18 deletions(-)
diff --git a/drivers/gpu/drm/i915/gt/intel_execlists_submission.c b/drivers/gpu/drm/i915/gt/intel_execlists_submission.c
index 524c8b54d220..ac1be7a632d3 100644
--- a/drivers/gpu/drm/i915/gt/intel_execlists_submission.c
+++ b/drivers/gpu/drm/i915/gt/intel_execlists_submission.c
@@ -1224,12 +1224,20 @@ static void set_preempt_timeout(struct intel_engine_cs *engine,
active_preempt_timeout(engine, rq));
}
+static bool completed(const struct i915_request *rq)
+{
+ if (i915_request_has_sentinel(rq))
+ return false;
+
+ return __i915_request_is_complete(rq);
+}
+
static void execlists_dequeue(struct intel_engine_cs *engine)
{
struct intel_engine_execlists * const execlists = &engine->execlists;
struct i915_request **port = execlists->pending;
struct i915_request ** const last_port = port + execlists->port_mask;
- struct i915_request *last = *execlists->active;
+ struct i915_request *last, * const *active;
struct virtual_engine *ve;
struct rb_node *rb;
bool submit = false;
@@ -1266,21 +1274,13 @@ static void execlists_dequeue(struct intel_engine_cs *engine)
* i.e. we will retrigger preemption following the ack in case
* of trouble.
*
- * In theory we can skip over completed contexts that have not
- * yet been processed by events (as those events are in flight):
- *
- * while ((last = *active) && i915_request_completed(last))
- * active++;
- *
- * However, the GPU cannot handle this as it will ultimately
- * find itself trying to jump back into a context it has just
- * completed and barf.
*/
+ active = execlists->active;
+ while ((last = *active) && completed(last))
+ active++;
if (last) {
- if (__i915_request_is_complete(last)) {
- goto check_secondary;
- } else if (need_preempt(engine, last)) {
+ if (need_preempt(engine, last)) {
ENGINE_TRACE(engine,
"preempting last=%llx:%lld, prio=%d, hint=%d\n",
last->fence.context,
@@ -1359,9 +1359,7 @@ static void execlists_dequeue(struct intel_engine_cs *engine)
* we hopefully coalesce several updates into a single
* submission.
*/
-check_secondary:
- if (!list_is_last(&last->sched.link,
- &engine->active.requests)) {
+ if (active[1]) {
/*
* Even if ELSP[1] is occupied and not worthy
* of timeslices, our queue might be.
@@ -1562,7 +1560,7 @@ static void execlists_dequeue(struct intel_engine_cs *engine)
* of ordered contexts.
*/
if (submit &&
- memcmp(execlists->active,
+ memcmp(active,
execlists->pending,
(port - execlists->pending) * sizeof(*port))) {
*port = NULL;
@@ -1570,7 +1568,7 @@ static void execlists_dequeue(struct intel_engine_cs *engine)
execlists_schedule_in(*port, port - execlists->pending);
WRITE_ONCE(execlists->yield, -1);
- set_preempt_timeout(engine, *execlists->active);
+ set_preempt_timeout(engine, *active);
execlists_submit_ports(engine);
} else {
ring_set_paused(engine, 0);
--
2.20.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2021-01-20 12:22 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-20 12:21 [Intel-gfx] [PATCH 01/10] drm/i915/gt: Do not suspend bonded requests if one hangs Chris Wilson
2021-01-20 12:21 ` Chris Wilson [this message]
2021-01-21 15:23 ` [Intel-gfx] [PATCH 02/10] drm/i915/gt: Skip over completed active execlists, again Andi Shyti
2021-01-20 12:21 ` [Intel-gfx] [PATCH 03/10] drm/i915: Strip out internal priorities Chris Wilson
2021-01-21 15:23 ` Andi Shyti
2021-01-21 15:30 ` Chris Wilson
2021-01-20 12:21 ` [Intel-gfx] [PATCH 04/10] drm/i915: Remove I915_USER_PRIORITY_SHIFT Chris Wilson
2021-01-21 15:25 ` Andi Shyti
2021-01-20 12:22 ` [Intel-gfx] [PATCH 05/10] drm/i915: Replace engine->schedule() with a known request operation Chris Wilson
2021-01-21 15:49 ` Andi Shyti
2021-01-21 16:25 ` Chris Wilson
2021-01-20 12:22 ` [Intel-gfx] [PATCH 06/10] drm/i915: Teach the i915_dependency to use a double-lock Chris Wilson
2021-01-20 12:22 ` [Intel-gfx] [PATCH 07/10] drm/i915: Restructure priority inheritance Chris Wilson
2021-01-26 17:18 ` Andi Shyti
2021-01-26 19:03 ` Chris Wilson
2021-01-20 12:22 ` [Intel-gfx] [PATCH 08/10] drm/i915/selftests: Measure set-priority duration Chris Wilson
2021-01-26 18:05 ` Andi Shyti
2021-01-26 21:16 ` Chris Wilson
2021-01-20 12:22 ` [Intel-gfx] [PATCH 09/10] drm/i915/selftests: Exercise priority inheritance around an engine loop Chris Wilson
2021-01-20 12:22 ` [Intel-gfx] [PATCH 10/10] drm/i915: Improve DFS for priority inheritance Chris Wilson
2021-01-26 17:34 ` Andi Shyti
2021-01-26 21:20 ` Chris Wilson
2021-01-20 19:22 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for series starting with [01/10] drm/i915/gt: Do not suspend bonded requests if one hangs Patchwork
2021-01-20 19:23 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2021-01-20 19:51 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2021-01-20 23:04 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork
2021-01-21 15:19 ` [Intel-gfx] [PATCH 01/10] " Andi Shyti
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210120122205.2808-2-chris@chris-wilson.co.uk \
--to=chris@chris-wilson.co.uk \
--cc=intel-gfx@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).