Am 03.01.2018 um 09:10 schrieb Zhou, David(ChunMing):

On 2018年01月02日 22:47, Christian König wrote:
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.koe...@amd.com>
---
   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 15 ++++++++++++++-
   1 file changed, 14 insertions(+), 1 deletion(-)

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,
        spin_lock(&vm->status_lock);
        while (!list_empty(&vm->moved)) {
                struct amdgpu_bo_va *bo_va;
+               struct reservation_object *resv;
bo_va = list_first_entry(&vm->moved,
                        struct amdgpu_bo_va, base.vm_status);
                spin_unlock(&vm->status_lock);
+ resv = bo_va->base.bo->tbo.resv;
+
                /* Per VM BOs never need to bo cleared in the page tables */
This reminders us Per-VM-BOs need to cleared as well after we allow to
evict/swap out per-vm-bos.

Actually they don't. The page tables only need to be valid during CS.

So what happens is that the per VM-BOs are validated in right before we call amdgpu_vm_handle_moved().

Regards,
Christian.


Regards,
David Zhou
-               clear = bo_va->base.bo->tbo.resv != vm->root.base.bo->tbo.resv;
+               if (resv == vm->root.base.bo->tbo.resv)
+                       clear = false;
+               /* Try to reserve the BO to avoid clearing its ptes */
+               else if (reservation_object_trylock(resv))
+                       clear = false;
+               /* Somebody else is using the BO right now */
+               else
+                       clear = true;
r = amdgpu_vm_bo_update(adev, bo_va, clear);
                if (r)
                        return r;
+ if (!clear && resv != vm->root.base.bo->tbo.resv)
+                       reservation_object_unlock(resv);
+
                spin_lock(&vm->status_lock);
        }
        spin_unlock(&vm->status_lock);

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reply via email to