Re: [PATCH v2 2/2] drm/amdgpu: free pasid early before converting a vm

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

 




On 6/29/2021 1:12 PM, Christian König wrote:
Am 29.06.21 um 09:55 schrieb Nirmoy Das:
VM code should not be responsible for freeing pasid as pasid
gets allocated outside of VM code, before initializing a vm.

Signed-off-by: Nirmoy Das <nirmoy.das@xxxxxxx>
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 8 ++++++++
  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c           | 6 ------
  2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
index f96598279593..5a9006aabec7 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
@@ -1287,6 +1287,14 @@ int amdgpu_amdkfd_gpuvm_acquire_process_vm(struct kgd_dev *kgd,
      if (avm->process_info)
          return -EINVAL;

+    /* Free the original amdgpu allocated pasid,
+     * will be replaced with kfd allocated pasid.
+     */
+    if (avm->pasid) {
+        amdgpu_pasid_free(avm->pasid);
+        amdgpu_vm_set_pasid(adev, avm, 0);
+    }
+
      /* Convert VM into a compute VM */
      ret = amdgpu_vm_make_compute(adev, avm, pasid);

I'm really wondering if amdgpu_vm_make_compute() and amdgpu_vm_init() now need the pasid as parameter anymore.


We could use the exported amdgpu_vm_set_pasid() and remove that pasid from both functions.


Regards,

Nirmoy



Christian.

      if (ret)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index 9b0e8a9d7f86..0bd9575b0872 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -3057,12 +3057,6 @@ int amdgpu_vm_make_compute(struct amdgpu_device *adev, struct amdgpu_vm *vm,
      if (r)
          goto unreserve_bo;

-    /* Free the original amdgpu allocated pasid,
-     * will be replaced with kfd allocated pasid.
-     */
-    if (vm->pasid)
-        amdgpu_pasid_free(vm->pasid);
-
      r = amdgpu_vm_set_pasid(adev, vm, pasid);
      if (r)
          goto unreserve_bo;
--
2.32.0

_______________________________________________
amd-gfx mailing list
amd-gfx@xxxxxxxxxxxxxxxxxxxxx
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=04%7C01%7Cnirmoy.das%40amd.com%7C2a379081693b490c09fd08d93aeed4b3%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637605619715690644%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000&amp;sdata=6ztVdZYy8nsS6OekDFAjDc2toJYYnl9RUZEyl5Kn6c0%3D&amp;reserved=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