All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu: Report SPM VMID root BO reservation failure
@ 2026-12-02 11:30 Srinivasan Shanmugam
  2026-12-02 11:30 ` [PATCH] drm/amdgpu: Check errors before releasing the SPM VMID Srinivasan Shanmugam
  0 siblings, 1 reply; 3+ messages in thread
From: Srinivasan Shanmugam @ 2026-12-02 11:30 UTC (permalink / raw)
  To: Christian König, Alex Deucher
  Cc: amd-gfx, Srinivasan Shanmugam, Sunil Khatri

The reserve ioctl can report success even when it fails to lock the root
page table. The SPM VMID is then reserved without being bound to the
process's page tables.

Lock the root BO first and return the error if locking fails. Reserve
and bind the SPM VMID while that lock is held.

Fixes: ba56c52af8fd ("drm/amdgpu: bind the SPM VMID's page table to the reserving VM")
Cc: Sunil Khatri <sunil.khatri@amd.com>
Cc: Christian König <christian.koenig@amd.com>
Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index 19177ff37ac8..8eb5f28bca7d 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -3051,11 +3051,15 @@ int amdgpu_vm_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
 		int r;
 
 		/* We only have requirement to reserve vmid from gfxhub */
+		r = amdgpu_bo_reserve(vm->root.bo, true);
+		if (r)
+			return r;
+
 		r = amdgpu_vmid_alloc_spm(adev, vm, AMDGPU_GFXHUB(0));
-		if (!r && !amdgpu_bo_reserve(vm->root.bo, true)) {
+		if (!r)
 			amdgpu_vm_spm_update(adev, vm);
-			amdgpu_bo_unreserve(vm->root.bo);
-		}
+
+		amdgpu_bo_unreserve(vm->root.bo);
 		return r;
 	}
 	case AMDGPU_VM_OP_UNRESERVE_VMID: {
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-12-02 11:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-02 11:30 [PATCH] drm/amdgpu: Report SPM VMID root BO reservation failure Srinivasan Shanmugam
2026-12-02 11:30 ` [PATCH] drm/amdgpu: Check errors before releasing the SPM VMID Srinivasan Shanmugam
2026-12-02 11:40   ` sashiko-bot

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.