Skip to contentSkip to conversation

drm/amdgpu: Forward VMID reservation errors

PATCH Applied Natalie Vock 3 participants 3 messages Dec 1, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 drm/amdgpu: Forward VMID reservation errors

Otherwise userspace may be fooled into believing it has a reserved VMID when in reality it doesn't, ultimately leading to GPU hangs when SPM is used.

Fixes 80e709ee6ecc ("drm/amdgpu: add option params to enforce process isolation between graphics and compute")
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1 -2
index 61820166efbf6..1479742556991 100644
@@ -2921,8 +2921,7 @@ int amdgpu_vm_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
 	switch (args->in.op) {
 	case AMDGPU_VM_OP_RESERVE_VMID:
 		/* We only have requirement to reserve vmid from gfxhub */
-		amdgpu_vmid_alloc_reserved(adev, vm, AMDGPU_GFXHUB(0));
-		break;
+		return amdgpu_vmid_alloc_reserved(adev, vm, AMDGPU_GFXHUB(0));
 	case AMDGPU_VM_OP_UNRESERVE_VMID:
 		amdgpu_vmid_free_reserved(adev, vm, AMDGPU_GFXHUB(0));
 		break;
Signature · 1 line
2.51.2
maintainer Reviewed-by on v2 1/1
#1 lore raw
Quoted 7 lines · Natalie Vock

Otherwise userspace may be fooled into believing it has a reserved VMID when in reality it doesn't, ultimately leading to GPU hangs when SPM is used.

Fixes 80e709ee6ecc ("drm/amdgpu: add option params to enforce process isolation between graphics and compute")
Quoted 18 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1 -2
index 61820166efbf6..1479742556991 100644
@@ -2921,8 +2921,7 @@ int amdgpu_vm_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
 	switch (args->in.op) {
 	case AMDGPU_VM_OP_RESERVE_VMID:
 		/* We only have requirement to reserve vmid from gfxhub */
-		amdgpu_vmid_alloc_reserved(adev, vm, AMDGPU_GFXHUB(0));
-		break;
+		return amdgpu_vmid_alloc_reserved(adev, vm, AMDGPU_GFXHUB(0));
 	case AMDGPU_VM_OP_UNRESERVE_VMID:
 		amdgpu_vmid_free_reserved(adev, vm, AMDGPU_GFXHUB(0));
 		break;
Applied
#2 lore raw

Applied. Thanks!

Quoted 31 lines · Christian König
Quoted 7 lines · Natalie Vock

Otherwise userspace may be fooled into believing it has a reserved VMID when in reality it doesn't, ultimately leading to GPU hangs when SPM is used.

Fixes 80e709ee6ecc ("drm/amdgpu: add option params to enforce process isolation between graphics and compute")
Quoted 18 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1 -2
index 61820166efbf6..1479742556991 100644
@@ -2921,8 +2921,7 @@ int amdgpu_vm_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
      switch (args->in.op) {
      case AMDGPU_VM_OP_RESERVE_VMID:
              /* We only have requirement to reserve vmid from gfxhub */
-             amdgpu_vmid_alloc_reserved(adev, vm, AMDGPU_GFXHUB(0));
-             break;
+             return amdgpu_vmid_alloc_reserved(adev, vm, AMDGPU_GFXHUB(0));
      case AMDGPU_VM_OP_UNRESERVE_VMID:
              amdgpu_vmid_free_reserved(adev, vm, AMDGPU_GFXHUB(0));
              break;