diff options
author | Dave Gordon <david.s.gordon@intel.com> | 2015-09-28 11:34:50 +0100 |
---|---|---|
committer | John Harrison <John.C.Harrison@Intel.com> | 2016-06-28 17:19:14 +0100 |
commit | c19450dcae071e82d1217927b370ebe24f97815c (patch) | |
tree | 7a947bb9a87cc725ef5d91b788f7c2b55ae5e0e1 | |
parent | 1fb583a345e9d1b2b337e68f1f5b5ec445502d3c (diff) |
drm/i915/error: track, capture & print ringbuffer submission activity
For: VIZ-2021
Signed-off-by: Dave Gordon <david.s.gordon@intel.com>
-rw-r--r-- | drivers/gpu/drm/i915/i915_drv.h | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem.c | 14 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/i915_gpu_error.c | 13 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_ringbuffer.h | 14 |
4 files changed, 40 insertions, 3 deletions
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 00adf493c40d..4d6dc8d913ea 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -531,6 +531,8 @@ struct drm_i915_error_state { u64 ctx_desc; + struct intel_ringbuffer req_ring; + struct drm_i915_error_object { int page_count; u64 gtt_offset; diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 95e5bdc18558..c4c1555e163e 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -2710,10 +2710,18 @@ void __i915_add_request(struct drm_i915_gem_request *request, * to explicitly hold another reference here. */ request->batch_obj = obj; - - request->emitted_jiffies = jiffies; request->previous_seqno = engine->last_submitted_seqno; - engine->last_submitted_seqno = request->seqno; + + if (engine->last_submitted_ringbuf == ringbuf) + ringbuf->resubmission_count += 1; + else + ringbuf->resubmission_count = 1; + engine->last_submitted_ringbuf = ringbuf; + ringbuf->total_submission_count += 1; + ringbuf->last_submitted_tail = request->tail; + ringbuf->last_submitted_seqno = engine->last_submitted_seqno = + request->seqno; + ringbuf->last_submitted_jiffies = request->emitted_jiffies = jiffies; list_add_tail(&request->list, &engine->request_list); trace_i915_gem_request_add(request); diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c index e7ee47993e9f..8a45b87e1afe 100644 --- a/drivers/gpu/drm/i915/i915_gpu_error.c +++ b/drivers/gpu/drm/i915/i915_gpu_error.c @@ -526,12 +526,24 @@ int i915_error_state_to_str(struct drm_i915_error_state_buf *m, } if ((obj = error->ring[i].req_ringbuffer)) { + struct intel_ringbuffer *irb = &error->ring[i].req_ring; + err_printf(m, "%s --- ringbuffer = 0x%08x; %d pages (ctx_desc 0x%08x_%08x)\n", dev_priv->engine[i].name, lower_32_bits(obj->gtt_offset), obj->page_count, upper_32_bits(error->ring[i].ctx_desc), lower_32_bits(error->ring[i].ctx_desc)); + err_printf(m, "\t\tringbuffer head 0x%08x tail 0x%08x space 0x%08x lrh 0x%08x\n", + irb->head, irb->tail, irb->space, + irb->last_retired_head); + err_printf(m, "\t\t%llu submission(s), %d consecutive, last at %ld: tail 0x%08x seqno %08x (%d)\n", + irb->total_submission_count, + irb->resubmission_count, + irb->last_submitted_jiffies, + irb->last_submitted_tail, + irb->last_submitted_seqno, + irb->last_submitted_seqno); print_error_obj(m, obj); } @@ -1194,6 +1206,7 @@ static void i915_gem_record_rings(struct drm_device *dev, error->ring[i].ctx_desc = ctx_desc; error->ring[i].req_ringbuffer = i915_error_ggtt_object_create(dev_priv, rbuf->obj); + error->ring[i].req_ring = *rbuf; error->ring[i].hws_page = i915_error_ggtt_object_create(dev_priv, diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.h b/drivers/gpu/drm/i915/intel_ringbuffer.h index e49af641b046..a0fb0144a1a0 100644 --- a/drivers/gpu/drm/i915/intel_ringbuffer.h +++ b/drivers/gpu/drm/i915/intel_ringbuffer.h @@ -126,6 +126,19 @@ struct intel_ringbuffer { * we can detect new retirements. */ u32 last_retired_head; + + /* + * Consecutive resubmissions are opportunities for the h/w to do + * a 'lite restore' rather than a full context switch. Let's note + * when that happens, in case it's useful for hang diagnosis. + */ + u32 resubmission_count; + u64 total_submission_count; + + /* Info about last time this ringbuffer was submitted (to GuC) */ + unsigned long last_submitted_jiffies; + u32 last_submitted_seqno; + u32 last_submitted_tail; }; struct intel_context; @@ -311,6 +324,7 @@ struct intel_engine_cs { * inspecting request list. */ u32 last_submitted_seqno; + struct intel_ringbuffer *last_submitted_ringbuf; /* * Deferred free list to allow unreferencing requests from interrupt |