diff options
author | Christian König <christian.koenig@amd.com> | 2018-04-19 05:02:54 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2018-05-24 11:07:53 -0400 |
commit | 91ccdd24a1955dbec97a6d61322be214b7de1974 (patch) | |
tree | 1786a08921d5a8db4e4a32836a59dbcda17422de /drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | |
parent | af4c0f650b563c7b30c1d8cd2bb926247ceb19cc (diff) |
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: Christian König <christian.koenig@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c index f0deedcaf1c9..3be4d5fc60b3 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | |||
@@ -224,21 +224,16 @@ int amdgpu_vm_validate_pt_bos(struct amdgpu_device *adev, struct amdgpu_vm *vm, | |||
224 | void *param) | 224 | void *param) |
225 | { | 225 | { |
226 | struct ttm_bo_global *glob = adev->mman.bdev.glob; | 226 | struct ttm_bo_global *glob = adev->mman.bdev.glob; |
227 | int r; | 227 | struct amdgpu_vm_bo_base *bo_base, *tmp; |
228 | 228 | int r = 0; | |
229 | while (!list_empty(&vm->evicted)) { | ||
230 | struct amdgpu_vm_bo_base *bo_base; | ||
231 | struct amdgpu_bo *bo; | ||
232 | 229 | ||
233 | bo_base = list_first_entry(&vm->evicted, | 230 | list_for_each_entry_safe(bo_base, tmp, &vm->evicted, vm_status) { |
234 | struct amdgpu_vm_bo_base, | 231 | struct amdgpu_bo *bo = bo_base->bo; |
235 | vm_status); | ||
236 | 232 | ||
237 | bo = bo_base->bo; | ||
238 | if (bo->parent) { | 233 | if (bo->parent) { |
239 | r = validate(param, bo); | 234 | r = validate(param, bo); |
240 | if (r) | 235 | if (r) |
241 | return r; | 236 | break; |
242 | 237 | ||
243 | spin_lock(&glob->lru_lock); | 238 | spin_lock(&glob->lru_lock); |
244 | ttm_bo_move_to_lru_tail(&bo->tbo); | 239 | 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 | vm->use_cpu_for_update) { | 246 | vm->use_cpu_for_update) { |
252 | r = amdgpu_bo_kmap(bo, NULL); | 247 | r = amdgpu_bo_kmap(bo, NULL); |
253 | if (r) | 248 | if (r) |
254 | return r; | 249 | break; |
255 | } | 250 | } |
256 | 251 | ||
257 | if (bo->tbo.type != ttm_bo_type_kernel) { | 252 | 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 | } | 258 | } |
264 | } | 259 | } |
265 | 260 | ||
266 | return 0; | 261 | return r; |
267 | } | 262 | } |
268 | 263 | ||
269 | /** | 264 | /** |