From patchwork Mon Aug 15 09:48:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 9280687 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 076EC60839 for ; Mon, 15 Aug 2016 09:49:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EB7C928D25 for ; Mon, 15 Aug 2016 09:49:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E058D28D35; Mon, 15 Aug 2016 09:49:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4974728D25 for ; Mon, 15 Aug 2016 09:49:20 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1C9F46E3C9; Mon, 15 Aug 2016 09:49:19 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wm0-x244.google.com (mail-wm0-x244.google.com [IPv6:2a00:1450:400c:c09::244]) by gabe.freedesktop.org (Postfix) with ESMTPS id DE6F16E3C9 for ; Mon, 15 Aug 2016 09:49:17 +0000 (UTC) Received: by mail-wm0-x244.google.com with SMTP id i138so10165364wmf.3 for ; Mon, 15 Aug 2016 02:49:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:subject:date:message-id; bh=Q62MPWw8QOJ0sHDxE1FajKVRS/8KIdOFUV0gsGAGswA=; b=I6o0wvNX+Rq2XvWi/mx4t00NNJS8C3+UmygXXkVQoVUV85bvv4UsUfkndJvuanZAHx ZJaAI+k+0b163QAOHfdaicU0FtRP6U3zEci3qZkv+I6Z2WAmUIwrWzXd/4E181aR4V1+ 2WI98zNlQ/XuqPwmduj+ldbwTAzri11vEAuO4WHlHkpnJPAYsKWZI+/pZd1zAboP6fXb CbqQmNQHWf+RE6mfPwEgosZjSZEkeuMEPfxcqJ+Yg1Wv3O45XaBPpVqq8uPLbXryoCeY KUd2Xl1Np3ZnlWzscq8I/JTR5/ykIhcEeOVp2jbtoZPoZ70cxig53A8xTAu2P3aIVS5O FQIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:subject:date:message-id; bh=Q62MPWw8QOJ0sHDxE1FajKVRS/8KIdOFUV0gsGAGswA=; b=PrzkOTRNqVqh5jZixHXAF1vLztAy/h1KWCO2GuTegwkfdu7qev5sxe/sftBciCO/eI APAIDHvfDlpEBnaGPgnlTp3JtTVGwEd+CrlTMf0LifzbavUiwsejBPo1q/IoiR+sq5Jf 4IbyQB8QJIZERJXBkZ1UhB9QuGwehULE9czyMj1uEm8u6dhV/n4fPPgnXVfdIMobmaGY ixeI1gCZ3PI42AzGKo4qecCLLrbeQx+ATt0GZFA52VyWU/5qYFFLnec0Asmmw2WVAHg2 BWgcYveAxUDJOCMC19HyA1Y8/WMRFCsl87KD6qWGYnXFSZEafocAAqHWBhz1474K13Fc WDIA== X-Gm-Message-State: AEkoouuPVsVdyFNOcAVewDCdjnPU3LCBETWscZfRh0jicfrzqJ1ETLi+z7wzqNG1G0CrFQ== X-Received: by 10.28.168.83 with SMTP id r80mr13106443wme.44.1471254556269; Mon, 15 Aug 2016 02:49:16 -0700 (PDT) Received: from haswell.alporthouse.com ([78.156.65.138]) by smtp.gmail.com with ESMTPSA id v203sm15675247wmv.2.2016.08.15.02.49.14 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Aug 2016 02:49:14 -0700 (PDT) From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Mon, 15 Aug 2016 10:48:40 +0100 Message-Id: <1471254551-25805-1-git-send-email-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.8.1 Subject: [Intel-gfx] [CI 01/32] 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-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. Signed-off-by: Chris Wilson Link: http://patchwork.freedesktop.org/patch/msgid/1470414607-32453-2-git-send-email-arun.siluvery@linux.intel.com Reviewed-by: Joonas Lahtinen --- drivers/gpu/drm/i915/i915_drv.h | 1 + drivers/gpu/drm/i915/i915_gem_request.c | 13 +++++++++---- drivers/gpu/drm/i915/i915_gpu_error.c | 6 ++++-- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index bf193ba1574e..b1017950087b 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -557,6 +557,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 b764c1d440c8..8a9e9bfeea09 100644 --- a/drivers/gpu/drm/i915/i915_gem_request.c +++ b/drivers/gpu/drm/i915/i915_gem_request.c @@ -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; diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c index eecb87063c88..d54848f5f246 100644 --- a/drivers/gpu/drm/i915/i915_gpu_error.c +++ b/drivers/gpu/drm/i915/i915_gpu_error.c @@ -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; } } }