From: Nirmoy Das <nirmoy.das@amd.com>
To: <amd-gfx@lists.freedesktop.org>
Cc: <Christian.Koenig@amd.com>, <Alexander.Deucher@amd.com>,
Nirmoy Das <nirmoy.das@amd.com>, zhang <botton_zhang@163.com>
Subject: [PATCH 1/1] drm/amdgpu: fix BO leak after successful move test
Date: Wed, 13 Oct 2021 17:09:02 +0200 [thread overview]
Message-ID: <20211013150902.6646-1-nirmoy.das@amd.com> (raw)
In-Reply-To: <20211012121018.81693-1-nirmoy.das@amd.com>
GTT BO cleanup code is with in the test for loop and
we would skip cleaning up GTT BO on success.
Reported-by: zhang <botton_zhang@163.com>
Signed-off-by: Nirmoy Das <nirmoy.das@amd.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_test.c | 25 ++++++++++++------------
1 file changed, 12 insertions(+), 13 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_test.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_test.c
index 909d830b513e..5fe7ff680c29 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_test.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_test.c
@@ -35,6 +35,7 @@ static void amdgpu_do_test_moves(struct amdgpu_device *adev)
struct amdgpu_bo *vram_obj = NULL;
struct amdgpu_bo **gtt_obj = NULL;
struct amdgpu_bo_param bp;
+ struct dma_fence *fence = NULL;
uint64_t gart_addr, vram_addr;
unsigned n, size;
int i, r;
@@ -82,7 +83,6 @@ static void amdgpu_do_test_moves(struct amdgpu_device *adev)
void *gtt_map, *vram_map;
void **gart_start, **gart_end;
void **vram_start, **vram_end;
- struct dma_fence *fence = NULL;
bp.domain = AMDGPU_GEM_DOMAIN_GTT;
r = amdgpu_bo_create(adev, &bp, gtt_obj + i);
@@ -212,24 +212,23 @@ static void amdgpu_do_test_moves(struct amdgpu_device *adev)
DRM_INFO("Tested GTT->VRAM and VRAM->GTT copy for GTT offset 0x%llx\n",
gart_addr - adev->gmc.gart_start);
- continue;
+ }
+ --i;
out_lclean_unpin:
- amdgpu_bo_unpin(gtt_obj[i]);
+ amdgpu_bo_unpin(gtt_obj[i]);
out_lclean_unres:
- amdgpu_bo_unreserve(gtt_obj[i]);
+ amdgpu_bo_unreserve(gtt_obj[i]);
out_lclean_unref:
- amdgpu_bo_unref(>t_obj[i]);
+ amdgpu_bo_unref(>t_obj[i]);
out_lclean:
- for (--i; i >= 0; --i) {
- amdgpu_bo_unpin(gtt_obj[i]);
- amdgpu_bo_unreserve(gtt_obj[i]);
- amdgpu_bo_unref(>t_obj[i]);
- }
- if (fence)
- dma_fence_put(fence);
- break;
+ for (--i; i >= 0; --i) {
+ amdgpu_bo_unpin(gtt_obj[i]);
+ amdgpu_bo_unreserve(gtt_obj[i]);
+ amdgpu_bo_unref(>t_obj[i]);
}
+ if (fence)
+ dma_fence_put(fence);
amdgpu_bo_unpin(vram_obj);
out_unres:
--
2.32.0
next prev parent reply other threads:[~2021-10-13 15:09 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-12 12:10 [PATCH 1/1] drm/amdgpu: release gtt bo after each move test Nirmoy Das
[not found] ` <2be293df-2656-c551-682e-b08955307c0b@163.com>
2021-10-13 10:42 ` Das, Nirmoy
2021-10-13 15:07 ` Das, Nirmoy
2021-10-13 15:04 ` Nirmoy Das
2021-10-13 15:10 ` Das, Nirmoy
2021-10-13 15:09 ` Nirmoy Das [this message]
2021-10-20 8:50 ` [PATCH 1/1] drm/amdgpu: fix BO leak after successful " Das, Nirmoy
2021-10-20 11:50 ` Christian König
2021-10-20 11:51 ` Christian König
2021-10-20 12:55 ` Das, Nirmoy
2021-10-21 6:58 ` Christian König
2021-10-21 2:07 ` zhang
2021-10-21 6: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=20211013150902.6646-1-nirmoy.das@amd.com \
--to=nirmoy.das@amd.com \
--cc=Alexander.Deucher@amd.com \
--cc=Christian.Koenig@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=botton_zhang@163.com \
/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