From patchwork Mon Jan 11 11:00:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 8002351 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 02F539FCC4 for ; Mon, 11 Jan 2016 11:04:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 11624202F0 for ; Mon, 11 Jan 2016 11:04:00 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 2B456202B8 for ; Mon, 11 Jan 2016 11:03:59 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C35DE8809A; Mon, 11 Jan 2016 03:03:55 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wm0-f65.google.com (mail-wm0-f65.google.com [74.125.82.65]) by gabe.freedesktop.org (Postfix) with ESMTPS id 133456E350 for ; Mon, 11 Jan 2016 03:01:55 -0800 (PST) Received: by mail-wm0-f65.google.com with SMTP id l65so25702646wmf.3 for ; Mon, 11 Jan 2016 03:01:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=uRwh35DmJN3VgKM0XrdUnwzA8NZPLjQpOPneLQ5vKRc=; b=W8we4WnLX2ZvKzqsvj31llHr+d3gYr5tL7JdOWNxDOuCBrrwpivVOZSbARmtLFYi04 /JUVN205+mIRo3ZOZc2rxwU1WSnIgU0NwsX+o6+OybI5++Lkm6Hs5AQsrenjiyuGqYxW pMWrrJrsU3bsrThszVp0BD8P1QLfsMKotWBZe/eriZ0c6ylSgqXQBeu3Ii+woDcta7jn fRzTbDWbhAk+UKVXZA9cBwyORXEjoZP1ndnMxkFkBCyAbwglt7MzLxLvqao69H5UEF1T rxSAP2HcBy6jvWu8Fe4hqv0Ohb0W2ogtPeVEac+2MfAq+64ucSfO2Du2KxxMQfbBE71s gCKQ== X-Received: by 10.195.13.201 with SMTP id fa9mr155649831wjd.68.1452510113883; Mon, 11 Jan 2016 03:01:53 -0800 (PST) Received: from haswell.alporthouse.com ([78.156.65.138]) by smtp.gmail.com with ESMTPSA id 73sm12311579wmm.7.2016.01.11.03.01.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 11 Jan 2016 03:01:53 -0800 (PST) From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Mon, 11 Jan 2016 11:00:54 +0000 Message-Id: <1452510091-6833-12-git-send-email-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.7.0.rc3 In-Reply-To: <1452510091-6833-1-git-send-email-chris@chris-wilson.co.uk> References: <1452503961-14837-1-git-send-email-chris@chris-wilson.co.uk> <1452510091-6833-1-git-send-email-chris@chris-wilson.co.uk> Subject: [Intel-gfx] [PATCH 153/190] drm/i915: Record the position of the start of the request X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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. v2: Rebase Signed-off-by: Chris Wilson --- drivers/gpu/drm/i915/i915_drv.h | 1 + drivers/gpu/drm/i915/i915_gem_request.c | 16 +++++++--------- drivers/gpu/drm/i915/i915_gpu_error.c | 4 +++- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index c460dc0c14e1..84693d4c4e52 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -566,6 +566,7 @@ struct drm_i915_error_state { struct drm_i915_error_request { long jiffies; u32 seqno; + u32 head; u32 tail; } *requests; diff --git a/drivers/gpu/drm/i915/i915_gem_request.c b/drivers/gpu/drm/i915/i915_gem_request.c index 9e8e594ce2bd..74be71e7d113 100644 --- a/drivers/gpu/drm/i915/i915_gem_request.c +++ b/drivers/gpu/drm/i915/i915_gem_request.c @@ -244,6 +244,13 @@ i915_gem_request_alloc(struct intel_engine_cs *engine, goto err; } + /* 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 = intel_ring_get_tail(req->ring); + /* * Reserve space in the ring buffer for all the commands required to * eventually emit this request. This is to guarantee that the @@ -421,7 +428,6 @@ static void i915_gem_mark_busy(struct drm_i915_private *dev_priv) void __i915_add_request(struct drm_i915_gem_request *request, bool flush_caches) { struct intel_ring *ring = request->ring; - u32 request_start; int ret; /* @@ -431,7 +437,6 @@ void __i915_add_request(struct drm_i915_gem_request *request, bool flush_caches) */ intel_ring_reserved_space_use(ring); - request_start = intel_ring_get_tail(ring); /* * Emit any outstanding flushes - execbuf can fail to emit the flush * after having emitted the batchbuffer command. Hence we need to fix @@ -451,13 +456,6 @@ void __i915_add_request(struct drm_i915_gem_request *request, bool flush_caches) /* Not allowed to fail! */ WARN(ret, "emit|add_request failed: %d!\n", ret); - /* 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. - */ - request->head = request_start; - request->emitted_jiffies = jiffies; request->previous_seqno = request->engine->last_submitted_seqno; request->engine->last_submitted_seqno = request->fence.seqno; diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c index a2935d7e9278..494dee1f724d 100644 --- a/drivers/gpu/drm/i915/i915_gpu_error.c +++ b/drivers/gpu/drm/i915/i915_gpu_error.c @@ -457,9 +457,10 @@ int i915_error_state_to_str(struct drm_i915_error_state_buf *m, dev_priv->ring[i].name, error->ring[i].num_requests); for (j = 0; j < error->ring[i].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", error->ring[i].requests[j].seqno, error->ring[i].requests[j].jiffies, + error->ring[i].requests[j].head, error->ring[i].requests[j].tail); } } @@ -1067,6 +1068,7 @@ static void i915_gem_record_rings(struct drm_device *dev, erq = &error->ring[i].requests[count++]; erq->seqno = request->fence.seqno; erq->jiffies = request->emitted_jiffies; + erq->head = request->head; erq->tail = request->tail; } }