All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amdkfd: Fix an inappropriate error handling in allloc memory of gpu
@ 2021-10-13  7:28 Lang Yu
  2021-10-13 12:52 ` Das, Nirmoy
  2021-10-13 14:30 ` Felix Kuehling
  0 siblings, 2 replies; 3+ messages in thread
From: Lang Yu @ 2021-10-13  7:28 UTC (permalink / raw)
  To: amd-gfx, Felix Kuehling; +Cc: Alex Deucher, Huang Rui, Lang Yu

We should unreference a gem object instead of an amdgpu bo here.

Fixes: 5ae0283e831a ("drm/amdgpu: Add userptr support for KFD")

Signed-off-by: Lang Yu <lang.yu@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
index 054c1a224def..cdf46bd0d8d5 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
@@ -1503,7 +1503,7 @@ int amdgpu_amdkfd_gpuvm_alloc_memory_of_gpu(
 	remove_kgd_mem_from_kfd_bo_list(*mem, avm->process_info);
 	drm_vma_node_revoke(&gobj->vma_node, drm_priv);
 err_node_allow:
-	amdgpu_bo_unref(&bo);
+	drm_gem_object_put(gobj);
 	/* Don't unreserve system mem limit twice */
 	goto err_reserve_limit;
 err_bo_create:
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/amdkfd: Fix an inappropriate error handling in allloc memory of gpu
  2021-10-13  7:28 [PATCH] drm/amdkfd: Fix an inappropriate error handling in allloc memory of gpu Lang Yu
@ 2021-10-13 12:52 ` Das, Nirmoy
  2021-10-13 14:30 ` Felix Kuehling
  1 sibling, 0 replies; 3+ messages in thread
From: Das, Nirmoy @ 2021-10-13 12:52 UTC (permalink / raw)
  To: Lang Yu, amd-gfx, Felix Kuehling; +Cc: Alex Deucher, Huang Rui

LGTM as we create a gem object 1st and retrieve amdgpu_bo from the gem 
object.


Acked-by: Nirmoy Das <nirmoy.das@amd.com>

On 10/13/2021 9:28 AM, Lang Yu wrote:
> We should unreference a gem object instead of an amdgpu bo here.
>
> Fixes: 5ae0283e831a ("drm/amdgpu: Add userptr support for KFD")
>
> Signed-off-by: Lang Yu <lang.yu@amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
> index 054c1a224def..cdf46bd0d8d5 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
> @@ -1503,7 +1503,7 @@ int amdgpu_amdkfd_gpuvm_alloc_memory_of_gpu(
>   	remove_kgd_mem_from_kfd_bo_list(*mem, avm->process_info);
>   	drm_vma_node_revoke(&gobj->vma_node, drm_priv);
>   err_node_allow:
> -	amdgpu_bo_unref(&bo);
> +	drm_gem_object_put(gobj);
>   	/* Don't unreserve system mem limit twice */
>   	goto err_reserve_limit;
>   err_bo_create:

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/amdkfd: Fix an inappropriate error handling in allloc memory of gpu
  2021-10-13  7:28 [PATCH] drm/amdkfd: Fix an inappropriate error handling in allloc memory of gpu Lang Yu
  2021-10-13 12:52 ` Das, Nirmoy
@ 2021-10-13 14:30 ` Felix Kuehling
  1 sibling, 0 replies; 3+ messages in thread
From: Felix Kuehling @ 2021-10-13 14:30 UTC (permalink / raw)
  To: Lang Yu, amd-gfx; +Cc: Alex Deucher, Huang Rui


Am 2021-10-13 um 3:28 a.m. schrieb Lang Yu:
> We should unreference a gem object instead of an amdgpu bo here.
>
> Fixes: 5ae0283e831a ("drm/amdgpu: Add userptr support for KFD")

I think the Fixes tag is incorrect. At that time there was no gobj in
this function.

If anything I'd attribute the problem to fd9a9f8801de ("drm/amdgpu: Use
GEM obj reference for KFD BOs"), where I missed the error handling code
path.

Other than that, the patch is

Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>


>
> Signed-off-by: Lang Yu <lang.yu@amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
> index 054c1a224def..cdf46bd0d8d5 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
> @@ -1503,7 +1503,7 @@ int amdgpu_amdkfd_gpuvm_alloc_memory_of_gpu(
>  	remove_kgd_mem_from_kfd_bo_list(*mem, avm->process_info);
>  	drm_vma_node_revoke(&gobj->vma_node, drm_priv);
>  err_node_allow:
> -	amdgpu_bo_unref(&bo);
> +	drm_gem_object_put(gobj);
>  	/* Don't unreserve system mem limit twice */
>  	goto err_reserve_limit;
>  err_bo_create:

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-10-13 14:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-13  7:28 [PATCH] drm/amdkfd: Fix an inappropriate error handling in allloc memory of gpu Lang Yu
2021-10-13 12:52 ` Das, Nirmoy
2021-10-13 14:30 ` Felix Kuehling

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.