]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/i915/gt: Add some debug tracing for context pinning
authorChris Wilson <chris@chris-wilson.co.uk>
Tue, 25 Jun 2019 19:48:59 +0000 (20:48 +0100)
committerChris Wilson <chris@chris-wilson.co.uk>
Wed, 26 Jun 2019 06:44:43 +0000 (07:44 +0100)
Add the context pin/unpin events to the trace for post-mortem debugging.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190625194859.28005-1-chris@chris-wilson.co.uk
drivers/gpu/drm/i915/gt/intel_context.c
drivers/gpu/drm/i915/gt/intel_ringbuffer.c

index 938dd032b8201da25c89cb6d26f2329c49a0f1d5..1110fc8f657ace233049746aeddccc5280b20713 100644 (file)
@@ -59,6 +59,10 @@ int __intel_context_do_pin(struct intel_context *ce)
                if (err)
                        goto err;
 
+               GEM_TRACE("%s context:%llx pin ring:{head:%04x, tail:%04x}\n",
+                         ce->engine->name, ce->ring->timeline->fence_context,
+                         ce->ring->head, ce->ring->tail);
+
                i915_gem_context_get(ce->gem_context); /* for ctx->ppgtt */
 
                smp_mb__before_atomic(); /* flush pin before it is visible */
@@ -85,6 +89,9 @@ void intel_context_unpin(struct intel_context *ce)
        mutex_lock_nested(&ce->pin_mutex, SINGLE_DEPTH_NESTING);
 
        if (likely(atomic_dec_and_test(&ce->pin_count))) {
+               GEM_TRACE("%s context:%llx retire\n",
+                         ce->engine->name, ce->ring->timeline->fence_context);
+
                ce->ops->unpin(ce);
 
                i915_gem_context_put(ce->gem_context);
@@ -127,6 +134,9 @@ static void __intel_context_retire(struct i915_active *active)
 {
        struct intel_context *ce = container_of(active, typeof(*ce), active);
 
+       GEM_TRACE("%s context:%llx retire\n",
+                 ce->engine->name, ce->ring->timeline->fence_context);
+
        if (ce->state)
                __context_unpin_state(ce->state);
 
index f094406dcc56c5ceb8b6bc985c26fcc7f1a00273..81f9b0422e6abaa19a5836891755d4a39d6022f2 100644 (file)
@@ -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);