diff options
author | Christian König <christian.koenig@amd.com> | 2017-09-01 14:34:27 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2018-01-10 15:44:53 -0500 |
commit | ec363e0dae59c8daae03978c1c94059d9c04d5eb (patch) | |
tree | c2d0bed7577cfcd92f96d54f0caa5d3fb7ce2356 /drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | |
parent | 4d4358f3f1d8fcc90aec89ea2925e748515b4332 (diff) |
drm/amdgpu: minor optimize VM moved handling v2
Try to lock moved BOs if it's successful we can update the
PTEs directly to the new location.
v2: rebase
Signed-off-by: Christian König <christian.koenig@amd.com>
Acked-by: Felix Kuehling <Felix.Kuehling@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 | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c index 3632c69f1814..c1c5ccdee783 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | |||
@@ -1697,18 +1697,31 @@ int amdgpu_vm_handle_moved(struct amdgpu_device *adev, | |||
1697 | spin_lock(&vm->status_lock); | 1697 | spin_lock(&vm->status_lock); |
1698 | while (!list_empty(&vm->moved)) { | 1698 | while (!list_empty(&vm->moved)) { |
1699 | struct amdgpu_bo_va *bo_va; | 1699 | struct amdgpu_bo_va *bo_va; |
1700 | struct reservation_object *resv; | ||
1700 | 1701 | ||
1701 | bo_va = list_first_entry(&vm->moved, | 1702 | bo_va = list_first_entry(&vm->moved, |
1702 | struct amdgpu_bo_va, base.vm_status); | 1703 | struct amdgpu_bo_va, base.vm_status); |
1703 | spin_unlock(&vm->status_lock); | 1704 | spin_unlock(&vm->status_lock); |
1704 | 1705 | ||
1706 | resv = bo_va->base.bo->tbo.resv; | ||
1707 | |||
1705 | /* Per VM BOs never need to bo cleared in the page tables */ | 1708 | /* Per VM BOs never need to bo cleared in the page tables */ |
1706 | clear = bo_va->base.bo->tbo.resv != vm->root.base.bo->tbo.resv; | 1709 | if (resv == vm->root.base.bo->tbo.resv) |
1710 | clear = false; | ||
1711 | /* Try to reserve the BO to avoid clearing its ptes */ | ||
1712 | else if (reservation_object_trylock(resv)) | ||
1713 | clear = false; | ||
1714 | /* Somebody else is using the BO right now */ | ||
1715 | else | ||
1716 | clear = true; | ||
1707 | 1717 | ||
1708 | r = amdgpu_vm_bo_update(adev, bo_va, clear); | 1718 | r = amdgpu_vm_bo_update(adev, bo_va, clear); |
1709 | if (r) | 1719 | if (r) |
1710 | return r; | 1720 | return r; |
1711 | 1721 | ||
1722 | if (!clear && resv != vm->root.base.bo->tbo.resv) | ||
1723 | reservation_object_unlock(resv); | ||
1724 | |||
1712 | spin_lock(&vm->status_lock); | 1725 | spin_lock(&vm->status_lock); |
1713 | } | 1726 | } |
1714 | spin_unlock(&vm->status_lock); | 1727 | spin_unlock(&vm->status_lock); |