public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <christian.koenig@amd.com>
To: Daniel Gomez <daniel@qtec.com>
Cc: dagmcr@gmail.com, Alex Deucher <alexander.deucher@amd.com>,
	David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>,
	Dave Airlie <airlied@redhat.com>,
	Felix Kuehling <Felix.Kuehling@amd.com>,
	Likun Gao <Likun.Gao@amd.com>,
	amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drm/amdgpu/ttm: Fix memory leak userptr pages
Date: Thu, 18 Mar 2021 08:49:27 +0100	[thread overview]
Message-ID: <bb94b582-a720-9c4f-3d37-d1f7fd29da44@amd.com> (raw)
In-Reply-To: <20210317160840.36019-1-daniel@qtec.com>

Am 17.03.21 um 17:08 schrieb Daniel Gomez:
> If userptr pages have been pinned but not bounded,
> they remain uncleared.
>
> Signed-off-by: Daniel Gomez <daniel@qtec.com>

Good catch, not sure if that can ever happen in practice but better save 
than sorry.

Reviewed-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 9fd2157b133a..50c2b4827c13 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> @@ -1162,13 +1162,13 @@ static void amdgpu_ttm_backend_unbind(struct ttm_bo_device *bdev,
>   	struct amdgpu_ttm_tt *gtt = (void *)ttm;
>   	int r;
>   
> -	if (!gtt->bound)
> -		return;
> -
>   	/* if the pages have userptr pinning then clear that first */
>   	if (gtt->userptr)
>   		amdgpu_ttm_tt_unpin_userptr(bdev, ttm);
>   
> +	if (!gtt->bound)
> +		return;
> +
>   	if (gtt->offset == AMDGPU_BO_INVALID_OFFSET)
>   		return;
>   


  reply	other threads:[~2021-03-18  7:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-17 16:08 [PATCH] drm/amdgpu/ttm: Fix memory leak userptr pages Daniel Gomez
2021-03-18  7:49 ` Christian König [this message]
2021-03-18  8:18   ` Daniel Gomez
2021-03-19  2:56 ` Alex Deucher

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=bb94b582-a720-9c4f-3d37-d1f7fd29da44@amd.com \
    --to=christian.koenig@amd.com \
    --cc=Felix.Kuehling@amd.com \
    --cc=Likun.Gao@amd.com \
    --cc=airlied@linux.ie \
    --cc=airlied@redhat.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=dagmcr@gmail.com \
    --cc=daniel@ffwll.ch \
    --cc=daniel@qtec.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.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