AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <ckoenig.leichtzumerken-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Monk Liu <Monk.Liu-5C7GfCeVMHo@public.gmane.org>,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: Re: [PATCH 05/10] drm/amdgpu:fix memleak in takedown
Date: Tue, 14 Nov 2017 12:52:21 +0100	[thread overview]
Message-ID: <1bcc08fa-144a-2ff1-4e9c-05dad181c2ca@gmail.com> (raw)
In-Reply-To: <1510650468-5708-6-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>

Am 14.11.2017 um 10:07 schrieb Monk Liu:
> this can fix the memory leak under the case that not all
> BO are freed during "takedown" stage, because originally
> it blocks following kfree on mgr.

NAK, all BOs must be freed before we take down at least the GTT manager.

That we run into a memory leak is intended, cause that is still better 
than crashing the system because we access already freed up memory.

Regards,
Christian.

>
> Change-Id: I56e832ac317215a4d9f58edb8e75ea722158715c
> Signed-off-by: Monk Liu <Monk.Liu@amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c  | 6 ------
>   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c | 5 -----
>   2 files changed, 11 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c
> index 88709f9..72819cc 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c
> @@ -76,12 +76,6 @@ static int amdgpu_gtt_mgr_fini(struct ttm_mem_type_manager *man)
>   {
>   	struct amdgpu_gtt_mgr *mgr = man->priv;
>   
> -	spin_lock(&mgr->lock);
> -	if (!drm_mm_clean(&mgr->mm)) {
> -		spin_unlock(&mgr->lock);
> -		return -EBUSY;
> -	}
> -
>   	drm_mm_takedown(&mgr->mm);
>   	spin_unlock(&mgr->lock);
>   	kfree(mgr);
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
> index 4ca622b..3e883e5 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
> @@ -68,11 +68,6 @@ static int amdgpu_vram_mgr_fini(struct ttm_mem_type_manager *man)
>   	struct amdgpu_vram_mgr *mgr = man->priv;
>   
>   	spin_lock(&mgr->lock);
> -	if (!drm_mm_clean(&mgr->mm)) {
> -		spin_unlock(&mgr->lock);
> -		return -EBUSY;
> -	}
> -
>   	drm_mm_takedown(&mgr->mm);
>   	spin_unlock(&mgr->lock);
>   	kfree(mgr);


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

  parent reply	other threads:[~2017-11-14 11:52 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-14  9:07 [PATCH 00/10] *** bug fixing and cleanups *** Monk Liu
     [not found] ` <1510650468-5708-1-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
2017-11-14  9:07   ` [PATCH 01/10] drm/amdgpu:cleanup stolen vga memory finish Monk Liu
     [not found]     ` <1510650468-5708-2-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
2017-11-14 11:44       ` Christian König
2017-11-14  9:07   ` [PATCH 02/10] drm/amdgpu:cleanup GMC & gart garbage function Monk Liu
     [not found]     ` <1510650468-5708-3-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
2017-11-14 11:43       ` Christian König
2017-11-14  9:07   ` [PATCH 03/10] drm/amdgpu:fix NULL pointer access during drv remove Monk Liu
     [not found]     ` <1510650468-5708-4-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
2017-11-14 11:48       ` Christian König
     [not found]         ` <57cbf576-8eae-498b-73fc-cbbd5c642fa1-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-11-14 14:57           ` Liu, Monk
2017-11-14  9:07   ` [PATCH 04/10] drm/amdgpu:put reserve_fw_vram_fini to correct place Monk Liu
     [not found]     ` <1510650468-5708-5-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
2017-11-14 11:49       ` Christian König
2017-11-14  9:07   ` [PATCH 05/10] drm/amdgpu:fix memleak in takedown Monk Liu
     [not found]     ` <1510650468-5708-6-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
2017-11-14 11:52       ` Christian König [this message]
     [not found]         ` <1bcc08fa-144a-2ff1-4e9c-05dad181c2ca-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-11-14 12:00           ` Christian König
     [not found]             ` <386d37ac-7ec1-5e63-14ef-b9351fbfa958-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-11-14 15:00               ` Liu, Monk
     [not found]                 ` <BLUPR12MB0449B3FCA494C23D4FDCE9F084280-7LeqcoF/hwpTIQvHjXdJlwdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2017-11-14 15:45                   ` Christian König
2017-11-15  2:03               ` Chunming Zhou
2017-11-14  9:07   ` [PATCH 06/10] drm/amdgpu:cleanup unused stack var Monk Liu
     [not found]     ` <1510650468-5708-7-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
2017-11-14 11:53       ` Christian König
2017-11-14  9:07   ` [PATCH 07/10] drm/amdgpu:free CSA in unified place Monk Liu
     [not found]     ` <1510650468-5708-8-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
2017-11-14 11:55       ` Christian König
     [not found]         ` <64318acd-ed60-fbef-b64f-3e4341c96411-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-11-14 15:02           ` Liu, Monk
     [not found]             ` <BLUPR12MB04499F4D29BB145ADA20024384280-7LeqcoF/hwpTIQvHjXdJlwdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2017-11-14 15:48               ` Christian König
2017-11-14  9:07   ` [PATCH 08/10] drm/amdgpu:cleanup firmware.fw_buf alloc/free Monk Liu
     [not found]     ` <1510650468-5708-9-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
2017-11-14 11:56       ` Christian König
2017-11-14  9:07   ` [PATCH 09/10] drm/amdgpu:fix memleak Monk Liu
     [not found]     ` <1510650468-5708-10-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
2017-11-14 11:57       ` Christian König
2017-11-14  9:07   ` [PATCH 10/10] drm/amdgpu:show error message if fail on event4 Monk Liu
     [not found]     ` <1510650468-5708-11-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
2017-11-14 11:58       ` Christian König

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=1bcc08fa-144a-2ff1-4e9c-05dad181c2ca@gmail.com \
    --to=ckoenig.leichtzumerken-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=Monk.Liu-5C7GfCeVMHo@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=christian.koenig-5C7GfCeVMHo@public.gmane.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