On Thu, Nov 5, 2026 at 4:41 AM Jesse Zhang <[email protected]> wrote:
>
> The IMU firmware of GFX11 and GFX12 is only released when loading the
> microcode fails. Every unload or unbind of such a device leaks it. On
> navi31, binding and unbinding the device leaves:
>
>   unreferenced object 0xffff88810dd6cd80 (size 32):
>     comm "modprobe", pid 2891, jiffies 4294943088
>     backtrace:
>       _request_firmware+0x207/0xad0
>       request_firmware+0x3b/0x60
>       amdgpu_ucode_request+0x150/0x330 [amdgpu]
>       amdgpu_device_init+0x2d70/0xa650 [amdgpu]
>       amdgpu_driver_load_kms+0x1e/0x140 [amdgpu]
>
> a struct firmware of 132352 bytes, the size of gc_11_0_0_imu.bin.
> Release it in the free_microcode() functions; with that it's gone.
>
> Fixes: 289bcffb9d76 ("drm/amdgpu: support imu for gfx11")
> Fixes: 32d163768989 ("drm/amd/amdgpu: imu fw loading support")
> Fixes: a0f8297068cf ("drm/amdgpu: add imu support for gc 12_1")
> Signed-off-by: Jesse Zhang <[email protected]>

Reviewed-by: Alex Deucher <[email protected]>

> ---
>  drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 1 +
>  drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c | 1 +
>  drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c | 1 +
>  3 files changed, 3 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c 
> b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
> index 430b8f3743b2..d96c941fc9ce 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
> @@ -695,6 +695,7 @@ static void gfx_v11_0_free_microcode(struct amdgpu_device 
> *adev)
>         amdgpu_ucode_release(&adev->gfx.me_fw);
>         amdgpu_ucode_release(&adev->gfx.rlc_fw);
>         amdgpu_ucode_release(&adev->gfx.mec_fw);
> +       amdgpu_ucode_release(&adev->gfx.imu_fw);
>
>         kfree(adev->gfx.rlc.register_list_format);
>  }
> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c 
> b/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c
> index cb15dad0e57b..ed10dba2b743 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c
> @@ -570,6 +570,7 @@ static void gfx_v12_0_free_microcode(struct amdgpu_device 
> *adev)
>         amdgpu_ucode_release(&adev->gfx.me_fw);
>         amdgpu_ucode_release(&adev->gfx.rlc_fw);
>         amdgpu_ucode_release(&adev->gfx.mec_fw);
> +       amdgpu_ucode_release(&adev->gfx.imu_fw);
>
>         kfree(adev->gfx.rlc.register_list_format);
>  }
> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c 
> b/drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c
> index fde1bad5450f..b7e89f5902a6 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c
> @@ -350,6 +350,7 @@ static void gfx_v12_1_free_microcode(struct amdgpu_device 
> *adev)
>  {
>         amdgpu_ucode_release(&adev->gfx.rlc_fw);
>         amdgpu_ucode_release(&adev->gfx.mec_fw);
> +       amdgpu_ucode_release(&adev->gfx.imu_fw);
>
>         kfree(adev->gfx.rlc.register_list_format);
>  }
> --
> 2.50.1
>

Reply via email to