[3/4] drm/amdgpu: Optimization of mutex usage

Submitted by Xie, AlexBin on June 12, 2017, 8:31 p.m.

Details

Message ID 1497299485-7337-3-git-send-email-AlexBin.Xie@amd.com
State New
Headers show
Series "Series without cover letter" ( rev: 1 ) in AMD X.Org drivers

Not browsing as part of any series.

Commit Message

Xie, AlexBin June 12, 2017, 8:31 p.m.
There is no need to lock the bo_list mutex,
because there is no other task can access
the newly created BO list yet.

Signed-off-by: Alex Xie <AlexBin.Xie@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c | 3 ---
 1 file changed, 3 deletions(-)

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c
index c994a04..4363f28 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c
@@ -60,8 +60,6 @@  static int amdgpu_bo_list_create(struct amdgpu_fpriv *fpriv,
 	(*result)->num_entries = 0;
 	(*result)->array = NULL;
 
-	mutex_lock(&(*result)->lock);
-
 	return 0;
 }
 
@@ -282,7 +280,6 @@  int amdgpu_bo_list_ioctl(struct drm_device *dev, void *data,
 
 		r = amdgpu_bo_list_set(adev, filp, list, info,
 					      args->in.bo_number);
-		amdgpu_bo_list_put(list);
 		if (r)
 			goto error_free;
 

Comments

Am 12.06.2017 um 22:31 schrieb Alex Xie:
> There is no need to lock the bo_list mutex,
> because there is no other task can access
> the newly created BO list yet.

Again NAK, this can race as well when a task guess the next ID number or 
incorrectly uses an old one.

Christian.

>
> Signed-off-by: Alex Xie <AlexBin.Xie@amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c | 3 ---
>   1 file changed, 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c
> index c994a04..4363f28 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c
> @@ -60,8 +60,6 @@ static int amdgpu_bo_list_create(struct amdgpu_fpriv *fpriv,
>   	(*result)->num_entries = 0;
>   	(*result)->array = NULL;
>   
> -	mutex_lock(&(*result)->lock);
> -
>   	return 0;
>   }
>   
> @@ -282,7 +280,6 @@ int amdgpu_bo_list_ioctl(struct drm_device *dev, void *data,
>   
>   		r = amdgpu_bo_list_set(adev, filp, list, info,
>   					      args->in.bo_number);
> -		amdgpu_bo_list_put(list);
>   		if (r)
>   			goto error_free;
>