drm/amdgpu: Move psp_xgmi_terminate call from amdgpu_xgmi_remove_device to psp_hw_fini
Subsystems (2)
PATCH v2 1/2 drm/amdgpu: Move psp_xgmi_terminate call from amdgpu_xgmi_remove_device to psp_hw_fini
V1:
The amdgpu_xgmi_remove_device function will send unload command to psp through psp ring to terminate xgmi, but psp ring has been destroyed in psp_hw_fini.
V2:
1. Change the commit title.
2. Restore amdgpu_xgmi_remove_device to its original calling location. Move psp_xgmi_terminate call from amdgpu_xgmi_remove_device to psp_hw_fini.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 3 +++ drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +3 -0
@@ -2641,6 +2641,9 @@ static int psp_hw_fini(void *handle)psp_rap_terminate (psp);psp_dtm_terminate (psp);psp_hdcp_terminate (psp); + +if (adev->gmc.xgmi.num_physical_nodes >1 ) +psp_xgmi_terminate (psp); }psp_asd_terminate (psp);
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +1 -1
@@ -742,7 +742,7 @@ int amdgpu_xgmi_remove_device(struct amdgpu_device *adev)amdgpu_put_xgmi_hive (hive); } -return psp_xgmi_terminate (&adev->psp); +return 0 ; }static int amdgpu_xgmi_ras_late_init (struct amdgpu_device *adev,struct ras_common_if *ras_block)
Signature · 1 line
2.25.1
PATCH v2 2/2 drm/amdgpu: fix hive reference leak when adding xgmi device
Only amdgpu_get_xgmi_hive but no amdgpu_put_xgmi_hive which will leak the hive reference.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2 -0
@@ -2456,12 +2456,14 @@ static int amdgpu_device_ip_init(struct amdgpu_device *adev)if (!hive->reset_domain || !amdgpu_reset_get_reset_domain (hive->reset_domain)) { r = -ENOENT ; +amdgpu_put_xgmi_hive (hive); goto init_failed; }/* Drop the early temporary reset domain we created for device */ amdgpu_reset_put_reset_domain (adev->reset_domain); adev->reset_domain = hive->reset_domain; +amdgpu_put_xgmi_hive (hive); } }
Signature · 1 line
2.25.1
Re: [PATCH V2 2/2] drm/amdgpu: fix hive reference leak when adding xgmi device
[AMD Official Use Only - General]
Series is
Regards,
Hawking
From: Chai, Thomas <[email protected]>
Date: Wednesday, August 17, 2022 at 14:20
To: [email protected] <[email protected]>
Cc: Chai, Thomas <[email protected]>, Zhang, Hawking <[email protected]>, Zhou1, Tao <[email protected]>, Clements, John <[email protected]>, Li, Candice <[email protected]>, Chai, Thomas <[email protected]>
Subject: [PATCH V2 2/2] drm/amdgpu: fix hive reference leak when adding xgmi device
Only amdgpu_get_xgmi_hive but no amdgpu_put_xgmi_hive
which will leak the hive reference.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2 -0
@@ -2456,12 +2456,14 @@ static int amdgpu_device_ip_init(struct amdgpu_device *adev)if (!hive->reset_domain || !amdgpu_reset_get_reset_domain (hive->reset_domain)) { r = -ENOENT ; +amdgpu_put_xgmi_hive (hive); goto init_failed; }/* Drop the early temporary reset domain we created for device */ amdgpu_reset_put_reset_domain (adev->reset_domain); adev->reset_domain = hive->reset_domain; +amdgpu_put_xgmi_hive (hive); } }
--
2.25.1