diff mbox

drm/amdgpu: free handles after fini the context

Message ID 1469454055-3634-1-git-send-email-leo.liu@amd.com (mailing list archive)
State New, archived
Headers show

Commit Message

Leo Liu July 25, 2016, 1:40 p.m. UTC
This will make sure all the submissions from different contexts gets
finished, and then we close the session and free up the handles.

This will fix the issue that session clean-up is not get done properly,
when with the command `kill -9'

Signed-off-by: Leo Liu <leo.liu@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

Comments

Christian König July 25, 2016, 2:16 p.m. UTC | #1
Am 25.07.2016 um 15:40 schrieb Leo Liu:
> This will make sure all the submissions from different contexts gets
> finished, and then we close the session and free up the handles.
>
> This will fix the issue that session clean-up is not get done properly,
> when with the command `kill -9'
>
> Signed-off-by: Leo Liu <leo.liu@amd.com>

Reviewed-by: Christian König <christian.koenig@amd.com>

> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 7 +++----
>   1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> index 29bfd4c..0fb5488 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> @@ -578,6 +578,9 @@ void amdgpu_driver_postclose_kms(struct drm_device *dev,
>   
>   	amdgpu_ctx_mgr_fini(&fpriv->ctx_mgr);
>   
> +	amdgpu_uvd_free_handles(adev, file_priv);
> +	amdgpu_vce_free_handles(adev, file_priv);
> +
>   	amdgpu_vm_fini(adev, &fpriv->vm);
>   
>   	idr_for_each_entry(&fpriv->bo_list_handles, list, handle)
> @@ -602,10 +605,6 @@ void amdgpu_driver_postclose_kms(struct drm_device *dev,
>   void amdgpu_driver_preclose_kms(struct drm_device *dev,
>   				struct drm_file *file_priv)
>   {
> -	struct amdgpu_device *adev = dev->dev_private;
> -
> -	amdgpu_uvd_free_handles(adev, file_priv);
> -	amdgpu_vce_free_handles(adev, file_priv);
>   }
>   
>   /*
diff mbox

Patch

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
index 29bfd4c..0fb5488 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
@@ -578,6 +578,9 @@  void amdgpu_driver_postclose_kms(struct drm_device *dev,
 
 	amdgpu_ctx_mgr_fini(&fpriv->ctx_mgr);
 
+	amdgpu_uvd_free_handles(adev, file_priv);
+	amdgpu_vce_free_handles(adev, file_priv);
+
 	amdgpu_vm_fini(adev, &fpriv->vm);
 
 	idr_for_each_entry(&fpriv->bo_list_handles, list, handle)
@@ -602,10 +605,6 @@  void amdgpu_driver_postclose_kms(struct drm_device *dev,
 void amdgpu_driver_preclose_kms(struct drm_device *dev,
 				struct drm_file *file_priv)
 {
-	struct amdgpu_device *adev = dev->dev_private;
-
-	amdgpu_uvd_free_handles(adev, file_priv);
-	amdgpu_vce_free_handles(adev, file_priv);
 }
 
 /*