[PATCH 09/10] drm/amdgpu:fix memleak
Christian König
ckoenig.leichtzumerken at gmail.com
Tue Nov 14 11:57:28 UTC 2017
Am 14.11.2017 um 10:07 schrieb Monk Liu:
> those RLC used buffers are not cleared in GFX's sw_fini
>
> Change-Id: I0c9204753caa327cfbabdfb1465d2c03012ee977
> Signed-off-by: Monk Liu <Monk.Liu at amd.com>
Reviewed-by: Christian König <christian.koenig at amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | 8 ++++++++
> drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 9 +++++++++
> drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 8 ++++++++
> 3 files changed, 25 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
> index 887f196..b6f94c6 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
> @@ -4672,6 +4672,14 @@ static int gfx_v7_0_sw_fini(void *handle)
> gfx_v7_0_cp_compute_fini(adev);
> gfx_v7_0_rlc_fini(adev);
> gfx_v7_0_mec_fini(adev);
> + amdgpu_bo_free_kernel(&adev->gfx.rlc.clear_state_obj,
> + &adev->gfx.rlc.clear_state_gpu_addr,
> + (void **)&adev->gfx.rlc.cs_ptr);
> + if (adev->gfx.rlc.cp_table_size) {
> + amdgpu_bo_free_kernel(&adev->gfx.rlc.cp_table_obj,
> + &adev->gfx.rlc.cp_table_gpu_addr,
> + (void **)&adev->gfx.rlc.cp_table_ptr);
> + }
> gfx_v7_0_free_microcode(adev);
>
> return 0;
> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
> index 82d157e..457af4a 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
> @@ -2117,6 +2117,15 @@ static int gfx_v8_0_sw_fini(void *handle)
>
> gfx_v8_0_mec_fini(adev);
> gfx_v8_0_rlc_fini(adev);
> + amdgpu_bo_free_kernel(&adev->gfx.rlc.clear_state_obj,
> + &adev->gfx.rlc.clear_state_gpu_addr,
> + (void **)&adev->gfx.rlc.cs_ptr);
> + if ((adev->asic_type == CHIP_CARRIZO) ||
> + (adev->asic_type == CHIP_STONEY)) {
> + amdgpu_bo_free_kernel(&adev->gfx.rlc.cp_table_obj,
> + &adev->gfx.rlc.cp_table_gpu_addr,
> + (void **)&adev->gfx.rlc.cp_table_ptr);
> + }
> gfx_v8_0_free_microcode(adev);
>
> return 0;
> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
> index 034bcbe..4214988 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
> @@ -1458,6 +1458,14 @@ static int gfx_v9_0_sw_fini(void *handle)
>
> gfx_v9_0_mec_fini(adev);
> gfx_v9_0_ngg_fini(adev);
> + amdgpu_bo_free_kernel(&adev->gfx.rlc.clear_state_obj,
> + &adev->gfx.rlc.clear_state_gpu_addr,
> + (void **)&adev->gfx.rlc.cs_ptr);
> + if (adev->asic_type == CHIP_RAVEN) {
> + amdgpu_bo_free_kernel(&adev->gfx.rlc.cp_table_obj,
> + &adev->gfx.rlc.cp_table_gpu_addr,
> + (void **)&adev->gfx.rlc.cp_table_ptr);
> + }
> gfx_v9_0_free_microcode(adev);
>
> return 0;
More information about the amd-gfx
mailing list