From patchwork Mon Mar 12 06:17:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "He, Min" X-Patchwork-Id: 10275509 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 0384E60211 for ; Mon, 12 Mar 2018 06:34:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E70E12896D for ; Mon, 12 Mar 2018 06:34:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DADCF28AC8; Mon, 12 Mar 2018 06:34:48 +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]) (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 4948A2896D for ; Mon, 12 Mar 2018 06:34:47 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B532C6E163; Mon, 12 Mar 2018 06:34:46 +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 ESMTPS id 0699C6E163 for ; Mon, 12 Mar 2018 06:34:44 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Mar 2018 23:34:44 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.47,459,1515484800"; d="scan'208";a="24403707" Received: from hm-optiplex-9020.sh.intel.com ([10.239.12.131]) by orsmga008.jf.intel.com with ESMTP; 11 Mar 2018 23:34:42 -0700 From: Min He To: intel-gfx@lists.freedesktop.org Date: Mon, 12 Mar 2018 14:17:10 +0800 Message-Id: <1520835430-23933-1-git-send-email-min.he@intel.com> X-Mailer: git-send-email 2.7.4 Subject: [Intel-gfx] [PATCH] drm/i915: avoid false fence signaling when enabling preemption 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: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP In i915_request_wait(), it adds a local intel_wait variable into rb tree of waiters. However, when the corresponding request is preempted, the seqno of this wait will not be updated, which will lead to a false signaling to the request and cause the i915_request_wait() to return early before the request is really completed. In this patch, we check if the seqno in wait is same as the request before we signal the fence, and thus fix the above issue. Signed-off-by: Min He --- drivers/gpu/drm/i915/i915_irq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c index 828f310..1ef961d 100644 --- a/drivers/gpu/drm/i915/i915_irq.c +++ b/drivers/gpu/drm/i915/i915_irq.c @@ -1121,7 +1121,7 @@ static void notify_ring(struct intel_engine_cs *engine) } spin_unlock(&engine->breadcrumbs.irq_lock); - if (rq) { + if (rq && intel_wait_check_request(wait, rq)) { dma_fence_signal(&rq->fence); GEM_BUG_ON(!i915_request_completed(rq)); i915_request_put(rq);