From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id ACB08C433E2 for ; Tue, 14 Jul 2020 18:59:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8029822B30 for ; Tue, 14 Jul 2020 18:59:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1594753153; bh=X/IC48WbTd3ilrpMEuVJHlFQ8+HOo4HRvoUoEGbs6D4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=gT6q++DeG23kjXCaaU3GV1/WSigaZHgsLHJNmLGsjj9ZTuOGzbywJ7hnzvV4sk087 UMQuAxYggxLgeAiTRjb2yRLQPH3E1pEcy15mLpoDCiwGRvKRF+KabMirkNdI1PWdSh hQ0JGYAQAInecYPf+I9+b4FVpHvmr2n9GhiZhi2k= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731061AbgGNS7L (ORCPT ); Tue, 14 Jul 2020 14:59:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:57742 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730680AbgGNS7K (ORCPT ); Tue, 14 Jul 2020 14:59:10 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 69B40229CA; Tue, 14 Jul 2020 18:59:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1594753150; bh=X/IC48WbTd3ilrpMEuVJHlFQ8+HOo4HRvoUoEGbs6D4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R91qpM+atylo6hSA3uxlsz0D3PsYPoWWDeTEfbgylFQW0BxMHjFyk+Woj1eatNCS7 fdJtTHdTzKXeHf5xuKA7n6rPcx9NJJc5aOfMhptBbvTc8GsxOnx9KcWXRhQVdMa2y5 YONkODbPklZFw8scbD/cgkoKiCcYKBt8n/1b0dAo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chris Wilson , Tvrtko Ursulin , Matthew Auld , Rodrigo Vivi Subject: [PATCH 5.7 139/166] drm/i915/gt: Pin the rings before marking active Date: Tue, 14 Jul 2020 20:45:04 +0200 Message-Id: <20200714184122.488639251@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200714184115.844176932@linuxfoundation.org> References: <20200714184115.844176932@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Chris Wilson commit 5a383d443b29a140094430f3ad1d02fa1acc2b80 upstream. On eviction, we acquire the vm->mutex and then wait on the vma->active. Therefore when binding and pinning the vma, we must follow the same sequence, lock/pin the vma then mark it active. Otherwise, we mark the vma as active, then wait for the vm->mutex, and meanwhile the evictor holding the mutex waits upon us to complete our activity. Fixes: 8ccfc20a7d56 ("drm/i915/gt: Mark ring->vma as active while pinned") Signed-off-by: Chris Wilson Cc: Tvrtko Ursulin Cc: # v5.6+ Reviewed-by: Matthew Auld Link: https://patchwork.freedesktop.org/patch/msgid/20200706170138.8993-1-chris@chris-wilson.co.uk (cherry picked from commit 8567774e87e23a57155e5102f81208729b992ae6) Signed-off-by: Rodrigo Vivi Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/i915/gt/intel_context.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) --- a/drivers/gpu/drm/i915/gt/intel_context.c +++ b/drivers/gpu/drm/i915/gt/intel_context.c @@ -201,25 +201,25 @@ static int __ring_active(struct intel_ri { int err; - err = i915_active_acquire(&ring->vma->active); + err = intel_ring_pin(ring); if (err) return err; - err = intel_ring_pin(ring); + err = i915_active_acquire(&ring->vma->active); if (err) - goto err_active; + goto err_pin; return 0; -err_active: - i915_active_release(&ring->vma->active); +err_pin: + intel_ring_unpin(ring); return err; } static void __ring_retire(struct intel_ring *ring) { - intel_ring_unpin(ring); i915_active_release(&ring->vma->active); + intel_ring_unpin(ring); } __i915_active_call