summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian König <christian.koenig@amd.com>2018-04-05 14:17:41 +0200
committerChristian König <christian.koenig@amd.com>2018-04-05 14:17:41 +0200
commit4be65464682e04ad7470e117dcadb61013d79dee (patch)
tree05692cb5af82e3e6a9f11f7b8bf192b1fb6df4fb
parent22f79643c1854665b385f49245279bf0607a2e9b (diff)
drm/amdgpu: use bulk moves for efficient VM LRU handlingvm_bulk_move
WIP Signed-off-by: Christian König <christian.koenig@amd.com>
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c24
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h2
2 files changed, 18 insertions, 8 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index b3639533de4a..20d6aef1fbbb 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -197,9 +197,9 @@ static int amdgpu_vm_move_bos(int id, void *ptr, void *data)
if (bo->tbo.resv != vm->root.base.bo->tbo.resv)
return 0;
- ttm_bo_move_to_lru_tail(&bo->tbo, NULL);
+ ttm_bo_move_to_lru_tail(&bo->tbo, &vm->lru_bulk_move);
if (bo->shadow)
- ttm_bo_move_to_lru_tail(&bo->shadow->tbo, NULL);
+ ttm_bo_move_to_lru_tail(&bo->shadow->tbo, &vm->lru_bulk_move);
return 0;
}
@@ -214,6 +214,7 @@ static int amdgpu_vm_move_bos(int id, void *ptr, void *data)
* Make sure that all per VM PDs/PTs are grouped together on their LRU.
*/
static void amdgpu_vm_move_levels(struct amdgpu_device *adev,
+ struct amdgpu_vm *vm,
struct amdgpu_vm_pt *parent,
unsigned level)
{
@@ -222,9 +223,10 @@ static void amdgpu_vm_move_levels(struct amdgpu_device *adev,
if (bo) {
if (bo->parent)
- ttm_bo_move_to_lru_tail(&bo->tbo, NULL);
+ ttm_bo_move_to_lru_tail(&bo->tbo, &vm->lru_bulk_move);
if (bo->shadow)
- ttm_bo_move_to_lru_tail(&bo->shadow->tbo, NULL);
+ ttm_bo_move_to_lru_tail(&bo->shadow->tbo,
+ &vm->lru_bulk_move);
}
if (!parent->entries)
@@ -232,7 +234,7 @@ static void amdgpu_vm_move_levels(struct amdgpu_device *adev,
num_entries = amdgpu_vm_num_entries(adev, level);
for (i = 0; i < num_entries; i++)
- amdgpu_vm_move_levels(adev, &parent->entries[i],
+ amdgpu_vm_move_levels(adev, vm, &parent->entries[i],
level + 1);
}
@@ -290,8 +292,14 @@ int amdgpu_vm_validate_pt_bos(struct amdgpu_device *adev, struct drm_file *filp,
}
spin_unlock(&vm->status_lock);
- if (!validated)
+ if (!validated) {
+ spin_lock(&glob->lru_lock);
+ ttm_bo_bulk_move_lru_tail(&vm->lru_bulk_move);
+ spin_unlock(&glob->lru_lock);
return 0;
+ }
+
+ memset(&vm->lru_bulk_move, 0, sizeof(vm->lru_bulk_move));
spin_lock(&glob->lru_lock);
@@ -299,7 +307,7 @@ int amdgpu_vm_validate_pt_bos(struct amdgpu_device *adev, struct drm_file *filp,
idr_for_each(&filp->object_idr, amdgpu_vm_move_bos, vm);
spin_unlock(&filp->table_lock);
- amdgpu_vm_move_levels(adev, &vm->root,
+ amdgpu_vm_move_levels(adev, vm, &vm->root,
adev->vm_manager.root_level);
spin_unlock(&glob->lru_lock);
@@ -512,7 +520,7 @@ static int amdgpu_vm_alloc_levels(struct amdgpu_device *adev,
entry->base.bo = pt;
list_add_tail(&entry->base.bo_list, &pt->va);
spin_lock(&vm->status_lock);
- list_add(&entry->base.vm_status, &vm->relocated);
+ list_add(&entry->base.vm_status, &vm->evicted);
spin_unlock(&vm->status_lock);
}
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
index a43a493f5c08..4c4346b80b8e 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
@@ -206,6 +206,8 @@ struct amdgpu_vm {
/* Limit non-retry fault storms */
unsigned int fault_credit;
+
+ struct ttm_lru_bulk_move lru_bulk_move;
};
struct amdgpu_vm_manager {