________________________________
From: amd-gfx <amd-gfx-boun...@lists.freedesktop.org> on behalf of Yintian Tao 
<yt...@amd.com>
Sent: Sunday, December 31, 2017 10:16 PM
To: amd-gfx@lists.freedesktop.org
Cc: Tao, Yintian
Subject: [PATCH] drm/amd/powerplay: fix memory leakage when reload

add smu_free_memory when smu fini to prevent memory leakage

Change-Id: Id9103d8b54869b63f22a9af53d9fbc3b7a221191
Signed-off-by: Yintian Tao <yt...@amd.com>

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

Looks like vega10, cz, rv have the same issue can you send patches for them as 
well?

Thanks,

Alex

---
 drivers/gpu/drm/amd/powerplay/smumgr/smu7_smumgr.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/smu7_smumgr.c 
b/drivers/gpu/drm/amd/powerplay/smumgr/smu7_smumgr.c
index c49a6f2..925217e 100644
--- a/drivers/gpu/drm/amd/powerplay/smumgr/smu7_smumgr.c
+++ b/drivers/gpu/drm/amd/powerplay/smumgr/smu7_smumgr.c
@@ -607,6 +607,12 @@ int smu7_init(struct pp_smumgr *smumgr)

 int smu7_smu_fini(struct pp_smumgr *smumgr)
 {
+       struct smu7_smumgr *smu_data = (struct smu7_smumgr *)(smumgr->backend);
+
+       smu_free_memory(smumgr->device, smu_data->header_buffer.handle);
+       if (!cgs_is_virtualization_enabled(smumgr->device))
+               smu_free_memory(smumgr->device, smu_data->smu_buffer.handle);
+
         if (smumgr->backend) {
                 kfree(smumgr->backend);
                 smumgr->backend = NULL;
--
2.7.4

_______________________________________________
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

Reply via email to