Skip to content

Commit 1d724a2

Browse files
committed
drm/xe: Retry BO allocation
TTM doesn't support fair eviction via WW locking, this mitigated in by using retry loops in exec and preempt rebind worker. Extend this retry loop to BO allocation. Once TTM supports fair eviction this patch can be reverted. v4: - Keep line break (Stuart) Signed-off-by: Matthew Brost <[email protected]> Reviewed-by: Gwan-gyeong Mun <[email protected]> Reviewed-by: Stuart Summers <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 5148da0 commit 1d724a2

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

drivers/gpu/drm/xe/xe_bo.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2273,6 +2273,7 @@ int xe_gem_create_ioctl(struct drm_device *dev, void *data,
22732273
struct xe_file *xef = to_xe_file(file);
22742274
struct drm_xe_gem_create *args = data;
22752275
struct xe_vm *vm = NULL;
2276+
ktime_t end = 0;
22762277
struct xe_bo *bo;
22772278
unsigned int bo_flags;
22782279
u32 handle;
@@ -2344,6 +2345,10 @@ int xe_gem_create_ioctl(struct drm_device *dev, void *data,
23442345
vm = xe_vm_lookup(xef, args->vm_id);
23452346
if (XE_IOCTL_DBG(xe, !vm))
23462347
return -ENOENT;
2348+
}
2349+
2350+
retry:
2351+
if (vm) {
23472352
err = xe_vm_lock(vm, true);
23482353
if (err)
23492354
goto out_vm;
@@ -2357,6 +2362,8 @@ int xe_gem_create_ioctl(struct drm_device *dev, void *data,
23572362

23582363
if (IS_ERR(bo)) {
23592364
err = PTR_ERR(bo);
2365+
if (xe_vm_validate_should_retry(NULL, err, &end))
2366+
goto retry;
23602367
goto out_vm;
23612368
}
23622369

0 commit comments

Comments
 (0)