Skip to contentSkip to conversation

drm/amdgpu: fix memory leak in mes self test

PATCH In review Jack Xiao 3 participants 3 messages Apr 21, 2023

Subsystems (2)
lore
Share & tools
lore

Jack Xiao

author
#0 lore raw

PATCH 1/1 drm/amdgpu: fix memory leak in mes self test

The fences associated with mes queue have to be freed up during amdgpu_ring_fini.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +2 -0
index dc474b809604..4a35cee4cb83 100644
@@ -361,6 +361,8 @@ void amdgpu_ring_fini(struct amdgpu_ring *ring)
 		amdgpu_bo_free_kernel(&ring->ring_obj,
 				      &ring->gpu_addr,
 				      (void **)&ring->ring);
+	} else {
+		kfree(ring->fence_drv.fences);
 	}
 
 	dma_fence_put(ring->vmid_wait);
Signature · 1 line
2.37.3
Reviewed-by on v1 1/1
#1 lore raw

[AMD Official Use Only - General]

Regards,
Hawking
-----Original Message-----
From: Xiao, Jack <[email protected]>
Sent: Friday, April 21, 2023 15:06
To: [email protected]; Zhang, Hawking <[email protected]>
Cc: Xiao, Jack <[email protected]>
Subject: [PATCH] drm/amdgpu: fix memory leak in mes self test

The fences associated with mes queue have to be freed up during amdgpu_ring_fini.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +2 -0
index dc474b809604..4a35cee4cb83 100644
@@ -361,6 +361,8 @@ void amdgpu_ring_fini(struct amdgpu_ring *ring)
                amdgpu_bo_free_kernel(&ring->ring_obj,
                                      &ring->gpu_addr,
                                      (void **)&ring->ring);
+       } else {
+               kfree(ring->fence_drv.fences);
        }
 
        dma_fence_put(ring->vmid_wait);

--
2.37.3

#2 lore raw
In reply to Jack Xiao

Am 21.04.23 um 09:06 schrieb Jack Xiao:

Quoted 4 lines

The fences associated with mes queue have to be freed up during amdgpu_ring_fini.

Well big NAK to this! The fences are supposed to be freed by the fence handling code.

Christian.

Quoted 17 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | 2 ++
  1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +2 -0
index dc474b809604..4a35cee4cb83 100644
@@ -361,6 +361,8 @@ void amdgpu_ring_fini(struct amdgpu_ring *ring)
  		amdgpu_bo_free_kernel(&ring->ring_obj,
  				      &ring->gpu_addr,
  				      (void **)&ring->ring);
+	} else {
+		kfree(ring->fence_drv.fences);
  	}
 
  	dma_fence_put(ring->vmid_wait);