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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id C5A77C4332F for ; Sun, 29 Oct 2023 22:59:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 18CF010E1BB; Sun, 29 Oct 2023 22:59:06 +0000 (UTC) Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by gabe.freedesktop.org (Postfix) with ESMTPS id 39ACC10E1B9; Sun, 29 Oct 2023 22:59:03 +0000 (UTC) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by ams.source.kernel.org (Postfix) with ESMTP id 7CE25B80256; Sun, 29 Oct 2023 22:59:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 455C1C4339A; Sun, 29 Oct 2023 22:58:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1698620340; bh=KSHSfVWu3v4X09/oXv+URYujEDICEMcppi+3imMdkAI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=La6gbB7wMjxtTcX/anlDVXbyi+n2Cw1Wv4JnaZ6e9URsmQRTnWG4qOVABQ24yTaLz PWxqKh6nE3dGv75CZbiSj/mCY0U3KzTDNIx6+5FHD6iUNxj+orgyv/DIbm34xdn3fn 1ibqYtGOtHViC9Y4gLuWLqWa5AGxjrDmJDWPUN1OdQU3anoG/aNceR8E3evNMYu5OL k5EKsKPh94hQI1Mrx0H24Vjax4neZc7hvxkr2ZfmBV2m5+J8r5e8CSZm9+ALACKgOq 3/5CiX7Ukfr43NIIYxxXU9cqG1aee9joEFF0nSXdRaWTOzP3wtKoTVtX0OLLje4RgT GimaurDX2NfPA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH AUTOSEL 6.1 39/39] drm/amdgpu: Reserve fences for VM update Date: Sun, 29 Oct 2023 18:57:11 -0400 Message-ID: <20231029225740.790936-39-sashal@kernel.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231029225740.790936-1-sashal@kernel.org> References: <20231029225740.790936-1-sashal@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.1.60 Content-Transfer-Encoding: 8bit X-BeenThere: amd-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion list for AMD gfx List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sasha Levin , Philip.Yang@amd.com, srinivasan.shanmugam@amd.com, Arunpravin.PaneerSelvam@amd.com, Felix Kuehling , Xinhui.Pan@amd.com, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, daniel@ffwll.ch, Alex Deucher , airlied@gmail.com, =?UTF-8?q?Christian=20K=C3=B6nig?= Errors-To: amd-gfx-bounces@lists.freedesktop.org Sender: "amd-gfx" From: Felix Kuehling [ Upstream commit 316baf09d355aec1179981b6dfe28eba50c5ee5b ] In amdgpu_dma_buf_move_notify reserve fences for the page table updates in amdgpu_vm_clear_freed and amdgpu_vm_handle_moved. This fixes a BUG_ON in dma_resv_add_fence when using SDMA for page table updates. Signed-off-by: Felix Kuehling Reviewed-by: Christian König Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c index 7bd8e33b14be5..e8b3e9520cf6e 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c @@ -400,7 +400,10 @@ amdgpu_dma_buf_move_notify(struct dma_buf_attachment *attach) continue; } - r = amdgpu_vm_clear_freed(adev, vm, NULL); + /* Reserve fences for two SDMA page table updates */ + r = dma_resv_reserve_fences(resv, 2); + if (!r) + r = amdgpu_vm_clear_freed(adev, vm, NULL); if (!r) r = amdgpu_vm_handle_moved(adev, vm); -- 2.42.0