Re: [PATCH] drm/amdgpu: don't create entity when use cpu to update page table

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



NAK, we also use the entity context number for debugging.

Additional to this the entities should not need any additional resources. So the functions are only initializing fields.

Regards,
Christian.


Am 06.08.2020 18:06 schrieb "Wang, Kevin(Yang)" <Kevin1.Wang@xxxxxxx>:
the entity isn't needed when vm use cpu to update page table.

Signed-off-by: Kevin Wang <kevin1.wang@xxxxxxx>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 45 ++++++++++++++------------
 1 file changed, 25 insertions(+), 20 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index 71e005cf2952..e15c29d613d9 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -2802,20 +2802,6 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm,
         spin_lock_init(&vm->invalidated_lock);
         INIT_LIST_HEAD(&vm->freed);
 
-
-       /* create scheduler entities for page table updates */
-       r = drm_sched_entity_init(&vm->immediate, DRM_SCHED_PRIORITY_NORMAL,
-                                 adev->vm_manager.vm_pte_scheds,
-                                 adev->vm_manager.vm_pte_num_scheds, NULL);
-       if (r)
-               return r;
-
-       r = drm_sched_entity_init(&vm->delayed, DRM_SCHED_PRIORITY_NORMAL,
-                                 adev->vm_manager.vm_pte_scheds,
-                                 adev->vm_manager.vm_pte_num_scheds, NULL);
-       if (r)
-               goto error_free_immediate;
-
         vm->pte_support_ats = false;
         vm->is_compute_context = false;
 
@@ -2835,10 +2821,25 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm,
                    !amdgpu_gmc_vram_full_visible(&adev->gmc)),
                   "CPU update of VM recommended only for large BAR system\n");
 
-       if (vm->use_cpu_for_update)
+       if (vm->use_cpu_for_update) {
                 vm->update_funcs = &amdgpu_vm_cpu_funcs;
-       else
+       } else {
+               /* create scheduler entities for page table updates */
+               r = drm_sched_entity_init(&vm->immediate, DRM_SCHED_PRIORITY_NORMAL,
+                                         adev->vm_manager.vm_pte_scheds,
+                                         adev->vm_manager.vm_pte_num_scheds, NULL);
+               if (r)
+                       return r;
+
+               r = drm_sched_entity_init(&vm->delayed, DRM_SCHED_PRIORITY_NORMAL,
+                                         adev->vm_manager.vm_pte_scheds,
+                                         adev->vm_manager.vm_pte_num_scheds, NULL);
+               if (r)
+                       goto error_free_immediate;
+
                 vm->update_funcs = &amdgpu_vm_sdma_funcs;
+       }
+
         vm->last_update = NULL;
         vm->last_unlocked = dma_fence_get_stub();
 
@@ -2895,10 +2896,12 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm,
 
 error_free_delayed:
         dma_fence_put(vm->last_unlocked);
-       drm_sched_entity_destroy(&vm->delayed);
+       if (!vm->use_cpu_for_update)
+               drm_sched_entity_destroy(&vm->delayed);
 
 error_free_immediate:
-       drm_sched_entity_destroy(&vm->immediate);
+       if (!vm->use_cpu_for_update)
+               drm_sched_entity_destroy(&vm->immediate);
 
         return r;
 }
@@ -3120,8 +3123,10 @@ void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm)
         amdgpu_bo_unref(&root);
         WARN_ON(vm->root.base.bo);
 
-       drm_sched_entity_destroy(&vm->immediate);
-       drm_sched_entity_destroy(&vm->delayed);
+       if (!vm->use_cpu_for_update) {
+               drm_sched_entity_destroy(&vm->immediate);
+               drm_sched_entity_destroy(&vm->delayed);
+       }
 
         if (!RB_EMPTY_ROOT(&vm->va.rb_root)) {
                 dev_err(adev->dev, "still active bo inside vm\n");
--
2.27.0


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

[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux