All of lore.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Cheng <benjamin.cheng@amd.com>
To: "Alex Deucher" <alexander.deucher@amd.com>,
	"Christian König" <christian.koenig@amd.com>,
	amd-gfx@lists.freedesktop.org
Cc: Benjamin Cheng <benjamin.cheng@amd.com>
Subject: [PATCH 1/3] drm/amdgpu/vm: stop using amdgpu_bo_fence
Date: Thu, 12 Nov 2026 11:44:06 -0500	[thread overview]
Message-ID: <20261112164408.1748006-1-benjamin.cheng@amd.com> (raw)
In-Reply-To: <20261014022107.2511834-1-benjamin.cheng@amd.com>

Switch to stop using this deprecated helper.

The original could be incorrect under certain circumstances, since the
amdgpu_bo_fence only reserves one slot, and at the time of calling the
SDMA commit and TLB flush fences were not added yet (the reserve_fences
is not additive). In addition this allows us to switch to use BOOKKEEP
usage.

Signed-off-by: Benjamin Cheng <benjamin.cheng@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index 94b1cfe05e3e..fe6f2fcb88f6 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -1212,10 +1212,18 @@ int amdgpu_vm_update_range(struct amdgpu_device *adev, struct amdgpu_vm *vm,
 	if (r)
 		goto error_free;
 
+	if (!unlocked) {
+		/* last_unlocked + SDMA commit + TLB flush */
+		r = dma_resv_reserve_fences(vm->root.bo->tbo.base.resv, 3);
+		if (r)
+			goto error_free;
+	}
+
 	if (!unlocked && !dma_fence_is_signaled(vm->last_unlocked)) {
 		struct dma_fence *tmp = dma_fence_get_stub();
 
-		amdgpu_bo_fence(vm->root.bo, vm->last_unlocked, true);
+		dma_resv_add_fence(vm->root.bo->tbo.base.resv, vm->last_unlocked,
+				   DMA_RESV_USAGE_BOOKKEEP);
 		swap(vm->last_unlocked, tmp);
 		dma_fence_put(tmp);
 	}
-- 
2.56.0


  parent reply	other threads:[~2026-11-12 16:44 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-14  2:21 [PATCH] drm/amdgpu: wait for tlb flush before freeing BO Benjamin Cheng
2026-10-14  7:17 ` Christian König
2026-10-14 12:46   ` Benjamin Cheng
2026-10-14 13:09     ` Christian König
2026-11-06 15:20 ` [PATCH v2] " Benjamin Cheng
2026-11-06 16:04   ` Christian König
2026-11-06 16:07     ` Benjamin Cheng
2026-11-09  9:58       ` Christian König
2026-11-09 14:57 ` [PATCH v3 1/2] " Benjamin Cheng
2026-11-09 14:57   ` [PATCH v3 2/2] drm/amdgpu/gem: use dma_resv_add_fence directly Benjamin Cheng
2026-11-09 15:00     ` Christian König
2026-11-09 15:02       ` Benjamin Cheng
2026-11-12 16:44 ` Benjamin Cheng [this message]
2026-11-12 16:44   ` [PATCH 2/3] drm/amdgpu/uvd: stop using amdgpu_bo_fence Benjamin Cheng
2026-11-13 12:00     ` Christian König
2026-11-12 16:44   ` [PATCH 3/3] drm/amdgpu/object: get rid of amdgpu_bo_fence Benjamin Cheng
2026-11-12 16:52     ` sashiko-bot
2026-11-13 12:01     ` Christian König
2026-11-12 17:22   ` [PATCH 1/3] drm/amdgpu/vm: stop using amdgpu_bo_fence sashiko-bot
2026-11-13 11:58   ` Christian König
2026-11-13 14:45     ` Benjamin Cheng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261112164408.1748006-1-benjamin.cheng@amd.com \
    --to=benjamin.cheng@amd.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=christian.koenig@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.