Received: by 10.223.185.116 with SMTP id b49csp4187586wrg; Mon, 26 Feb 2018 12:49:34 -0800 (PST) X-Google-Smtp-Source: AH8x224nD4VOtK1TohaeQGLKsgco7kVBkBnTRcAr/e39J6Ea7La2WEg5p4/oOMEA8UF7fIUzKiE7 X-Received: by 2002:a17:902:b904:: with SMTP id bf4-v6mr11628356plb.195.1519678174617; Mon, 26 Feb 2018 12:49:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519678174; cv=none; d=google.com; s=arc-20160816; b=hTeO7yUjNbvsGsyFLO+rFr5dVdbQSruDm47qxfpPzRQF0LlvfNa9/7eBy0FR03nOzM RYUMJqSL4zmeoqLxx35HCP0uKjt25xlOBoTRKJGcvHFsDqi/gQGvel6W/Ke2yITdFMZ0 M1o58fk8zcMfhPJmO9qmFErvBwB0WOIStdFEcut3W+m10sRmEe+Jl19TV/DYndO4pI+8 gXHv1me7AdDR2u+Vf/+A5pQWu3uriT9wPIn4ylFgh/z97jjbWH2ANAPzs/1sb1CluJl9 /wj7TZWLpFFNOijY9jhAt4DhrcnL0vvi+onrl56PHlprpBr0A2wDEwX4pWwEUila8Z8U 9T7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=3mIrBXEndz43gsHFVh5qGHayZahYsD3+qFQ05TSDQh8=; b=M95fY3XpsSFNDxoajWB+QNxNgOQ7yxFYLcW9XAjzF6uw3aP7l5AIQvSfkR8J4qTcfb sWnANgsiDC630JkCMsOZIXGh2R1lYg5LUDcbTUwLpTVXKcepc/mQaEx/3r7C0EGKnYai ZdIScyQVLFWnn+zOLm8lPGSAzxZnebCDDqvyqSB0YnSx+K5OTUL1k4Y+DgiWMnV95XBg HFf2rOM++lFpKOgXZMKK5BvXgl7NqI0uzXE4OLjMy5qrVWpg37glPT6TksSa/cPMNzgr DZQ95wzO618KSWJVc2VjkojTEHoqfR0H74/logtLuMtTjgElP+7QSbkeI3q6xc4ZWMse w9zg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i2si5946293pgf.145.2018.02.26.12.49.18; Mon, 26 Feb 2018 12:49:34 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753155AbeBZUq6 (ORCPT + 99 others); Mon, 26 Feb 2018 15:46:58 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:35466 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753172AbeBZUZf (ORCPT ); Mon, 26 Feb 2018 15:25:35 -0500 Received: from localhost (clnet-b04-243.ikbnet.co.at [83.175.124.243]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 486F1FAD; Mon, 26 Feb 2018 20:25:34 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chris Wilson , Tvrtko Ursulin , Joonas Lahtinen , Tvrtko Ursulin , Rodrigo Vivi Subject: [PATCH 4.14 54/54] drm/i915/breadcrumbs: Ignore unsubmitted signalers Date: Mon, 26 Feb 2018 21:22:31 +0100 Message-Id: <20180226202147.506513200@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180226202144.375869933@linuxfoundation.org> References: <20180226202144.375869933@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Chris Wilson commit 117172c8f9d40ba1de8cb35c6e614422faa03330 upstream. When a request is preempted, it is unsubmitted from the HW queue and removed from the active list of breadcrumbs. In the process, this however triggers the signaler and it may see the clear rbtree with the old, and still valid, seqno, or it may match the cleared seqno with the now zero rq->global_seqno. This confuses the signaler into action and signaling the fence. Fixes: d6a2289d9d6b ("drm/i915: Remove the preempted request from the execution queue") Signed-off-by: Chris Wilson Cc: Tvrtko Ursulin Cc: Joonas Lahtinen Cc: # v4.12+ Reviewed-by: Tvrtko Ursulin Link: https://patchwork.freedesktop.org/patch/msgid/20180206094633.30181-1-chris@chris-wilson.co.uk (cherry picked from commit fd10e2ce9905030d922e179a8047a4d50daffd8e) Signed-off-by: Rodrigo Vivi Link: https://patchwork.freedesktop.org/patch/msgid/20180213090154.17373-1-chris@chris-wilson.co.uk Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/i915/intel_breadcrumbs.c | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) --- a/drivers/gpu/drm/i915/intel_breadcrumbs.c +++ b/drivers/gpu/drm/i915/intel_breadcrumbs.c @@ -541,29 +541,16 @@ void intel_engine_remove_wait(struct int spin_unlock_irq(&b->rb_lock); } -static bool signal_valid(const struct drm_i915_gem_request *request) -{ - return intel_wait_check_request(&request->signaling.wait, request); -} - static bool signal_complete(const struct drm_i915_gem_request *request) { if (!request) return false; - /* If another process served as the bottom-half it may have already - * signalled that this wait is already completed. - */ - if (intel_wait_complete(&request->signaling.wait)) - return signal_valid(request); - - /* Carefully check if the request is complete, giving time for the + /* + * Carefully check if the request is complete, giving time for the * seqno to be visible or if the GPU hung. */ - if (__i915_request_irq_complete(request)) - return true; - - return false; + return __i915_request_irq_complete(request); } static struct drm_i915_gem_request *to_signaler(struct rb_node *rb) @@ -606,9 +593,13 @@ static int intel_breadcrumbs_signaler(vo request = i915_gem_request_get_rcu(request); rcu_read_unlock(); if (signal_complete(request)) { - local_bh_disable(); - dma_fence_signal(&request->fence); - local_bh_enable(); /* kick start the tasklets */ + if (!test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, + &request->fence.flags)) { + local_bh_disable(); + dma_fence_signal(&request->fence); + GEM_BUG_ON(!i915_gem_request_completed(request)); + local_bh_enable(); /* kick start the tasklets */ + } spin_lock_irq(&b->rb_lock);