Re: [PATCH 1/1] drm/amdgpu: add amdgpu_bo_destroy_user helper function

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

 




On 3/9/21 6:43 PM, Christian König wrote:
Am 09.03.21 um 17:55 schrieb Nirmoy Das:
Implement amdgpu_bo_destroy_user() helper function to simplify
amdgpu_bo_user cleanup.

Signed-off-by: Nirmoy Das <nirmoy.das@xxxxxxx>
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 19 +++++++++++++------
  1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
index ac0e1cd83858..cdd5d02e7b26 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
@@ -73,11 +73,22 @@ static void amdgpu_bo_subtract_pin_size(struct amdgpu_bo *bo)
      }
  }
  +static void amdgpu_bo_destroy_user(struct amdgpu_bo *bo)
+{
+    struct amdgpu_bo_user *ubo;
+
+    if (bo->tbo.type != ttm_bo_type_device)
+        return;
+
+    ubo = to_amdgpu_bo_user(bo);
+    kfree(ubo->metadata);
+
+}

That was not what I meant.

My thinking was that the user TTM BOs have a separate destroy function.


Ah okay. I will keep it in my mind.


Thanks,

Nirmoy



But this can come later on when we really need this for the VM subsystem.

Christian.

+
  static void amdgpu_bo_destroy(struct ttm_buffer_object *tbo)
  {
      struct amdgpu_device *adev = amdgpu_ttm_adev(tbo->bdev);
      struct amdgpu_bo *bo = ttm_to_amdgpu_bo(tbo);
-    struct amdgpu_bo_user *ubo;
        if (bo->tbo.pin_count > 0)
          amdgpu_bo_subtract_pin_size(bo);
@@ -94,11 +105,7 @@ static void amdgpu_bo_destroy(struct ttm_buffer_object *tbo)
          mutex_unlock(&adev->shadow_list_lock);
      }
      amdgpu_bo_unref(&bo->parent);
-
-    if (bo->tbo.type == ttm_bo_type_device) {
-        ubo = to_amdgpu_bo_user(bo);
-        kfree(ubo->metadata);
-    }
+    amdgpu_bo_destroy_user(bo);
        kfree(bo);
  }

_______________________________________________
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