aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorChristian König <christian.koenig@amd.com>2018-04-19 09:01:12 -0400
committerAlex Deucher <alexander.deucher@amd.com>2018-05-24 11:07:54 -0400
commit806f043f0253a76248c554ce9f7303bc25e43314 (patch)
tree7f556458994bd66b47ab85044b3c6e6884cac45b /drivers/gpu
parent862b8c5762e4e2324d18c881ce86062af72b2063 (diff)
drm/amdgpu: move VM BOs on LRU again
Move all BOs belonging to a VM on the LRU with every submission. Signed-off-by: Christian König <christian.koenig@amd.com> Reviewed-by: Chunming Zhou <david1.zhou@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c28
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h3
2 files changed, 26 insertions, 5 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index f5dee4c6757c..ccba88cc8c54 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -251,6 +251,19 @@ int amdgpu_vm_validate_pt_bos(struct amdgpu_device *adev, struct amdgpu_vm *vm,
251 } 251 }
252 } 252 }
253 253
254 spin_lock(&glob->lru_lock);
255 list_for_each_entry(bo_base, &vm->idle, vm_status) {
256 struct amdgpu_bo *bo = bo_base->bo;
257
258 if (!bo->parent)
259 continue;
260
261 ttm_bo_move_to_lru_tail(&bo->tbo);
262 if (bo->shadow)
263 ttm_bo_move_to_lru_tail(&bo->shadow->tbo);
264 }
265 spin_unlock(&glob->lru_lock);
266
254 return r; 267 return r;
255} 268}
256 269
@@ -965,7 +978,7 @@ restart:
965 struct amdgpu_vm_bo_base, 978 struct amdgpu_vm_bo_base,
966 vm_status); 979 vm_status);
967 bo_base->moved = false; 980 bo_base->moved = false;
968 list_del_init(&bo_base->vm_status); 981 list_move(&bo_base->vm_status, &vm->idle);
969 982
970 bo = bo_base->bo->parent; 983 bo = bo_base->bo->parent;
971 if (!bo) 984 if (!bo)
@@ -1571,10 +1584,14 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev,
1571 * the evicted list so that it gets validated again on the 1584 * the evicted list so that it gets validated again on the
1572 * next command submission. 1585 * next command submission.
1573 */ 1586 */
1574 if (bo && bo->tbo.resv == vm->root.base.bo->tbo.resv && 1587 if (bo && bo->tbo.resv == vm->root.base.bo->tbo.resv) {
1575 !(bo->preferred_domains & 1588 uint32_t mem_type = bo->tbo.mem.mem_type;
1576 amdgpu_mem_type_to_domain(bo->tbo.mem.mem_type))) 1589
1577 list_add_tail(&bo_va->base.vm_status, &vm->evicted); 1590 if (!(bo->preferred_domains & amdgpu_mem_type_to_domain(mem_type)))
1591 list_add_tail(&bo_va->base.vm_status, &vm->evicted);
1592 else
1593 list_add(&bo_va->base.vm_status, &vm->idle);
1594 }
1578 1595
1579 list_splice_init(&bo_va->invalids, &bo_va->valids); 1596 list_splice_init(&bo_va->invalids, &bo_va->valids);
1580 bo_va->cleared = clear; 1597 bo_va->cleared = clear;
@@ -2368,6 +2385,7 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm,
2368 INIT_LIST_HEAD(&vm->relocated); 2385 INIT_LIST_HEAD(&vm->relocated);
2369 spin_lock_init(&vm->moved_lock); 2386 spin_lock_init(&vm->moved_lock);
2370 INIT_LIST_HEAD(&vm->moved); 2387 INIT_LIST_HEAD(&vm->moved);
2388 INIT_LIST_HEAD(&vm->idle);
2371 INIT_LIST_HEAD(&vm->freed); 2389 INIT_LIST_HEAD(&vm->freed);
2372 2390
2373 /* create scheduler entity for page table updates */ 2391 /* create scheduler entity for page table updates */
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
index 0196b9a782f2..061b99a18cb8 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
@@ -178,6 +178,9 @@ struct amdgpu_vm {
178 struct list_head moved; 178 struct list_head moved;
179 spinlock_t moved_lock; 179 spinlock_t moved_lock;
180 180
181 /* All BOs of this VM not currently in the state machine */
182 struct list_head idle;
183
181 /* BO mappings freed, but not yet updated in the PT */ 184 /* BO mappings freed, but not yet updated in the PT */
182 struct list_head freed; 185 struct list_head freed;
183 186