From patchwork Tue Jul 26 16:40:52 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: 9248441 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 E8DD0607F2 for ; Tue, 26 Jul 2016 16:41:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DA6D426223 for ; Tue, 26 Jul 2016 16:41:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CF3E5271FD; Tue, 26 Jul 2016 16:41:54 +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.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6145626223 for ; Tue, 26 Jul 2016 16:41:54 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8F1F96E55E; Tue, 26 Jul 2016 16:41:37 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by gabe.freedesktop.org (Postfix) with ESMTP id ACA436E55A for ; Tue, 26 Jul 2016 16:41:34 +0000 (UTC) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP; 26 Jul 2016 09:41:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="5.28,425,1464678000"; d="scan'208"; a="1014222555" Received: from asiluver-linux.isw.intel.com ([10.102.226.117]) by fmsmga001.fm.intel.com with ESMTP; 26 Jul 2016 09:41:14 -0700 From: Arun Siluvery To: intel-gfx@lists.freedesktop.org Date: Tue, 26 Jul 2016 17:40:52 +0100 Message-Id: <1469551257-26803-7-git-send-email-arun.siluvery@linux.intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1469551257-26803-1-git-send-email-arun.siluvery@linux.intel.com> References: <1469551257-26803-1-git-send-email-arun.siluvery@linux.intel.com> Cc: Tomas Elf Subject: [Intel-gfx] [PATCH 06/11] drm/i915/tdr: Restart submission after engine 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-Virus-Scanned: ClamAV using ClamSMTP We stop the engine during reset and recovery so after a successful reset the request that caused the hang would've been removed from the queue so we can now restart submissions to elsp. Cc: Mika Kuoppala Signed-off-by: Tomas Elf Signed-off-by: Arun Siluvery --- drivers/gpu/drm/i915/intel_lrc.c | 45 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 42 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c index 8fc5a3b..7834edc 100644 --- a/drivers/gpu/drm/i915/intel_lrc.c +++ b/drivers/gpu/drm/i915/intel_lrc.c @@ -418,7 +418,8 @@ static inline void execlists_context_status_change( atomic_notifier_call_chain(&rq->ctx->status_notifier, status, rq); } -static void execlists_context_unqueue(struct intel_engine_cs *engine) +static void execlists_context_unqueue(struct intel_engine_cs *engine, + bool submission_after_reset) { struct drm_i915_gem_request *req0 = NULL, *req1 = NULL; struct drm_i915_gem_request *cursor, *tmp; @@ -436,6 +437,27 @@ static void execlists_context_unqueue(struct intel_engine_cs *engine) execlist_link) { if (!req0) { req0 = cursor; + + /* + * we submit two requests at a time, req0 and req1. + * Assume that req0 is the one that causes hang and + * req1 is a normal batch. + + * After engine reset, once engine is + * reinitialized, we skip req0 and submit req1 + * along with next request in the queue so we endup + * incrementing req1->elsp_submitted again. But + * after reset HW would've switched to req1 and + * executed it so just this once, submit only req1 + * (which is req0 now) and don't increment + * submission count. Once this is removed we submit + * two requests as usual. + */ + if (submission_after_reset) { + if (req0->elsp_submitted) + req0->elsp_submitted--; + break; + } } else if (req0->ctx == cursor->ctx) { /* Same ctx: ignore first request, as second request * will update tail past first request's workload */ @@ -600,7 +622,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); @@ -640,7 +662,7 @@ static void execlists_context_queue(struct drm_i915_gem_request *request) list_add_tail(&request->execlist_link, &engine->execlist_queue); request->ctx_hw_id = request->ctx->hw_id; if (num_elements == 0) - execlists_context_unqueue(engine); + execlists_context_unqueue(engine, false); spin_unlock_bh(&engine->execlist_lock); } @@ -1142,6 +1164,23 @@ unlock: return !continue_with_reset; } +/** + * intel_execlists_restart_submission() - restarts elsp submissions after + * reset + * + * @engine: engine to be re-started + * + */ +void intel_execlists_restart_submission(struct intel_engine_cs *engine) +{ + spin_lock_bh(&engine->execlist_lock); + + if (!list_empty(&engine->execlist_queue)) + execlists_context_unqueue(engine, true); + + spin_unlock_bh(&engine->execlist_lock); +} + static int intel_logical_ring_workarounds_emit(struct drm_i915_gem_request *req) { int ret, i;