Commit 128260a4 authored by Chris Wilson's avatar Chris Wilson Committed by Rodrigo Vivi

drm/i915/execlists: Refactor -EIO markup of hung requests

Pull setting -EIO on the hung requests into its own utility function.
Having allowed ourselves to short-circuit submission of completed
requests, we can now do the mark_eio() prior to submission and avoid
some redundant operations.
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190923110056.15176-4-chris@chris-wilson.co.uk
(cherry picked from commit 0d7cf7bc)
Signed-off-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
parent 4f5cafb5
...@@ -234,6 +234,13 @@ static void execlists_init_reg_state(u32 *reg_state, ...@@ -234,6 +234,13 @@ static void execlists_init_reg_state(u32 *reg_state,
struct intel_engine_cs *engine, struct intel_engine_cs *engine,
struct intel_ring *ring); struct intel_ring *ring);
static void mark_eio(struct i915_request *rq)
{
if (!i915_request_signaled(rq))
dma_fence_set_error(&rq->fence, -EIO);
i915_request_mark_complete(rq);
}
static inline u32 intel_hws_preempt_address(struct intel_engine_cs *engine) static inline u32 intel_hws_preempt_address(struct intel_engine_cs *engine)
{ {
return (i915_ggtt_offset(engine->status_page.vma) + return (i915_ggtt_offset(engine->status_page.vma) +
...@@ -2574,12 +2581,8 @@ static void execlists_cancel_requests(struct intel_engine_cs *engine) ...@@ -2574,12 +2581,8 @@ static void execlists_cancel_requests(struct intel_engine_cs *engine)
__execlists_reset(engine, true); __execlists_reset(engine, true);
/* Mark all executing requests as skipped. */ /* Mark all executing requests as skipped. */
list_for_each_entry(rq, &engine->active.requests, sched.link) { list_for_each_entry(rq, &engine->active.requests, sched.link)
if (!i915_request_signaled(rq)) mark_eio(rq);
dma_fence_set_error(&rq->fence, -EIO);
i915_request_mark_complete(rq);
}
/* Flush the queued requests to the timeline list (for retiring). */ /* Flush the queued requests to the timeline list (for retiring). */
while ((rb = rb_first_cached(&execlists->queue))) { while ((rb = rb_first_cached(&execlists->queue))) {
...@@ -2587,9 +2590,8 @@ static void execlists_cancel_requests(struct intel_engine_cs *engine) ...@@ -2587,9 +2590,8 @@ static void execlists_cancel_requests(struct intel_engine_cs *engine)
int i; int i;
priolist_for_each_request_consume(rq, rn, p, i) { priolist_for_each_request_consume(rq, rn, p, i) {
mark_eio(rq);
__i915_request_submit(rq); __i915_request_submit(rq);
dma_fence_set_error(&rq->fence, -EIO);
i915_request_mark_complete(rq);
} }
rb_erase_cached(&p->node, &execlists->queue); rb_erase_cached(&p->node, &execlists->queue);
...@@ -2605,13 +2607,14 @@ static void execlists_cancel_requests(struct intel_engine_cs *engine) ...@@ -2605,13 +2607,14 @@ static void execlists_cancel_requests(struct intel_engine_cs *engine)
RB_CLEAR_NODE(rb); RB_CLEAR_NODE(rb);
spin_lock(&ve->base.active.lock); spin_lock(&ve->base.active.lock);
if (ve->request) { rq = fetch_and_zero(&ve->request);
ve->request->engine = engine; if (rq) {
__i915_request_submit(ve->request); mark_eio(rq);
dma_fence_set_error(&ve->request->fence, -EIO);
i915_request_mark_complete(ve->request); rq->engine = engine;
__i915_request_submit(rq);
ve->base.execlists.queue_priority_hint = INT_MIN; ve->base.execlists.queue_priority_hint = INT_MIN;
ve->request = NULL;
} }
spin_unlock(&ve->base.active.lock); spin_unlock(&ve->base.active.lock);
} }
......
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