AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Koenig, Christian" <Christian.Koenig@amd.com>
To: "Wang, Kevin(Yang)" <Kevin1.Wang@amd.com>
Cc: "amd-gfx@lists.freedesktop.org" <amd-gfx@lists.freedesktop.org>
Subject: Re: [PATCH] drm/amdgpu: don't create entity when use cpu to update page table
Date: Thu, 6 Aug 2020 16:35:21 +0000	[thread overview]
Message-ID: <b430bed0-d2cc-4fba-aff5-047fcaabfd68@email.android.com> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 3993 bytes --]

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@amd.com>:
the entity isn't needed when vm use cpu to update page table.

Signed-off-by: Kevin Wang <kevin1.wang@amd.com>
---
 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



[-- Attachment #1.2: Type: text/html, Size: 9117 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

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

             reply	other threads:[~2020-08-06 16:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-06 16:35 Koenig, Christian [this message]
  -- strict thread matches above, loose matches on Subject: below --
2020-08-06 16:07 [PATCH] drm/amdgpu: don't create entity when use cpu to update page table Kevin Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b430bed0-d2cc-4fba-aff5-047fcaabfd68@email.android.com \
    --to=christian.koenig@amd.com \
    --cc=Kevin1.Wang@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox