From patchwork Tue Apr 12 16:59:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: arun.siluvery@linux.intel.com X-Patchwork-Id: 8812891 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 713019FBEA for ; Tue, 12 Apr 2016 17:00:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 78BC82034F for ; Tue, 12 Apr 2016 17:00:03 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 853F62034C for ; Tue, 12 Apr 2016 17:00:02 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DF1996E73E; Tue, 12 Apr 2016 17:00:01 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by gabe.freedesktop.org (Postfix) with ESMTP id AAE296E73E for ; Tue, 12 Apr 2016 16:59:55 +0000 (UTC) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga103.fm.intel.com with ESMTP; 12 Apr 2016 09:59:56 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,475,1455004800"; d="scan'208";a="783401152" Received: from asiluver-linux.isw.intel.com ([10.102.226.117]) by orsmga003.jf.intel.com with ESMTP; 12 Apr 2016 09:59:53 -0700 From: Arun Siluvery To: intel-gfx@lists.freedesktop.org Date: Tue, 12 Apr 2016 17:59:32 +0100 Message-Id: <1460480381-8777-6-git-send-email-arun.siluvery@linux.intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1460480381-8777-1-git-send-email-arun.siluvery@linux.intel.com> References: <1460480381-8777-1-git-send-email-arun.siluvery@linux.intel.com> Cc: Tomas Elf Subject: [Intel-gfx] [PATCH 05/14] drm/i915/tdr: Prepare execlist submission to handle tdr resubmission after reset 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=-5.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, 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 To resume execution after engine reset we resubmit the context and this needs to be treated differently otherwise we would count it as a completely new submission. This change modifies the submission path to account for this. During resubmission we only submit the head request that caused the hang, once this is done then we continue with the normally submission of two contexts at a time. The intention is to restore the submission state at the time of hang. Signed-off-by: Tomas Elf Signed-off-by: Arun Siluvery --- drivers/gpu/drm/i915/intel_lrc.c | 36 +++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c index 0d6dc5e..edae3ed 100644 --- a/drivers/gpu/drm/i915/intel_lrc.c +++ b/drivers/gpu/drm/i915/intel_lrc.c @@ -358,7 +358,8 @@ u32 intel_execlists_ctx_id(struct intel_context *ctx, } static void execlists_elsp_write(struct drm_i915_gem_request *rq0, - struct drm_i915_gem_request *rq1) + struct drm_i915_gem_request *rq1, + bool tdr_resubmission) { struct intel_engine_cs *engine = rq0->engine; @@ -368,13 +369,15 @@ static void execlists_elsp_write(struct drm_i915_gem_request *rq0, if (rq1) { desc[1] = intel_lr_context_descriptor(rq1->ctx, rq1->engine); - rq1->elsp_submitted++; + if (!tdr_resubmission) + rq1->elsp_submitted++; } else { desc[1] = 0; } desc[0] = intel_lr_context_descriptor(rq0->ctx, rq0->engine); - rq0->elsp_submitted++; + if (!tdr_resubmission) + rq0->elsp_submitted++; /* You must always write both descriptors in the order below. */ I915_WRITE_FW(RING_ELSP(engine), upper_32_bits(desc[1])); @@ -415,7 +418,8 @@ static void execlists_update_context(struct drm_i915_gem_request *rq) } static void execlists_submit_requests(struct drm_i915_gem_request *rq0, - struct drm_i915_gem_request *rq1) + struct drm_i915_gem_request *rq1, + bool tdr_resubmission) { struct drm_i915_private *dev_priv = rq0->i915; @@ -427,13 +431,14 @@ static void execlists_submit_requests(struct drm_i915_gem_request *rq0, spin_lock_irq(&dev_priv->uncore.lock); intel_uncore_forcewake_get__locked(dev_priv, FORCEWAKE_ALL); - execlists_elsp_write(rq0, rq1); + execlists_elsp_write(rq0, rq1, tdr_resubmission); intel_uncore_forcewake_put__locked(dev_priv, FORCEWAKE_ALL); spin_unlock_irq(&dev_priv->uncore.lock); } -static void execlists_context_unqueue(struct intel_engine_cs *engine) +static void execlists_context_unqueue(struct intel_engine_cs *engine, + bool tdr_resubmission) { struct drm_i915_gem_request *req0 = NULL, *req1 = NULL; struct drm_i915_gem_request *cursor, *tmp; @@ -451,6 +456,19 @@ static void execlists_context_unqueue(struct intel_engine_cs *engine) execlist_link) { if (!req0) { req0 = cursor; + + /* + * Only submit head request if this is a resubmission + * following engine reset. The intention is to restore + * the original submission state from the situation + * when the hang originally happened. Once the request + * that caused the hang is resubmitted we can continue + * normally by submitting two request at a time. + */ + if (tdr_resubmission) { + req1 = NULL; + break; + } } else if (req0->ctx == cursor->ctx) { /* Same ctx: ignore first request, as second request * will update tail past first request's workload */ @@ -484,7 +502,7 @@ static void execlists_context_unqueue(struct intel_engine_cs *engine) req0->tail &= ringbuf->size - 1; } - execlists_submit_requests(req0, req1); + execlists_submit_requests(req0, req1, tdr_resubmission); } static unsigned int @@ -599,7 +617,7 @@ static void intel_lrc_irq_handler(unsigned long data) if (submit_contexts) { if (!engine->disable_lite_restore_wa || (csb[i][0] & GEN8_CTX_STATUS_ACTIVE_IDLE)) - execlists_context_unqueue(engine); + execlists_context_unqueue(engine, false); } spin_unlock(&engine->execlist_lock); @@ -642,7 +660,7 @@ static void execlists_context_queue(struct drm_i915_gem_request *request) list_add_tail(&request->execlist_link, &engine->execlist_queue); if (num_elements == 0) - execlists_context_unqueue(engine); + execlists_context_unqueue(engine, false); spin_unlock_bh(&engine->execlist_lock); }