Commit 91ccdd24 authored by Christian König's avatar Christian König Committed by Alex Deucher

drm/amdgpu: cleanup amdgpu_vm_validate_pt_bos v2

Use list_for_each_entry_safe here.

v2: Drop the optimization, it doesn't work as expected.
Signed-off-by: default avatarChristian König <christian.koenig@amd.com>
Reviewed-by: default avatarChunming Zhou <david1.zhou@amd.com>
Reviewed-by: default avatarJunwei Zhang <Jerry.Zhang@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent af4c0f65
...@@ -224,21 +224,16 @@ int amdgpu_vm_validate_pt_bos(struct amdgpu_device *adev, struct amdgpu_vm *vm, ...@@ -224,21 +224,16 @@ int amdgpu_vm_validate_pt_bos(struct amdgpu_device *adev, struct amdgpu_vm *vm,
void *param) void *param)
{ {
struct ttm_bo_global *glob = adev->mman.bdev.glob; struct ttm_bo_global *glob = adev->mman.bdev.glob;
int r; struct amdgpu_vm_bo_base *bo_base, *tmp;
int r = 0;
while (!list_empty(&vm->evicted)) {
struct amdgpu_vm_bo_base *bo_base;
struct amdgpu_bo *bo;
bo_base = list_first_entry(&vm->evicted, list_for_each_entry_safe(bo_base, tmp, &vm->evicted, vm_status) {
struct amdgpu_vm_bo_base, struct amdgpu_bo *bo = bo_base->bo;
vm_status);
bo = bo_base->bo;
if (bo->parent) { if (bo->parent) {
r = validate(param, bo); r = validate(param, bo);
if (r) if (r)
return r; break;
spin_lock(&glob->lru_lock); spin_lock(&glob->lru_lock);
ttm_bo_move_to_lru_tail(&bo->tbo); ttm_bo_move_to_lru_tail(&bo->tbo);
...@@ -251,7 +246,7 @@ int amdgpu_vm_validate_pt_bos(struct amdgpu_device *adev, struct amdgpu_vm *vm, ...@@ -251,7 +246,7 @@ int amdgpu_vm_validate_pt_bos(struct amdgpu_device *adev, struct amdgpu_vm *vm,
vm->use_cpu_for_update) { vm->use_cpu_for_update) {
r = amdgpu_bo_kmap(bo, NULL); r = amdgpu_bo_kmap(bo, NULL);
if (r) if (r)
return r; break;
} }
if (bo->tbo.type != ttm_bo_type_kernel) { if (bo->tbo.type != ttm_bo_type_kernel) {
...@@ -263,7 +258,7 @@ int amdgpu_vm_validate_pt_bos(struct amdgpu_device *adev, struct amdgpu_vm *vm, ...@@ -263,7 +258,7 @@ int amdgpu_vm_validate_pt_bos(struct amdgpu_device *adev, struct amdgpu_vm *vm,
} }
} }
return 0; return r;
} }
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment