]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/xe: Covert return of -EBUSY to -ENOMEM in VM bind IOCTL
authorMatthew Brost <matthew.brost@intel.com>
Sat, 22 Nov 2025 01:25:02 +0000 (17:25 -0800)
committerMatthew Brost <matthew.brost@intel.com>
Wed, 26 Nov 2025 18:21:46 +0000 (10:21 -0800)
xe_vma_userptr_pin_pages can return -EBUSY but -EBUSY has special
meaning in VM bind IOCTLs that user fence is pending that is attached to
the VMA. Convert -EBUSY to -ENOMEM in this case as -EBUSY in practice
means we are low or out of memory.

Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: Tejas Upadhyay <tejas.upadhyay@intel.com>
Link: https://patch.msgid.link/20251122012502.382587-2-matthew.brost@intel.com
drivers/gpu/drm/xe/xe_vm.c

index a70a4a1fa03cc1d88af7a004458480055f889d92..8ab726289583c1ea85d9b9e2f359145965a5a2df 100644 (file)
@@ -2455,8 +2455,17 @@ static struct xe_vma *new_vma(struct xe_vm *vm, struct drm_gpuva_op_map *op,
                if (IS_ERR(vma))
                        return vma;
 
-               if (xe_vma_is_userptr(vma))
+               if (xe_vma_is_userptr(vma)) {
                        err = xe_vma_userptr_pin_pages(to_userptr_vma(vma));
+                       /*
+                        * -EBUSY has dedicated meaning that a user fence
+                        * attached to the VMA is busy, in practice
+                        * xe_vma_userptr_pin_pages can only fail with -EBUSY if
+                        * we are low on memory so convert this to -ENOMEM.
+                        */
+                       if (err == -EBUSY)
+                               err = -ENOMEM;
+               }
        }
        if (err) {
                prep_vma_destroy(vm, vma, false);