From 13ed13a4dcbf0b664acbf9e6f98ec7851cc59862 Mon Sep 17 00:00:00 2001
From: Chris Wilson <chris@chris-wilson.co.uk>
Date: Mon, 21 Oct 2019 09:02:11 +0100
Subject: drm/i915: Don't set queue_priority_hint if we don't kick the
submission
Git-commit: 13ed13a4dcbf0b664acbf9e6f98ec7851cc59862
Patch-mainline: v5.5-rc1
References: bsc#1152489
If we change the priority of the active context, then it has no impact
on the decision of whether to preempt the active context -- we don't
preempt the context with itself. In this situation, we elide the tasklet
rescheduling and should *not* be marking up the queue_priority_hint as
that may mask a later submission where we decide we don't have to kick
the tasklet as a higher priority submission is pending (spoiler alert,
it was not).
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20191021080226.537-1-chris@chris-wilson.co.uk
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
---
drivers/gpu/drm/i915/i915_scheduler.c | 24 +++++++-----------------
1 file changed, 7 insertions(+), 17 deletions(-)
--- a/drivers/gpu/drm/i915/i915_scheduler.c
+++ b/drivers/gpu/drm/i915/i915_scheduler.c
@@ -193,8 +193,7 @@ static void kick_submission(struct intel
const struct i915_request *rq,
int prio)
{
- const struct i915_request *inflight =
- execlists_active(&engine->execlists);
+ const struct i915_request *inflight;
/*
* We only need to kick the tasklet once for the high priority
@@ -203,30 +202,21 @@ static void kick_submission(struct intel
if (prio <= engine->execlists.queue_priority_hint)
return;
- rcu_read_lock();
-
/* Nothing currently active? We're overdue for a submission! */
+ inflight = execlists_active(&engine->execlists);
if (!inflight)
- goto unlock;
+ return;
/*
* If we are already the currently executing context, don't
- * bother evaluating if we should preempt ourselves, or if
- * we expect nothing to change as a result of running the
- * tasklet, i.e. we have not change the priority queue
- * sufficiently to oust the running context.
+ * bother evaluating if we should preempt ourselves.
*/
if (inflight->hw_context == rq->hw_context)
- goto unlock;
+ return;
engine->execlists.queue_priority_hint = prio;
- if (inflight && need_preempt(prio, rq_prio(inflight)))
- goto unlock;
-
- tasklet_hi_schedule(&engine->execlists.tasklet);
-
-unlock:
- rcu_read_unlock();
+ if (need_preempt(prio, rq_prio(inflight)))
+ tasklet_hi_schedule(&engine->execlists.tasklet);
}
static void __i915_schedule(struct i915_sched_node *node,