All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu: free userptrs even if GTT isn't bound
@ 2016-09-22 12:53 Christian König
       [not found] ` <1474548807-1875-1-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Christian König @ 2016-09-22 12:53 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

From: Christian König <christian.koenig@amd.com>

This fixes a memory leak since binding GTT only on demand.

Signed-off-by: Christian König <christian.koenig@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index 219f056..ce9da20 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -758,6 +758,9 @@ static int amdgpu_ttm_backend_unbind(struct ttm_tt *ttm)
 {
 	struct amdgpu_ttm_tt *gtt = (void *)ttm;
 
+	if (gtt->userptr)
+		amdgpu_ttm_tt_unpin_userptr(ttm);
+
 	if (!amdgpu_ttm_is_bound(ttm))
 		return 0;
 
@@ -765,9 +768,6 @@ static int amdgpu_ttm_backend_unbind(struct ttm_tt *ttm)
 	if (gtt->adev->gart.ready)
 		amdgpu_gart_unbind(gtt->adev, gtt->offset, ttm->num_pages);
 
-	if (gtt->userptr)
-		amdgpu_ttm_tt_unpin_userptr(ttm);
-
 	spin_lock(&gtt->adev->gtt_list_lock);
 	list_del_init(&gtt->list);
 	spin_unlock(&gtt->adev->gtt_list_lock);
-- 
2.5.0

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

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

* Re: [PATCH] drm/amdgpu: free userptrs even if GTT isn't bound
       [not found] ` <1474548807-1875-1-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
@ 2016-09-22 14:27   ` Alex Deucher
  0 siblings, 0 replies; 2+ messages in thread
From: Alex Deucher @ 2016-09-22 14:27 UTC (permalink / raw)
  To: Christian König; +Cc: amd-gfx list

On Thu, Sep 22, 2016 at 8:53 AM, Christian König
<deathsimple@vodafone.de> wrote:
> From: Christian König <christian.koenig@amd.com>
>
> This fixes a memory leak since binding GTT only on demand.
>
> Signed-off-by: Christian König <christian.koenig@amd.com>

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> index 219f056..ce9da20 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> @@ -758,6 +758,9 @@ static int amdgpu_ttm_backend_unbind(struct ttm_tt *ttm)
>  {
>         struct amdgpu_ttm_tt *gtt = (void *)ttm;
>
> +       if (gtt->userptr)
> +               amdgpu_ttm_tt_unpin_userptr(ttm);
> +
>         if (!amdgpu_ttm_is_bound(ttm))
>                 return 0;
>
> @@ -765,9 +768,6 @@ static int amdgpu_ttm_backend_unbind(struct ttm_tt *ttm)
>         if (gtt->adev->gart.ready)
>                 amdgpu_gart_unbind(gtt->adev, gtt->offset, ttm->num_pages);
>
> -       if (gtt->userptr)
> -               amdgpu_ttm_tt_unpin_userptr(ttm);
> -
>         spin_lock(&gtt->adev->gtt_list_lock);
>         list_del_init(&gtt->list);
>         spin_unlock(&gtt->adev->gtt_list_lock);
> --
> 2.5.0
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

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

end of thread, other threads:[~2016-09-22 14:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-22 12:53 [PATCH] drm/amdgpu: free userptrs even if GTT isn't bound Christian König
     [not found] ` <1474548807-1875-1-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2016-09-22 14:27   ` Alex Deucher

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.