dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/amd: move DRM_ERROR log out of the mutex protect area
@ 2020-11-02  3:14 Bernard Zhao
  2020-11-02 15:03 ` Christian König
  0 siblings, 1 reply; 2+ messages in thread
From: Bernard Zhao @ 2020-11-02  3:14 UTC (permalink / raw)
  To: Alex Deucher, Christian König, David Airlie, Daniel Vetter,
	Evan Quan, Luben Tuikov, Xiaojie Yuan, Changfeng, Dave Airlie,
	Nicholas Kazlauskas, Thomas Zimmermann, amd-gfx, dri-devel,
	linux-kernel
  Cc: opensource.kernel, Bernard Zhao

In function amdgpu_register_gpu_instance, there is no need to
protect DRM_ERROR in mutex mgpu_info.mutex.
This change is to make the code to run a bit fast.

Signed-off-by: Bernard Zhao <bernard@vivo.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
index efda38349a03..cc61b0a5b8d1 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
@@ -104,8 +104,8 @@ void amdgpu_register_gpu_instance(struct amdgpu_device *adev)
 	mutex_lock(&mgpu_info.mutex);
 
 	if (mgpu_info.num_gpu >= MAX_GPU_INSTANCE) {
-		DRM_ERROR("Cannot register more gpu instance\n");
 		mutex_unlock(&mgpu_info.mutex);
+		DRM_ERROR("Cannot register more gpu instance\n");
 		return;
 	}
 
-- 
2.29.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] drm/amd: move DRM_ERROR log out of the mutex protect area
  2020-11-02  3:14 [PATCH] drm/amd: move DRM_ERROR log out of the mutex protect area Bernard Zhao
@ 2020-11-02 15:03 ` Christian König
  0 siblings, 0 replies; 2+ messages in thread
From: Christian König @ 2020-11-02 15:03 UTC (permalink / raw)
  To: Bernard Zhao, Alex Deucher, David Airlie, Daniel Vetter,
	Evan Quan, Luben Tuikov, Xiaojie Yuan, Changfeng, Dave Airlie,
	Nicholas Kazlauskas, Thomas Zimmermann, amd-gfx, dri-devel,
	linux-kernel
  Cc: opensource.kernel

Am 02.11.20 um 04:14 schrieb Bernard Zhao:
> In function amdgpu_register_gpu_instance, there is no need to
> protect DRM_ERROR in mutex mgpu_info.mutex.
> This change is to make the code to run a bit fast.

NAK, performance for an error path in module load is pretty much irrelevant.

This just looks like a random unnecessary code change to me.

Regards,
Christian.

>
> Signed-off-by: Bernard Zhao <bernard@vivo.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> index efda38349a03..cc61b0a5b8d1 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> @@ -104,8 +104,8 @@ void amdgpu_register_gpu_instance(struct amdgpu_device *adev)
>   	mutex_lock(&mgpu_info.mutex);
>   
>   	if (mgpu_info.num_gpu >= MAX_GPU_INSTANCE) {
> -		DRM_ERROR("Cannot register more gpu instance\n");
>   		mutex_unlock(&mgpu_info.mutex);
> +		DRM_ERROR("Cannot register more gpu instance\n");
>   		return;
>   	}
>   

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-11-02 15:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-02  3:14 [PATCH] drm/amd: move DRM_ERROR log out of the mutex protect area Bernard Zhao
2020-11-02 15:03 ` Christian König

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).