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 C4481C4167D for ; Sun, 29 Oct 2023 22:57:15 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2A23210E1AE; Sun, 29 Oct 2023 22:57:15 +0000 (UTC) Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by gabe.freedesktop.org (Postfix) with ESMTPS id 935F210E1AD; Sun, 29 Oct 2023 22:57:11 +0000 (UTC) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 5A992CE11E0; Sun, 29 Oct 2023 22:57:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 58F5EC433B7; Sun, 29 Oct 2023 22:57:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1698620228; bh=jGXXUx8iaeHPMaEHKaAXeM6iKlz7xPyaHyWjHBeR5Wo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jTinBTSaeBq39SzJVz4D1gUKUZASfrPfeJY0Hfvm/dQ4pW1umBXpvcCtMxmgmfdrd Xl8gkSj2iBgxdL22gITvARTU6+2abYgSTlFxHj8Ag3e+Y5giN7GoMBAadgPUkW7CDY HbRnIwlDOMqX6QDXrsmaOpkzyYciWo5qAcO4cu0arAxD9O0IfjyCni8dMSyGCzlIV4 oElmHD9P8kmWRgDIBSS6Z2gXC/dKRqwZJNi+yJCmS4C6m0T9pAHzr3dW5D55hE5XuF UzceJaHJXJgcFkzi8YOLtwOwzUPqhfrLWyN4MhacTHxZ24IrKYj8nZRKPqI5c1+5Hd kuvuS4HhOjtMg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH AUTOSEL 6.5 52/52] drm/amdgpu: Reserve fences for VM update Date: Sun, 29 Oct 2023 18:53:39 -0400 Message-ID: <20231029225441.789781-52-sashal@kernel.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231029225441.789781-1-sashal@kernel.org> References: <20231029225441.789781-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.5.9 Content-Transfer-Encoding: 8bit X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development 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, Alex Deucher , =?UTF-8?q?Christian=20K=C3=B6nig?= Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 12210598e5b8e..ba3a87cb88ccc 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c @@ -403,7 +403,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 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 6EED2C4332F for ; Sun, 29 Oct 2023 22:57:14 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E506A10E1AD; Sun, 29 Oct 2023 22:57:13 +0000 (UTC) Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by gabe.freedesktop.org (Postfix) with ESMTPS id 935F210E1AD; Sun, 29 Oct 2023 22:57:11 +0000 (UTC) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 5A992CE11E0; Sun, 29 Oct 2023 22:57:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 58F5EC433B7; Sun, 29 Oct 2023 22:57:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1698620228; bh=jGXXUx8iaeHPMaEHKaAXeM6iKlz7xPyaHyWjHBeR5Wo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jTinBTSaeBq39SzJVz4D1gUKUZASfrPfeJY0Hfvm/dQ4pW1umBXpvcCtMxmgmfdrd Xl8gkSj2iBgxdL22gITvARTU6+2abYgSTlFxHj8Ag3e+Y5giN7GoMBAadgPUkW7CDY HbRnIwlDOMqX6QDXrsmaOpkzyYciWo5qAcO4cu0arAxD9O0IfjyCni8dMSyGCzlIV4 oElmHD9P8kmWRgDIBSS6Z2gXC/dKRqwZJNi+yJCmS4C6m0T9pAHzr3dW5D55hE5XuF UzceJaHJXJgcFkzi8YOLtwOwzUPqhfrLWyN4MhacTHxZ24IrKYj8nZRKPqI5c1+5Hd kuvuS4HhOjtMg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH AUTOSEL 6.5 52/52] drm/amdgpu: Reserve fences for VM update Date: Sun, 29 Oct 2023 18:53:39 -0400 Message-ID: <20231029225441.789781-52-sashal@kernel.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231029225441.789781-1-sashal@kernel.org> References: <20231029225441.789781-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.5.9 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 12210598e5b8e..ba3a87cb88ccc 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c @@ -403,7 +403,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 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 B7253C4332F for ; Sun, 29 Oct 2023 23:00:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231479AbjJ2XAl (ORCPT ); Sun, 29 Oct 2023 19:00:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231562AbjJ2XAD (ORCPT ); Sun, 29 Oct 2023 19:00:03 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 19B13D47; Sun, 29 Oct 2023 15:57:09 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 58F5EC433B7; Sun, 29 Oct 2023 22:57:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1698620228; bh=jGXXUx8iaeHPMaEHKaAXeM6iKlz7xPyaHyWjHBeR5Wo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jTinBTSaeBq39SzJVz4D1gUKUZASfrPfeJY0Hfvm/dQ4pW1umBXpvcCtMxmgmfdrd Xl8gkSj2iBgxdL22gITvARTU6+2abYgSTlFxHj8Ag3e+Y5giN7GoMBAadgPUkW7CDY HbRnIwlDOMqX6QDXrsmaOpkzyYciWo5qAcO4cu0arAxD9O0IfjyCni8dMSyGCzlIV4 oElmHD9P8kmWRgDIBSS6Z2gXC/dKRqwZJNi+yJCmS4C6m0T9pAHzr3dW5D55hE5XuF UzceJaHJXJgcFkzi8YOLtwOwzUPqhfrLWyN4MhacTHxZ24IrKYj8nZRKPqI5c1+5Hd kuvuS4HhOjtMg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Felix Kuehling , =?UTF-8?q?Christian=20K=C3=B6nig?= , Alex Deucher , Sasha Levin , Xinhui.Pan@amd.com, airlied@gmail.com, daniel@ffwll.ch, srinivasan.shanmugam@amd.com, Arunpravin.PaneerSelvam@amd.com, Philip.Yang@amd.com, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Subject: [PATCH AUTOSEL 6.5 52/52] drm/amdgpu: Reserve fences for VM update Date: Sun, 29 Oct 2023 18:53:39 -0400 Message-ID: <20231029225441.789781-52-sashal@kernel.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231029225441.789781-1-sashal@kernel.org> References: <20231029225441.789781-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.5.9 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 12210598e5b8e..ba3a87cb88ccc 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c @@ -403,7 +403,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