drm/i915: Record the position of the start of the request
authorChris Wilson <chris@chris-wilson.co.uk>
Mon, 15 Aug 2016 09:48:40 +0000 (10:48 +0100)
committerChris Wilson <chris@chris-wilson.co.uk>
Mon, 15 Aug 2016 10:00:49 +0000 (11:00 +0100)
Not only does it make for good documentation and debugging aide, but it is
also vital for when we want to unwind requests - such as when throwing away
an incomplete request.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: http://patchwork.freedesktop.org/patch/msgid/1470414607-32453-2-git-send-email-arun.siluvery@linux.intel.com
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1471254551-25805-1-git-send-email-chris@chris-wilson.co.uk
drivers/gpu/drm/i915/i915_drv.h
drivers/gpu/drm/i915/i915_gem_request.c
drivers/gpu/drm/i915/i915_gpu_error.c

index bf193ba..b101795 100644 (file)
@@ -557,6 +557,7 @@ struct drm_i915_error_state {
                struct drm_i915_error_request {
                        long jiffies;
                        u32 seqno;
+                       u32 head;
                        u32 tail;
                } *requests;
 
index b764c1d..8a9e9bf 100644 (file)
@@ -426,6 +426,13 @@ i915_gem_request_alloc(struct intel_engine_cs *engine,
        if (ret)
                goto err_ctx;
 
+       /* Record the position of the start of the request so that
+        * should we detect the updated seqno part-way through the
+        * GPU processing the request, we never over-estimate the
+        * position of the head.
+        */
+       req->head = req->ring->tail;
+
        return req;
 
 err_ctx:
@@ -500,8 +507,6 @@ void __i915_add_request(struct drm_i915_gem_request *request, bool flush_caches)
 
        trace_i915_gem_request_add(request);
 
-       request->head = request_start;
-
        /* Seal the request and mark it as pending execution. Note that
         * we may inspect this state, without holding any locks, during
         * hangcheck. Hence we apply the barrier to ensure that we do not
@@ -514,10 +519,10 @@ void __i915_add_request(struct drm_i915_gem_request *request, bool flush_caches)
        list_add_tail(&request->link, &engine->request_list);
        list_add_tail(&request->ring_link, &ring->request_list);
 
-       /* Record the position of the start of the request so that
+       /* Record the position of the start of the breadcrumb so that
         * should we detect the updated seqno part-way through the
         * GPU processing the request, we never over-estimate the
-        * position of the head.
+        * position of the ring's HEAD.
         */
        request->postfix = ring->tail;
 
index eecb870..d54848f 100644 (file)
@@ -455,9 +455,10 @@ int i915_error_state_to_str(struct drm_i915_error_state_buf *m,
                                   dev_priv->engine[i].name,
                                   ee->num_requests);
                        for (j = 0; j < ee->num_requests; j++) {
-                               err_printf(m, "  seqno 0x%08x, emitted %ld, tail 0x%08x\n",
+                               err_printf(m, "  seqno 0x%08x, emitted %ld, head 0x%08x, tail 0x%08x\n",
                                           ee->requests[j].seqno,
                                           ee->requests[j].jiffies,
+                                          ee->requests[j].head,
                                           ee->requests[j].tail);
                        }
                }
@@ -1205,7 +1206,8 @@ static void i915_gem_record_rings(struct drm_i915_private *dev_priv,
                        erq = &ee->requests[count++];
                        erq->seqno = request->fence.seqno;
                        erq->jiffies = request->emitted_jiffies;
-                       erq->tail = request->postfix;
+                       erq->head = request->head;
+                       erq->tail = request->tail;
                }
        }
 }