drm/amdgpu: fix gart.bo pin_count leak
Subsystems (2)
PATCH 1/1 drm/amdgpu: fix gart.bo pin_count leak
gmc_v{9,10}_0_gart_disable() isn't called matched with correspoding gart_enbale function in SRIOV case. This will lead to gart.bo pin_count leak on driver unload.
Cc Hawking Zhang <[email protected]>
Signed-off-by Leslie Shi <[email protected]>
Signed-off-by Guchun Chen <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 3 ++- drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +2 -1
@@ -1098,6 +1098,8 @@ static int gmc_v10_0_hw_fini(void *handle) {struct amdgpu_device *adev = (struct amdgpu_device *)handle; +gmc_v10_0_gart_disable (adev); +if (amdgpu_sriov_vf (adev)) {/* full access mode, so don't touch any GMC register */ DRM_DEBUG ("For SRIOV client, shouldn't do anything.\n" );
@@ -1106,7 +1108,6 @@ static int gmc_v10_0_hw_fini(void *handle)amdgpu_irq_put (adev, &adev->gmc.ecc_irq,0 );amdgpu_irq_put (adev, &adev->gmc.vm_fault,0 ); -gmc_v10_0_gart_disable (adev);return 0 ; }
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +2 -1
@@ -1794,6 +1794,8 @@ static int gmc_v9_0_hw_fini(void *handle) {struct amdgpu_device *adev = (struct amdgpu_device *)handle; +gmc_v9_0_gart_disable (adev); +if (amdgpu_sriov_vf (adev)) {/* full access mode, so don't touch any GMC register */ DRM_DEBUG ("For SRIOV client, shouldn't do anything.\n" );
@@ -1802,7 +1804,6 @@ static int gmc_v9_0_hw_fini(void *handle)amdgpu_irq_put (adev, &adev->gmc.ecc_irq,0 );amdgpu_irq_put (adev, &adev->gmc.vm_fault,0 ); -gmc_v9_0_gart_disable (adev);return 0 ; }
Signature · 1 line
2.25.1
Am 23.09.21 um 10:16 schrieb Leslie Shi:
Quoted 7 lines
gmc_v{9,10}_0_gart_disable() isn't called matched with correspoding
gart_enbalefunction in SRIOV case. This will lead to gart.bopin_countleak on driver unload.Cc Hawking Zhang <[email protected]>Signed-off-by Leslie Shi <[email protected]>Signed-off-by Guchun Chen <[email protected]>
Reviewed-by Christian König <[email protected]>
Quoted 47 lines
--- drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 3 ++- drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +2
-1@@ -1098,6 +1098,8 @@ static int gmc_v10_0_hw_fini(void *handle) {struct amdgpu_device *adev = (struct amdgpu_device *)handle; +gmc_v10_0_gart_disable (adev); +if (amdgpu_sriov_vf (adev)) {/* full access mode, so don't touch any GMC register */ DRM_DEBUG ("For SRIOV client, shouldn't do anything.\n" );@@ -1106,7 +1108,6 @@ static int gmc_v10_0_hw_fini(void *handle)amdgpu_irq_put (adev, &adev->gmc.ecc_irq,0 );amdgpu_irq_put (adev, &adev->gmc.vm_fault,0 ); -gmc_v10_0_gart_disable (adev);return 0 ; }drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +2
-1@@ -1794,6 +1794,8 @@ static int gmc_v9_0_hw_fini(void *handle) {struct amdgpu_device *adev = (struct amdgpu_device *)handle; +gmc_v9_0_gart_disable (adev); +if (amdgpu_sriov_vf (adev)) {/* full access mode, so don't touch any GMC register */ DRM_DEBUG ("For SRIOV client, shouldn't do anything.\n" );@@ -1802,7 +1804,6 @@ static int gmc_v9_0_hw_fini(void *handle)amdgpu_irq_put (adev, &adev->gmc.ecc_irq,0 );amdgpu_irq_put (adev, &adev->gmc.vm_fault,0 ); -gmc_v9_0_gart_disable (adev);return 0 ; }