[Intel-gfx] [PATCH 17/20] drm/i915/gt: Add some debug tracing for context pinning

Chris Wilson chris at chris-wilson.co.uk
Tue Jun 25 13:01:25 UTC 2019


Add the context pin/unpin events to the trace for post-mortem debugging.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/gt/intel_lrc.c        | 5 +++++
 drivers/gpu/drm/i915/gt/intel_ringbuffer.c | 3 +++
 2 files changed, 8 insertions(+)

diff --git a/drivers/gpu/drm/i915/gt/intel_lrc.c b/drivers/gpu/drm/i915/gt/intel_lrc.c
index 2bc25e3f83e6..ce1aba3604b3 100644
--- a/drivers/gpu/drm/i915/gt/intel_lrc.c
+++ b/drivers/gpu/drm/i915/gt/intel_lrc.c
@@ -1509,6 +1509,8 @@ static void execlists_context_destroy(struct kref *kref)
 
 static void execlists_context_unpin(struct intel_context *ce)
 {
+	GEM_TRACE("%s context:%llx unpin\n",
+		  ce->engine->name, ce->ring->timeline->fence_context);
 	i915_gem_context_unpin_hw_id(ce->gem_context);
 	i915_gem_object_unpin_map(ce->state->obj);
 }
@@ -1567,6 +1569,9 @@ __execlists_context_pin(struct intel_context *ce,
 	ce->lrc_desc = lrc_descriptor(ce, engine);
 	ce->lrc_reg_state = vaddr + LRC_STATE_PN * PAGE_SIZE;
 	__execlists_update_reg_state(ce, engine);
+	GEM_TRACE("%s context:%llx pin ring:{head:%04x, tail:%04x}\n",
+		  engine->name, ce->ring->timeline->fence_context,
+		  ce->ring->head, ce->ring->tail);
 
 	return 0;
 
diff --git a/drivers/gpu/drm/i915/gt/intel_ringbuffer.c b/drivers/gpu/drm/i915/gt/intel_ringbuffer.c
index f094406dcc56..81f9b0422e6a 100644
--- a/drivers/gpu/drm/i915/gt/intel_ringbuffer.c
+++ b/drivers/gpu/drm/i915/gt/intel_ringbuffer.c
@@ -1197,6 +1197,7 @@ int intel_ring_pin(struct intel_ring *ring)
 	GEM_BUG_ON(ring->vaddr);
 	ring->vaddr = addr;
 
+	GEM_TRACE("ring:%llx pin\n", ring->timeline->fence_context);
 	return 0;
 
 err_ring:
@@ -1223,6 +1224,8 @@ void intel_ring_unpin(struct intel_ring *ring)
 	if (!atomic_dec_and_test(&ring->pin_count))
 		return;
 
+	GEM_TRACE("ring:%llx unpin\n", ring->timeline->fence_context);
+
 	/* Discard any unused bytes beyond that submitted to hw. */
 	intel_ring_reset(ring, ring->tail);
 
-- 
2.20.1



More information about the Intel-gfx mailing list