Skip to contentSkip to conversation

drm/amdgpu/sriov: reject kms open if TDR not finished or failed

PATCH In review Emily Deng 4 participants 12 messages Apr 25, 2018 – May 3, 2018 10 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

Emily Deng

author
#0 lore raw

PATCH 1/1 drm/amdgpu/sriov: reject kms open if TDR not finished or failed

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +3 -0
index 6d55cae..adeca71 100644
@@ -847,6 +847,9 @@ int amdgpu_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv)
 	struct amdgpu_fpriv *fpriv;
 	int r, pasid;
 
+	if (adev->in_gpu_reset)
+		return -ECANCELED;
+
 	file_priv->driver_priv = NULL;
 
 	r = pm_runtime_get_sync(dev->dev);
Signature · 6 lines
2.7.4

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

A message that is not in the archive (sent off-list or not yet received): 1524638384-31977-1-git-send-email-Emily.Deng-5C7GfCeVMHo@public.gmane.org

#2 lore raw
Quoted 10 lines · Emily Deng
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +0 -0
index 6d55cae..adeca71 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c int amdgpu_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv) · line 851

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +2 -0
@@ -847,6 +847,9 @@ int amdgpu_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv)
 	struct amdgpu_fpriv *fpriv;
 	int r, pasid;
 
+	if (adev->in_gpu_reset)
+		return -ECANCELED;

This seems like a bad idea, as it would cause basically any userspace which wants to use the GPU to fail to start during a GPU reset.

Signature · 6 lines
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 5bede6f6-24b2-8a3a-d3d8-9a37ac6d13c8-otUistvHUpPR7s880joybQ@public.gmane.org

#4 lore raw

Hi Michel,
> This seems like a bad idea, as it would cause basically any userspace which

Quoted 1 line

wants to use the GPU to fail to start during a GPU reset.

[Emily] Yes, this is what the change want to do, when driver is doing gpu recover or hardware is doing reset, it doesn't want to be interrupted, and during the reset any driver open kms is meaningless. This behavior could let the gpu recover and hardware reset back more quickly. After finished the reset, we will set adev->in_gpu_reset=0 again, then could allow the application open the kms.

Best Wishes,
Emily Deng

Quoted 31 lines

-----Original Message-----
From: Michel Dänzer [mailto:[email protected]]
Sent: Wednesday, April 25, 2018 3:48 PM
To: Deng, Emily <[email protected]>
Cc: [email protected]; Liu, Monk <[email protected]>
Subject: Re: [PATCH] drm/amdgpu/sriov: reject kms open if TDR not finished or failed

drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c int amdgpu_driver_open_kms(struct drm_device

Quoted 11 lines · Emily Deng
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +0 -0
index 6d55cae..adeca71 100644
@@ -847,6 +847,9 @@ int amdgpu_driver_open_kms(struct drm_device

*dev, struct drm_file *file_priv)

drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c int amdgpu_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv) · line 851

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +2 -0
 	struct amdgpu_fpriv *fpriv;
 	int r, pasid;
 
+	if (adev->in_gpu_reset)
+		return -ECANCELED;

This seems like a bad idea, as it would cause basically any userspace which wants to use the GPU to fail to start during a GPU reset.

Quoted 3 lines

--
Earthling Michel Dänzer | http://www.amd.com
Libre software enthusiast | Mesa and X developer

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

A message that is not in the archive (sent off-list or not yet received): CY4PR12MB11254FFDBB4FCCF91CBDE9758F8E0-rpdhrqHFk07v2MZdTKcfDgdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

#6 lore raw
Quoted 7 lines · Emily

Hi Michel,

Quoted 3 lines

This seems like a bad idea, as it would cause basically any userspace which wants to use the GPU to fail to start during a GPU reset.

[Emily] Yes, this is what the change want to do, when driver is doing gpu recover or hardware is doing reset, it doesn't want to be interrupted, and during the reset any driver open kms is meaningless.

Applications randomly failing to start up during a GPU reset would be surprising and confusing for the user. The driver needs to handle this transparently.

Signature · 6 lines
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): e7756d73-aa65-b351-2b1a-81ceea1e013f-otUistvHUpPR7s880joybQ@public.gmane.org

#8 lore raw

This seems like a bad idea, as it would cause basically any userspace which wants to use the GPU to fail to start during a GPU reset. [Emily] Yes, this is what the change want to do, when driver is doing gpu recover or hardware is doing reset, it doesn't want to be
interrupted, and during the reset any driver open kms is meaningless.

Applications randomly failing to start up during a GPU reset would be
surprising and confusing for the user. The driver needs to handle this transparently.
[Emily] Yes, you are right, how about to sleep for some time in here to wait the GPU reset successfully. After sleep, if it still in gpu reset, then return error to APP?

Best Wishes,
Emily Deng

Quoted 16 lines

-----Original Message-----
From: Michel Dänzer [mailto:[email protected]]
Sent: Thursday, April 26, 2018 3:33 PM
To: Deng, Emily <[email protected]>; Liu, Monk <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH] drm/amdgpu/sriov: reject kms open if TDR not finished or failed

Quoted 6 lines · Emily

Hi Michel,

Quoted 2 lines

This seems like a bad idea, as it would cause basically any userspace which wants to use the GPU to fail to start during a GPU reset.

[Emily] Yes, this is what the change want to do, when driver is doing gpu recover or hardware is doing reset, it doesn't want to be interrupted, and during the reset any driver open kms is meaningless.

Quoted 8 lines

Applications randomly failing to start up during a GPU reset would be surprising and confusing for the user. The driver needs to handle this transparently.

--
Earthling Michel Dänzer | http://www.amd.com
Libre software enthusiast | Mesa and X developer

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

A message that is not in the archive (sent off-list or not yet received): CY4PR12MB112547536CD27B7FE2C330F38F8E0-rpdhrqHFk07v2MZdTKcfDgdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

#10 lore raw
Quoted 8 lines · Emily
Quoted 8 lines
Quoted 7 lines
Quoted 3 lines

This seems like a bad idea, as it would cause basically any userspace which wants to use the GPU to fail to start during a GPU reset.

[Emily] Yes, this is what the change want to do, when driver is doing gpu recover or hardware is doing reset, it doesn't want to be interrupted, and during the reset any driver open kms is meaningless.

Quoted 6 lines
Quoted 3 lines

Applications randomly failing to start up during a GPU reset would be surprising and confusing for the user. The driver needs to handle this transparently.

[Emily] Yes, you are right, how about to sleep for some time in here to wait the GPU reset successfully. After sleep, if it still in gpu reset, then return error to APP?

I think the only case where returning an error here *might* be appropriate is when the driver has tried resetting the GPU, but it has definitely and irrecoverably failed. But even in that case, it might be better to let the open succeed, and let userspace figure out what happened by other means.

Signature · 6 lines
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 9d56b1c3-1e51-f3f1-17d6-c1615dea0a05-otUistvHUpPR7s880joybQ@public.gmane.org

#12 lore raw

Sorry, I don't get your point, when the GPU is doing a reset, even let the dkms open, the userspace will still fail, so during the reset, any driver open kms is meaningless.

Best Wishes,
Emily Deng

Quoted 30 lines

-----Original Message-----
From: Michel Dänzer [mailto:[email protected]]
Sent: Thursday, April 26, 2018 5:01 PM
To: Deng, Emily <[email protected]>; Liu, Monk <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH] drm/amdgpu/sriov: reject kms open if TDR not finished or failed

Quoted 8 lines · Emily
Quoted 8 lines
Quoted 7 lines
Quoted 3 lines

This seems like a bad idea, as it would cause basically any userspace which wants to use the GPU to fail to start during a GPU reset.

[Emily] Yes, this is what the change want to do, when driver is doing gpu recover or hardware is doing reset, it doesn't want to be interrupted, and during the reset any driver open kms is meaningless.

Quoted 6 lines
Quoted 3 lines

Applications randomly failing to start up during a GPU reset would be surprising and confusing for the user. The driver needs to handle this transparently.

[Emily] Yes, you are right, how about to sleep for some time in here to wait the GPU reset successfully. After sleep, if it still in gpu reset, then return error to APP?

I think the only case where returning an error here *might* be appropriate is when the driver has tried resetting the GPU, but it has definitely and irrecoverably failed. But even in that case, it might be better to let the open succeed, and let userspace figure out what happened by other means.

Quoted 3 lines

--
Earthling Michel Dänzer | http://www.amd.com
Libre software enthusiast | Mesa and X developer

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

A message that is not in the archive (sent off-list or not yet received): CY4PR12MB1125653A73D8A22533FB3FBE8F8D0-rpdhrqHFk07v2MZdTKcfDgdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

#14 lore raw
Quoted 3 lines · Emily

Sorry, I don't get your point, when the GPU is doing a reset, even let the dkms open, the userspace will still fail, so during the reset, any driver open kms is meaningless.

That needs to be fixed, then. If the GPU reset succeeds, userspace shouldn't have to fail.

Signature · 6 lines
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 77a5af30-0371-4816-fcf5-0bbcffa4395c-otUistvHUpPR7s880joybQ@public.gmane.org

#16 lore raw

No, I mean during GPU reset, the app will fail, it is reasonable. The flag in_gpu_reset indicates the GPU is in reset state, after reset, we will set the flag back.

Best Wishes,
Emily Deng

Quoted 13 lines

-----Original Message-----
From: Michel Dänzer [mailto:[email protected]]
Sent: Friday, April 27, 2018 3:52 PM
To: Deng, Emily <[email protected]>; Liu, Monk <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH] drm/amdgpu/sriov: reject kms open if TDR not finished or failed

Quoted 3 lines · Emily

Sorry, I don't get your point, when the GPU is doing a reset, even let the dkms open, the userspace will still fail, so during the reset, any driver open kms is meaningless.

Quoted 7 lines

That needs to be fixed, then. If the GPU reset succeeds, userspace shouldn't have to fail.

--
Earthling Michel Dänzer | http://www.amd.com
Libre software enthusiast | Mesa and X developer

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

A message that is not in the archive (sent off-list or not yet received): CY4PR12MB11253279D4404CF482FD7CF08F8D0-rpdhrqHFk07v2MZdTKcfDgdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

#18 lore raw
Quoted 1 line · Emily

No, I mean during GPU reset, the app will fail, it is reasonable.

I understand, but I don't agree that it's reasonable. :)

Signature · 6 lines
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): fc3f05cd-ed48-c04e-cfcb-59ed5ab224e2-otUistvHUpPR7s880joybQ@public.gmane.org

#20 lore raw

Am 27.04.2018 um 10:22 schrieb Michel Dänzer:

Quoted 3 lines · Emily
Quoted 1 line

No, I mean during GPU reset, the app will fail, it is reasonable.

I understand, but I don't agree that it's reasonable. :)

I agree with Michel here that this is a really bad idea.

Even while the GPU is in reset an application should still be able to load userspace and open the driver.

It migth need to reset it's context even if it never used them, but that is a completely different story.

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

Reviewed-by Monk
#21 lore raw
In reply to a message not in the archive
Reviewed-by Monk

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Emily Deng
Sent: 2018年4月25日 14:40
To: [email protected]
Cc: Deng, Emily <[email protected]>; Liu, Monk <[email protected]>
Subject: [PATCH] drm/amdgpu/sriov: reject kms open if TDR not finished or failed

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +3 -0
index 6d55cae..adeca71 100644
@@ -847,6 +847,9 @@ int amdgpu_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv)
 	struct amdgpu_fpriv *fpriv;
 	int r, pasid;
 
+	if (adev->in_gpu_reset)
+		return -ECANCELED;
+
 	file_priv->driver_priv = NULL;
 
 	r = pm_runtime_get_sync(dev->dev);
Signature · 10 lines
2.7.4

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