Skip to contentSkip to conversation

drm/amdgpu: address the static checker warnings

PATCH In review Evan Quan 2 participants 6 messages Apr 24, 2020 – Apr 29, 2020

Subsystems (2)
lore
Share & tools
lore

Evan Quan

author
#0 lore raw

PATCH 1/1 drm/amdgpu: address the static checker warnings

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c:4199 amdgpu_device_gpu_recover()
error: we previously assumed 'hive' could be null (see line 4196)

This is introduced by "drm/amdgpu: optimize the gpu reset for XGMI setup V2".

Change-Id I9c22b57abc9f512114112f93fb035f1fecf26beb
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2 -1
index 71278942f9f0..898338dc9605 100644
@@ -4274,7 +4274,8 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,
 		if (!amdgpu_device_lock_adev(tmp_adev, !hive)) {
 			DRM_INFO("Bailing on TDR for s_job:%llx, as another already in progress",
 				  job ? job->base.id : -1);
-			mutex_unlock(&hive->hive_lock);
+			if (hive)
+				mutex_unlock(&hive->hive_lock);
 			return 0;
 		}
 
Signature · 6 lines
2.26.2

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#1 lore raw
Quoted 17 lines · Evan Quan

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c:4199 amdgpu_device_gpu_recover()
error: we previously assumed 'hive' could be null (see line 4196)

This is introduced by "drm/amdgpu: optimize the gpu reset for XGMI setup V2".

Change-Id I9c22b57abc9f512114112f93fb035f1fecf26beb
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -0
index 71278942f9f0..898338dc9605 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_gpu_recover(struct amdgpu_device *adev, · line 4278

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2 -1
@@ -4274,7 +4274,8 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,
 		if (!amdgpu_device_lock_adev(tmp_adev, !hive)) {
 			DRM_INFO("Bailing on TDR for s_job:%llx, as another already in progress",
 				  job ? job->base.id : -1);
-			mutex_unlock(&hive->hive_lock);
+			if (hive)
+				mutex_unlock(&hive->hive_lock);

In the current code, we know for a fact that "hive" is NULL at this point. Presumably this will be changed in the future? Otherwise why not just delete the mutex_unlock() because it is dead code.

regards,
dan carpenter

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

author
#2 lore raw

-----Original Message-----
From: Dan Carpenter <[email protected]>
Sent: Friday, April 24, 2020 7:02 PM
To: Quan, Evan <[email protected]>
Cc: [email protected]; Deucher, Alexander <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: address the static checker warnings

Quoted 17 lines · Evan Quan

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c:4199 amdgpu_device_gpu_recover()
error: we previously assumed 'hive' could be null (see line 4196)

This is introduced by "drm/amdgpu: optimize the gpu reset for XGMI setup V2".

Change-Id I9c22b57abc9f512114112f93fb035f1fecf26beb
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -0
index 71278942f9f0..898338dc9605 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_gpu_recover(struct amdgpu_device *adev, · line 4278

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2 -1
@@ -4274,7 +4274,8 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,
 		if (!amdgpu_device_lock_adev(tmp_adev, !hive)) {
 			DRM_INFO("Bailing on TDR for s_job:%llx, as another already in progress",
 				  job ? job->base.id : -1);
-			mutex_unlock(&hive->hive_lock);
+			if (hive)
+				mutex_unlock(&hive->hive_lock);

In the current code, we know for a fact that "hive" is NULL at this
point.
[Evan] No, that's true for SGPU setup only. For XGMI setup(multiple dgpus interconnected with bridges), the "hive" here is not NULL. Presumably this will be changed in the future? Otherwise why
not just delete the mutex_unlock() because it is dead code.

regards,
dan carpenter

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

author
#3 lore raw

Ping..

-----Original Message-----
From: Quan, Evan
Sent: Sunday, April 26, 2020 11:19 AM
To: Dan Carpenter <[email protected]>
Cc: [email protected]; Deucher, Alexander <[email protected]>
Subject: RE: [PATCH] drm/amdgpu: address the static checker warnings

-----Original Message-----
From: Dan Carpenter <[email protected]>
Sent: Friday, April 24, 2020 7:02 PM
To: Quan, Evan <[email protected]>
Cc: [email protected]; Deucher, Alexander <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: address the static checker warnings

Quoted 19 lines · Evan Quan

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c:4199 amdgpu_device_gpu_recover()
error: we previously assumed 'hive' could be null (see line 4196)

This is introduced by "drm/amdgpu: optimize the gpu reset for XGMI setup V2".

Change-Id I9c22b57abc9f512114112f93fb035f1fecf26beb
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -0
index 71278942f9f0..898338dc9605 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_gpu_recover(struct amdgpu_device *adev, · line 4278

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2 -1
@@ -4274,7 +4274,8 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,
 		if (!amdgpu_device_lock_adev(tmp_adev, !hive)) {
 			DRM_INFO("Bailing on TDR for s_job:%llx, as another already in progress",
 				  job ? job->base.id : -1);
-			mutex_unlock(&hive->hive_lock);
+			if (hive)
+				mutex_unlock(&hive->hive_lock);

In the current code, we know for a fact that "hive" is NULL at this point.
[Evan] No, that's true for SGPU setup only. For XGMI setup(multiple dgpus interconnected with bridges), the "hive" here is not NULL. Presumably this will be changed in the future? Otherwise why not just delete the mutex_unlock() because it is dead code.

regards,
dan carpenter

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#4 lore raw
Quoted 1 line · Evan

Ping..

Are you asking me? It's really hard for me to read your emails. Normally email clients put "> " in front of the quoted parts of the email. Your email client doesn't line wrap at 72 characters either. :(

Quoted 1 line

[Evan] No, that's true for SGPU setup only. For XGMI setup(multiple dgpus interconnected with bridges), the "hive" here is not NULL.

Presumably you are talking about out of tree code so I can't comment on this. In the current linux-next we know that amdgpu_device_lock_adev() will only return false when "hive" is NULL.

regards,
dan carpenter

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

author
#5 lore raw

Thanks, I think I get your point. With hive!= NULL, it never fails on the amdgpu_device_lock_adev(). Sorry for miss that. Will send a new patch.

Regards,
Evan
-----Original Message-----
From: Dan Carpenter <[email protected]>
Sent: Tuesday, April 28, 2020 7:02 PM
To: Quan, Evan <[email protected]>
Cc: [email protected]; Deucher, Alexander <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: address the static checker warnings

Quoted 1 line · Evan

Ping..

Are you asking me? It's really hard for me to read your emails.
Normally email clients put "> " in front of the quoted parts of the email. Your email client doesn't line wrap at 72 characters either. :(

Quoted 1 line

[Evan] No, that's true for SGPU setup only. For XGMI setup(multiple dgpus interconnected with bridges), the "hive" here is not NULL.

Presumably you are talking about out of tree code so I can't comment on this. In the current linux-next we know that amdgpu_device_lock_adev() will only return false when "hive" is NULL.

regards,
dan carpenter

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx