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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 242AAC0015E for ; Fri, 21 Jul 2023 19:23:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232190AbjGUTXk (ORCPT ); Fri, 21 Jul 2023 15:23:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232197AbjGUTXj (ORCPT ); Fri, 21 Jul 2023 15:23:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B75F9E75 for ; Fri, 21 Jul 2023 12:23:38 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4228561B1C for ; Fri, 21 Jul 2023 19:23:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 50760C433C8; Fri, 21 Jul 2023 19:23:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1689967417; bh=4t4MGrJqloTXg7ca1rvT8aG5Rw3WD+11a282EvYX+tk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jGRgfjfYjxp2iefNOzUAYrC//qDjqUew1/EoHbAjHR2mm/6ihjxsa7VhDPLN1NFCz FckXqEWTR1W81UFyEKhfQogBS6Ay6B5PP8yR/CYAuX9RN2BV+9aMuWzxlh/nJATtys YgdTBWqXZ+jM24gg/aP6iRSHUUWUBZ91fcgB1ur4= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, =?UTF-8?q?Christian=20K=C3=B6nig?= , "Pelloux-Prayer, Pierre-Eric" , Alex Deucher , Pelloux-Prayer@vger.kernel.org Subject: [PATCH 6.1 156/223] drm/ttm: never consider pinned BOs for eviction&swap Date: Fri, 21 Jul 2023 18:06:49 +0200 Message-ID: <20230721160527.527477865@linuxfoundation.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230721160520.865493356@linuxfoundation.org> References: <20230721160520.865493356@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Christian König commit a2848d08742c8e8494675892c02c0d22acbe3cf8 upstream. There is a small window where we have already incremented the pin count but not yet moved the bo from the lru to the pinned list. Signed-off-by: Christian König Reported-by: Pelloux-Prayer, Pierre-Eric Tested-by: Pelloux-Prayer, Pierre-Eric Acked-by: Alex Deucher Cc: stable@vger.kernel.org Link: https://patchwork.freedesktop.org/patch/msgid/20230707120826.3701-1-christian.koenig@amd.com Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/ttm/ttm_bo.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c @@ -549,6 +549,12 @@ static bool ttm_bo_evict_swapout_allowab { bool ret = false; + if (bo->pin_count) { + *locked = false; + *busy = false; + return false; + } + if (bo->base.resv == ctx->resv) { dma_resv_assert_held(bo->base.resv); if (ctx->allow_res_evict)