Re: [PATCH 6.1 062/280] drm/amd: Clean up kfd node on surprise disconnect

Mario Limonciello
2026-02-04T15:31:50Z

On 2/4/26 8:37 AM, Greg Kroah-Hartman wrote:
> 6.1-stable review patch. If anyone has any objections, please let me know.
>
> ------------------
>
> From: Mario Limonciello (AMD) <superm1@kernel.org>
>
> commit 28695ca09d326461f8078332aa01db516983e8a2 upstream.
>
> When an eGPU is unplugged the KFD topology should also be destroyed
> for that GPU. This never happens because the fini_sw callbacks never
> get to run. Run them manually before calling amdgpu_device_ip_fini_early()
> when a device has already been disconnected.
>
> This location is intentionally chosen to make sure that the kfd locking
> refcount doesn't get incremented unintentionally.
>
> Cc: kent.russell@amd.com
> Closes: https://community.frame.work/t/amd-egpu-on-linux/8691/33
> Signed-off-by: Mario Limonciello (AMD) <superm1@kernel.org>
> Reviewed-by: Kent Russell <kent.russell@amd.com>
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> (cherry picked from commit 6a23e7b4332c10f8b56c33a9c5431b52ecff9aab)
> Cc: stable@vger.kernel.org
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -4102,6 +4102,14 @@ void amdgpu_device_fini_hw(struct amdgpu
> /* disable ras feature must before hw fini */
> amdgpu_ras_pre_fini(adev);
>
> + /*
> + * device went through surprise hotplug; we need to destroy topology
> + * before ip_fini_early to prevent kfd locking refcount issues by calling
> + * amdgpu_amdkfd_suspend()
> + */
> + if (drm_dev_is_unplugged(adev_to_drm(adev)))
> + amdgpu_amdkfd_device_fini_sw(adev);
> +
> amdgpu_device_ip_fini_early(adev);
>
> amdgpu_irq_fini_hw(adev);
>
>

There was a regression [1] reported on this patch yesterday.

I haven't had time to dig into it; but I think we should hold off
letting it go to any more stable kernels until it's understood.