From patchwork Fri Aug 5 09:06:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 9264993 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 ED79660760 for ; Fri, 5 Aug 2016 09:06:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DD94927F46 for ; Fri, 5 Aug 2016 09:06:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D275928422; Fri, 5 Aug 2016 09:06:32 +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 046DB27F46 for ; Fri, 5 Aug 2016 09:06:32 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 89B806EB24; Fri, 5 Aug 2016 09:06:31 +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 9152C6EB27 for ; Fri, 5 Aug 2016 09:06:27 +0000 (UTC) Received: by mail-wm0-x244.google.com with SMTP id i5so2879866wmg.2 for ; Fri, 05 Aug 2016 02:06:27 -0700 (PDT) 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=ye7V8H/rEk6cKe1Av0uAOWnhLvpybYDRhHbX0mogCZs=; b=OyYbpwFZxWXCHP5cFRd8RQYEi2V5eCLsMc8oZRvwdE3uGwCme2QPD0aPYKEKBYvwWq Rip/uoQymSMISAq4DCs23JLnxFDY6tIxMxdrpn2cQlLRrxfzFINjHjczeGwXlhE0CD89 eEM5BCLwWFIIOtupve7zR2YoAOoGxpqHU+a3vAgTwzK1glXqY1CYo4XnIoDh365IaeDE f/0VSd8lW2oy9OIjc6BZP4Z3gC3O+W4UEo6vXfIShEPusjzi4U3KuRSfRFTb0Va4IMp7 2rguACjs1eSv31MGM1MCqDpeHsPAS5hppRA108Zmx6YHfasCl8bc+zRpEVsr23CajPp0 CJ0w== 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:cc:subject:date:message-id :in-reply-to:references; bh=ye7V8H/rEk6cKe1Av0uAOWnhLvpybYDRhHbX0mogCZs=; b=YXg7XriPdWjMhZYwqdIjqhMwSRAwGwNJEau+6rb/22IzQBNNyaF3Pvan4WQbJ8qqeB H4mLmG2og+y3LBNdzITYZkOXraB59+dBmON8YC1h2qDGmJM+LkLZ4QnKHaadg1p3F5S+ I9Jm5R4Nk9BcOZtBorEr5eEScFKBgYk+T66pn5vXySosKGJUoHRZ8g6FCuhonePC7eaj 9UXViD042fx61cCU05hBAgjgXI1pud7zcQli//x3DyUZ2bf3yX+u7fEBDcJ/rLWOQV/i 5KsVQL/266tM6tieyGJt0oBMjxbAWN/IENLkGbFLTQTkTH9MJaohv2bRi+4C7pko9s50 M1Qg== X-Gm-Message-State: AEkooutsj5kNY/pJzQF0TFF654a5Jlrlr0Wx4Z+I8ItNW3h+xW29Lybp4+7IlPqKibbOaw== X-Received: by 10.28.25.71 with SMTP id 68mr2315138wmz.91.1470387986149; Fri, 05 Aug 2016 02:06:26 -0700 (PDT) Received: from haswell.alporthouse.com ([78.156.65.138]) by smtp.gmail.com with ESMTPSA id m81sm7623439wmf.1.2016.08.05.02.06.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 05 Aug 2016 02:06:25 -0700 (PDT) From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Fri, 5 Aug 2016 10:06:03 +0100 Message-Id: <1470387964-3363-13-git-send-email-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1470387964-3363-1-git-send-email-chris@chris-wilson.co.uk> References: <1470387964-3363-1-git-send-email-chris@chris-wilson.co.uk> Subject: [Intel-gfx] [PATCH 12/13] drm/i915: Only record active and pending requests upon a GPU hang 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 There is no other state pertaining to the completed requests in the hang, other than gleamed through the ringbuffer, so including the expired requests in the list of outstanding requests simply adds noise. Signed-off-by: Chris Wilson --- drivers/gpu/drm/i915/i915_gpu_error.c | 105 +++++++++++++++++++--------------- 1 file changed, 58 insertions(+), 47 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c index abfbd99dae96..6078f47d4bc0 100644 --- a/drivers/gpu/drm/i915/i915_gpu_error.c +++ b/drivers/gpu/drm/i915/i915_gpu_error.c @@ -1034,12 +1034,65 @@ static void error_record_engine_registers(struct drm_i915_error_state *error, } } +static void engine_record_requests(struct intel_engine_cs *engine, + struct drm_i915_gem_request *first, + struct drm_i915_error_engine *ee) +{ + struct drm_i915_gem_request *request; + int count; + + count = 0; + request = first; + list_for_each_entry_from(request, &engine->request_list, link) + count++; + + ee->requests = NULL; + kcalloc(count, sizeof(*ee->requests), + GFP_ATOMIC); + if (ee->requests == NULL) + return; + ee->num_requests = count; + + count = 0; + request = first; + list_for_each_entry_from(request, &engine->request_list, link) { + struct drm_i915_error_request *erq; + + if (count >= ee->num_requests) { + /* + * If the ring request list was changed in + * between the point where the error request + * list was created and dimensioned and this + * point then just exit early to avoid crashes. + * + * We don't need to communicate that the + * request list changed state during error + * state capture and that the error state is + * slightly incorrect as a consequence since we + * are typically only interested in the request + * list state at the point of error state + * capture, not in any changes happening during + * the capture. + */ + break; + } + + erq = &ee->requests[count++]; + erq->seqno = request->fence.seqno; + erq->jiffies = request->emitted_jiffies; + erq->tail = request->tail; + + rcu_read_lock(); + erq->pid = request->ctx ? pid_nr(request->ctx->pid) : 0; + rcu_read_unlock(); + } +} + static void i915_gem_record_rings(struct drm_i915_private *dev_priv, struct drm_i915_error_state *error) { struct i915_ggtt *ggtt = &dev_priv->ggtt; - struct drm_i915_gem_request *request; - int i, count; + int i; error->semaphore_obj = i915_error_object_create(dev_priv, dev_priv->semaphore_vma); @@ -1047,6 +1100,7 @@ static void i915_gem_record_rings(struct drm_i915_private *dev_priv, for (i = 0; i < I915_NUM_ENGINES; i++) { struct intel_engine_cs *engine = &dev_priv->engine[i]; struct drm_i915_error_engine *ee = &error->engine[i]; + struct drm_i915_gem_request *request; ee->pid = -1; ee->engine_id = -1; @@ -1105,6 +1159,8 @@ static void i915_gem_record_rings(struct drm_i915_private *dev_priv, ee->cpu_ring_tail = ring->tail; ee->ringbuffer = i915_error_object_create(dev_priv, ring->vma); + + engine_record_requests(engine, request, ee); } ee->hws_page = @@ -1113,51 +1169,6 @@ static void i915_gem_record_rings(struct drm_i915_private *dev_priv, ee->wa_ctx = i915_error_object_create(dev_priv, engine->wa_ctx.vma); - - count = 0; - list_for_each_entry(request, &engine->request_list, link) - count++; - - ee->num_requests = count; - ee->requests = - kcalloc(count, sizeof(*ee->requests), GFP_ATOMIC); - if (!ee->requests) { - ee->num_requests = 0; - continue; - } - - count = 0; - list_for_each_entry(request, &engine->request_list, link) { - struct drm_i915_error_request *erq; - - if (count >= ee->num_requests) { - /* - * If the ring request list was changed in - * between the point where the error request - * list was created and dimensioned and this - * point then just exit early to avoid crashes. - * - * We don't need to communicate that the - * request list changed state during error - * state capture and that the error state is - * slightly incorrect as a consequence since we - * are typically only interested in the request - * list state at the point of error state - * capture, not in any changes happening during - * the capture. - */ - break; - } - - erq = &ee->requests[count++]; - erq->seqno = request->fence.seqno; - erq->jiffies = request->emitted_jiffies; - erq->tail = request->postfix; - - rcu_read_lock(); - erq->pid = request->ctx ? pid_nr(request->ctx->pid) : 0; - rcu_read_unlock(); - } } }