Skip to content

Commit 774b5fa

Browse files
zengshanjunrodrigovivi
authored andcommitted
drm/xe: Avoid evicting object of the same vm in none fault mode
BO validation during vm_bind could trigger memory eviction when system runs under memory pressure. Right now we blindly evict BOs of all VMs. This scheme has a problem when system runs in none recoverable page fault mode: even though the vm_bind could be successful by evicting BOs, the later the rebinding of the evicted BOs would fail. So it is better to report an out-of- memory failure at vm_bind time than at time of rebinding where xekmd currently doesn't have a good mechanism to report error to user space. This patch implemented a scheme to only evict objects of other VMs during vm_bind time. Object of the same VM will skip eviction. If we failed to find enough memory for vm_bind, we report error to user space at vm_bind time. This scheme is not needed for recoverable page fault mode under what we can dynamically fault-in pages on demand. v1: Use xe_vm_in_preempt_fence_mode instead of stack variable (Thomas) Signed-off-by: Oak Zeng <[email protected]> Suggested-by: Thomas Hellström <[email protected]> Reviewed-by: Thomas Hellström <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Rodrigo Vivi <[email protected]>
1 parent a16e155 commit 774b5fa

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/gpu/drm/xe/xe_vm.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2360,13 +2360,15 @@ static int vma_lock_and_validate(struct drm_exec *exec, struct xe_vma *vma,
23602360
bool validate)
23612361
{
23622362
struct xe_bo *bo = xe_vma_bo(vma);
2363+
struct xe_vm *vm = xe_vma_vm(vma);
23632364
int err = 0;
23642365

23652366
if (bo) {
23662367
if (!bo->vm)
23672368
err = drm_exec_lock_obj(exec, &bo->ttm.base);
23682369
if (!err && validate)
2369-
err = xe_bo_validate(bo, xe_vma_vm(vma), true);
2370+
err = xe_bo_validate(bo, vm,
2371+
!xe_vm_in_preempt_fence_mode(vm));
23702372
}
23712373

23722374
return err;

0 commit comments

Comments
 (0)