Commit 7d148635 authored by Chris Wilson's avatar Chris Wilson

drm/i915: Protect request peeking with RCU

Since the execlists_active() is no longer protected by the
engine->active.lock, we need to protect the request pointer with RCU to
prevent it being freed as we evaluate whether or not we need to preempt.

Fixes: df403069 ("drm/i915/execlists: Lift process_csb() out of the irq-off spinlock")
Fixes: 13ed13a4 ("drm/i915: Don't set queue_priority_hint if we don't kick the submission")
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: default avatarMika Kuoppala <mika.kuoppala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20191104090158.2959-2-chris@chris-wilson.co.uk
parent 83c55ee8
...@@ -202,21 +202,26 @@ static void kick_submission(struct intel_engine_cs *engine, ...@@ -202,21 +202,26 @@ static void kick_submission(struct intel_engine_cs *engine,
if (prio <= engine->execlists.queue_priority_hint) if (prio <= engine->execlists.queue_priority_hint)
return; return;
rcu_read_lock();
/* Nothing currently active? We're overdue for a submission! */ /* Nothing currently active? We're overdue for a submission! */
inflight = execlists_active(&engine->execlists); inflight = execlists_active(&engine->execlists);
if (!inflight) if (!inflight)
return; goto unlock;
/* /*
* If we are already the currently executing context, don't * If we are already the currently executing context, don't
* bother evaluating if we should preempt ourselves. * bother evaluating if we should preempt ourselves.
*/ */
if (inflight->hw_context == rq->hw_context) if (inflight->hw_context == rq->hw_context)
return; goto unlock;
engine->execlists.queue_priority_hint = prio; engine->execlists.queue_priority_hint = prio;
if (need_preempt(prio, rq_prio(inflight))) if (need_preempt(prio, rq_prio(inflight)))
tasklet_hi_schedule(&engine->execlists.tasklet); tasklet_hi_schedule(&engine->execlists.tasklet);
unlock:
rcu_read_unlock();
} }
static void __i915_schedule(struct i915_sched_node *node, static void __i915_schedule(struct i915_sched_node *node,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment