Message ID | 20200117113259.3023890-1-chris@chris-wilson.co.uk (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | drm/i915/gt: Report the currently active execlists request | expand |
Chris Wilson <chris@chris-wilson.co.uk> writes: > Since commit 22b7a426bbe1 ("drm/i915/execlists: Preempt-to-busy"), we > prune the engine->active.requests list prior to preemption, thus > removing the trace of the currently executing request. If that request > hangs rather than be preempted, we conclude that no active request was > on the GPU. Fortunately, this only impacts our debugging, and not our > means of hang detection or recovery. > > v2: Use from to check the current iterator before continuing, and report > active as NULL if the current request is already completed. > > References: 22b7a426bbe1 ("drm/i915/execlists: Preempt-to-busy") > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> > Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com> Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com> > --- > drivers/gpu/drm/i915/gt/intel_engine_cs.c | 17 +++++++++++++++++ > 1 file changed, 17 insertions(+) > > diff --git a/drivers/gpu/drm/i915/gt/intel_engine_cs.c b/drivers/gpu/drm/i915/gt/intel_engine_cs.c > index 06ff7695fa29..2d0ef5fc6748 100644 > --- a/drivers/gpu/drm/i915/gt/intel_engine_cs.c > +++ b/drivers/gpu/drm/i915/gt/intel_engine_cs.c > @@ -1657,6 +1657,23 @@ intel_engine_find_active_request(struct intel_engine_cs *engine) > * we only care about the snapshot of this moment. > */ > lockdep_assert_held(&engine->active.lock); > + > + rcu_read_lock(); > + request = execlists_active(&engine->execlists); > + if (request) { > + struct intel_timeline *tl = request->context->timeline; > + > + list_for_each_entry_from_reverse(request, &tl->requests, link) { > + if (i915_request_completed(request)) > + break; > + > + active = request; > + } > + } > + rcu_read_unlock(); > + if (active) > + return active; > + > list_for_each_entry(request, &engine->active.requests, sched.link) { > if (i915_request_completed(request)) > continue; > -- > 2.25.0
diff --git a/drivers/gpu/drm/i915/gt/intel_engine_cs.c b/drivers/gpu/drm/i915/gt/intel_engine_cs.c index 06ff7695fa29..2d0ef5fc6748 100644 --- a/drivers/gpu/drm/i915/gt/intel_engine_cs.c +++ b/drivers/gpu/drm/i915/gt/intel_engine_cs.c @@ -1657,6 +1657,23 @@ intel_engine_find_active_request(struct intel_engine_cs *engine) * we only care about the snapshot of this moment. */ lockdep_assert_held(&engine->active.lock); + + rcu_read_lock(); + request = execlists_active(&engine->execlists); + if (request) { + struct intel_timeline *tl = request->context->timeline; + + list_for_each_entry_from_reverse(request, &tl->requests, link) { + if (i915_request_completed(request)) + break; + + active = request; + } + } + rcu_read_unlock(); + if (active) + return active; + list_for_each_entry(request, &engine->active.requests, sched.link) { if (i915_request_completed(request)) continue;
Since commit 22b7a426bbe1 ("drm/i915/execlists: Preempt-to-busy"), we prune the engine->active.requests list prior to preemption, thus removing the trace of the currently executing request. If that request hangs rather than be preempted, we conclude that no active request was on the GPU. Fortunately, this only impacts our debugging, and not our means of hang detection or recovery. v2: Use from to check the current iterator before continuing, and report active as NULL if the current request is already completed. References: 22b7a426bbe1 ("drm/i915/execlists: Preempt-to-busy") Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com> --- drivers/gpu/drm/i915/gt/intel_engine_cs.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)