Skip to contentSkip to conversation

drm/amd: move DRM_ERROR log out of the mutex protect area

PATCH NAK Bernard Zhao 2 participants 2 messages Nov 2, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amd: move DRM_ERROR log out of the mutex protect area

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.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +1 -1
index efda38349a03..cc61b0a5b8d1 100644
@@ -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;
 	}
 
Signature · 1 line
2.29.0
maintainer NAK
#1 lore raw

Am 02.11.20 um 04:14 schrieb Bernard Zhao:

Quoted 3 lines

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.

Quoted 11 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +0 -0
index efda38349a03..cc61b0a5b8d1 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c void amdgpu_register_gpu_instance(struct amdgpu_device *adev) · line 111

Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +1 -1
@@ -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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel