The request tells us where to read the ringbuf from, so use that
information to simplify the error capture. If no request was active at
the time of the hang, the ring is idle and there is no information
inside the ring pertaining to the hang.

Note carefully that this will reduce the amount of information stored in
the error state - any ring without an active request will not be
recorded.

Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk>
Reviewed-by: Dave Gordon <david.s.gor...@intel.com>
---
 drivers/gpu/drm/i915/i915_gpu_error.c | 28 ++++++++--------------------
 1 file changed, 8 insertions(+), 20 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c 
b/drivers/gpu/drm/i915/i915_gpu_error.c
index 3e137fc701cf..93da2c7581f6 100644
--- a/drivers/gpu/drm/i915/i915_gpu_error.c
+++ b/drivers/gpu/drm/i915/i915_gpu_error.c
@@ -995,7 +995,6 @@ static void i915_gem_record_rings(struct drm_device *dev,
 
        for (i = 0; i < I915_NUM_RINGS; i++) {
                struct intel_engine_cs *ring = &dev_priv->ring[i];
-               struct intel_ringbuffer *rbuf;
 
                error->ring[i].pid = -1;
 
@@ -1009,6 +1008,7 @@ static void i915_gem_record_rings(struct drm_device *dev,
                request = i915_gem_find_active_request(ring);
                if (request) {
                        struct i915_address_space *vm;
+                       struct intel_ringbuffer *rb;
 
                        vm = request->ctx && request->ctx->ppgtt ?
                                &request->ctx->ppgtt->base :
@@ -1039,26 +1039,14 @@ static void i915_gem_record_rings(struct drm_device 
*dev,
                                }
                                rcu_read_unlock();
                        }
-               }
 
-               if (i915.enable_execlists) {
-                       /* TODO: This is only a small fix to keep basic error
-                        * capture working, but we need to add more information
-                        * for it to be useful (e.g. dump the context being
-                        * executed).
-                        */
-                       if (request)
-                               rbuf = request->ctx->engine[ring->id].ringbuf;
-                       else
-                               rbuf = 
ring->default_context->engine[ring->id].ringbuf;
-               } else
-                       rbuf = ring->buffer;
-
-               error->ring[i].cpu_ring_head = rbuf->head;
-               error->ring[i].cpu_ring_tail = rbuf->tail;
-
-               error->ring[i].ringbuffer =
-                       i915_error_ggtt_object_create(dev_priv, rbuf->obj);
+                       rb = request->ringbuf;
+                       error->ring[i].cpu_ring_head = rb->head;
+                       error->ring[i].cpu_ring_tail = rb->tail;
+                       error->ring[i].ringbuffer =
+                               i915_error_ggtt_object_create(dev_priv,
+                                                             rb->obj);
+               }
 
                error->ring[i].hws_page =
                        i915_error_ggtt_object_create(dev_priv, 
ring->status_page.obj);
-- 
2.7.0.rc3

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to