[Intel-gfx] [RFC 09/37] drm/i915/error: track, capture & print ringbuffer submission activity
John.C.Harrison at Intel.com
John.C.Harrison at Intel.com
Mon Nov 23 03:41:44 PST 2015
From: Dave Gordon <david.s.gordon at intel.com>
For: VIZ-2021
Signed-off-by: Dave Gordon <david.s.gordon at intel.com>
---
drivers/gpu/drm/i915/i915_drv.h | 2 ++
drivers/gpu/drm/i915/i915_gem.c | 11 +++++++++--
drivers/gpu/drm/i915/i915_gpu_error.c | 9 +++++++++
drivers/gpu/drm/i915/intel_ringbuffer.h | 14 ++++++++++++++
4 files changed, 34 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 779fc70..9b4ab5d 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -567,6 +567,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 ab6064e..785310c 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -2634,8 +2634,15 @@ void __i915_add_request(struct drm_i915_gem_request *request,
*/
request->batch_obj = obj;
- request->emitted_jiffies = jiffies;
- ring->last_submitted_seqno = request->seqno;
+ if (ring->last_submitted_ringbuf == ringbuf)
+ ringbuf->resubmission_count += 1;
+ else
+ ringbuf->resubmission_count = 1;
+ ring->last_submitted_ringbuf = ringbuf;
+ ringbuf->total_submission_count += 1;
+ ringbuf->last_submitted_tail = request->tail;
+ ringbuf->last_submitted_seqno = ring->last_submitted_seqno = request->seqno;
+ ringbuf->last_submitted_jiffies = request->emitted_jiffies = jiffies;
list_add_tail(&request->list, &ring->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 bafaadd..0697fc3 100644
--- a/drivers/gpu/drm/i915/i915_gpu_error.c
+++ b/drivers/gpu/drm/i915/i915_gpu_error.c
@@ -522,12 +522,20 @@ 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->ring[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);
}
@@ -1163,6 +1171,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, ring->status_page.obj);
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.h b/drivers/gpu/drm/i915/intel_ringbuffer.h
index c472f8a..6bdc1ad 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;
@@ -306,6 +319,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 outside the driver */
struct list_head delayed_free_list;
--
1.9.1
More information about the Intel-gfx
mailing list