From patchwork Sun Dec 8 23:28:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 11278311 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8E4DE139A for ; Sun, 8 Dec 2019 23:29:07 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 48A45206E0 for ; Sun, 8 Dec 2019 23:29:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 48A45206E0 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=chris-wilson.co.uk Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9BDD46E0E4; Sun, 8 Dec 2019 23:29:06 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from fireflyinternet.com (mail.fireflyinternet.com [109.228.58.192]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8FF476E0E4 for ; Sun, 8 Dec 2019 23:29:05 +0000 (UTC) X-Default-Received-SPF: pass (skip=forwardok (res=PASS)) x-ip-name=78.156.65.138; Received: from haswell.alporthouse.com (unverified [78.156.65.138]) by fireflyinternet.com (Firefly Internet (M1)) with ESMTP id 19506574-1500050 for multiple; Sun, 08 Dec 2019 23:28:57 +0000 From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Sun, 8 Dec 2019 23:28:57 +0000 Message-Id: <20191208232857.3067949-1-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.24.0 MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH] drm/i915/gt: Skip request resubmission if lite-restore w/a already applied X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Be careful that we never submit the same request again if we have already applied the LiteRestore w/a upon it -- as the HW may complete the request as we submit the ELSP and so become confused by the request to execute an empty ring. To submit the same request in ELSP[0] three times (so triggering the LiteRestore w/a and resubmitting with it already applied) would require preemption, and on preemption we should be unwinding the request tail as we know the HW hasn't advanced beyond the normal time. So in practice, this should never occur... Signed-off-by: Chris Wilson --- drivers/gpu/drm/i915/gt/intel_lrc.c | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/i915/gt/intel_lrc.c b/drivers/gpu/drm/i915/gt/intel_lrc.c index c7ea8a055005..2fb761063606 100644 --- a/drivers/gpu/drm/i915/gt/intel_lrc.c +++ b/drivers/gpu/drm/i915/gt/intel_lrc.c @@ -1776,16 +1776,6 @@ static void execlists_dequeue(struct intel_engine_cs *engine) return; } - - /* - * WaIdleLiteRestore:bdw,skl - * Apply the wa NOOPs to prevent - * ring:HEAD == rq:TAIL as we resubmit the - * request. See gen8_emit_fini_breadcrumb() for - * where we prepare the padding after the - * end of the request. - */ - last->tail = last->wa_tail; } } @@ -1943,6 +1933,24 @@ static void execlists_dequeue(struct intel_engine_cs *engine) ctx_single_port_submission(rq->hw_context)) goto done; + /* + * WaIdleLiteRestore:bdw,skl + * + * If we have already submitted this request + * using the wa_tail, we race with the HW and + * HEAD may reach wa_tail before it processes + * the ELSP[]. If it sees a context with an + * empty ring, the HW gets confused. + * + * To prevent subsequent resubmission (lite + * restores) with an empty ring, we emitted a + * couple of NOOPs in gen8_emit_wa_tail() + * beyond the normal end of the request. + */ + if (unlikely(last->tail == last->wa_tail)) + goto done; + + last->tail = last->wa_tail; merge = false; }