Skip to contentSkip to conversation

drm/amd/amdgpu:Fix compute ring unable to detect hang.

PATCH Superseded Jesse Zhang 2 participants 10 messages Sep 19, 2019 – Sep 20, 2019 5 messages not in the archive

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

PATCH v2 1/1 drm/amd/amdgpu:Fix compute ring unable to detect hang.

When compute fence did signal, compute ring cannot detect hardware hang because its timeout value is set to be infinite by default.

In SR-IOV and passthrough mode, if user does not declare custome timeout value for compute ring, then use gfx ring timeout value as default. So that when there is a ture hardware hang, compute ring can detect it.

Change-Id I794ec0868c6c0aad407749457260ecfee0617c10
---
 drivers/gpu/drm/amd/amdgpu/soc15.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/gpu/drm/amd/amdgpu/soc15.c +10 -0
index 7c7e9f5..6cd5548 100644
@@ -687,6 +687,16 @@ int soc15_set_ip_blocks(struct amdgpu_device *adev)
 	adev->rev_id = soc15_get_rev_id(adev);
 	adev->nbio.funcs->detect_hw_virt(adev);
 
+	/*
+	 * If running under SR-IOV or passthrough mode and user did not set
+	 * custom value for compute ring timeout, set timeout to be the same
+	 * as gfx ring timeout to avoid compute ring cannot detect an true
+	 * hang.
+	 */
+	if ((amdgpu_sriov_vf(adev) || amdgpu_passthrough(adev)) &&
+		(adev->compute_timeout == MAX_SCHEDULE_TIMEOUT))
+		adev->compute_timeout = adev->gfx_timeout;
+
 	if (amdgpu_sriov_vf(adev))
 		adev->virt.ops = &xgpu_ai_virt_ops;
 
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): 1568876935-18731-2-git-send-email-zhexi.zhang-5C7GfCeVMHo@public.gmane.org

#2 lore raw

PATCH v3 1/1 drm/amd/amdgpu:Fix compute ring unable to detect hang.

When compute fence did signal, compute ring cannot detect hardware hang because its timeout value is set to be infinite by default.

In SR-IOV and passthrough mode, if user does not declare custome timeout value for compute ring, then use gfx ring timeout value as default. So that when there is a ture hardware hang, compute ring can detect it.

Change-Id I794ec0868c6c0aad407749457260ecfee0617c10
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c |  5 +----
 drivers/gpu/drm/amd/amdgpu/soc15.c        | 10 ++++++++++
 2 files changed, 11 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c +1 -4
index cbcaa7c..963b6d1 100644
@@ -468,10 +468,7 @@ int amdgpu_fence_driver_init_ring(struct amdgpu_ring *ring,
 			 * For sriov case, always use the timeout
 			 * as gfx ring
 			 */
-			if (!amdgpu_sriov_vf(ring->adev))
-				timeout = adev->compute_timeout;
-			else
-				timeout = adev->gfx_timeout;
+			timeout = adev->compute_timeout;
 			break;
 		case AMDGPU_RING_TYPE_SDMA:
 			timeout = adev->sdma_timeout;
drivers/gpu/drm/amd/amdgpu/soc15.c +10 -0
index 7c7e9f5..6cd5548 100644
@@ -687,6 +687,16 @@ int soc15_set_ip_blocks(struct amdgpu_device *adev)
 	adev->rev_id = soc15_get_rev_id(adev);
 	adev->nbio.funcs->detect_hw_virt(adev);
 
+	/*
+	 * If running under SR-IOV or passthrough mode and user did not set
+	 * custom value for compute ring timeout, set timeout to be the same
+	 * as gfx ring timeout to avoid compute ring cannot detect an true
+	 * hang.
+	 */
+	if ((amdgpu_sriov_vf(adev) || amdgpu_passthrough(adev)) &&
+		(adev->compute_timeout == MAX_SCHEDULE_TIMEOUT))
+		adev->compute_timeout = adev->gfx_timeout;
+
 	if (amdgpu_sriov_vf(adev))
 		adev->virt.ops = &xgpu_ai_virt_ops;
 
Signature · 6 lines
2.7.4

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

PATCH v4 1/1 drm/amd/amdgpu:Fix compute ring unable to detect hang.

In reply to a message not in the archive

When compute fence did not signal, compute ring cannot detect hardware hang because its timeout value is set to be infinite by default.

In SR-IOV and passthrough mode, if user does not declare custome timeout value for compute ring, then use gfx ring timeout value as default. So that when there is a ture hardware hang, compute ring can detect it.

Change-Id I794ec0868c6c0aad407749457260ecfee0617c10
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c |  5 +----
 drivers/gpu/drm/amd/amdgpu/soc15.c        | 10 ++++++++++
 2 files changed, 11 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c +1 -4
index cbcaa7c..963b6d1 100644
@@ -468,10 +468,7 @@ int amdgpu_fence_driver_init_ring(struct amdgpu_ring *ring,
 			 * For sriov case, always use the timeout
 			 * as gfx ring
 			 */
-			if (!amdgpu_sriov_vf(ring->adev))
-				timeout = adev->compute_timeout;
-			else
-				timeout = adev->gfx_timeout;
+			timeout = adev->compute_timeout;
 			break;
 		case AMDGPU_RING_TYPE_SDMA:
 			timeout = adev->sdma_timeout;
drivers/gpu/drm/amd/amdgpu/soc15.c +10 -0
index 7c7e9f5..6cd5548 100644
@@ -687,6 +687,16 @@ int soc15_set_ip_blocks(struct amdgpu_device *adev)
 	adev->rev_id = soc15_get_rev_id(adev);
 	adev->nbio.funcs->detect_hw_virt(adev);
 
+	/*
+	 * If running under SR-IOV or passthrough mode and user did not set
+	 * custom value for compute ring timeout, set timeout to be the same
+	 * as gfx ring timeout to avoid compute ring cannot detect an true
+	 * hang.
+	 */
+	if ((amdgpu_sriov_vf(adev) || amdgpu_passthrough(adev)) &&
+		(adev->compute_timeout == MAX_SCHEDULE_TIMEOUT))
+		adev->compute_timeout = adev->gfx_timeout;
+
 	if (amdgpu_sriov_vf(adev))
 		adev->virt.ops = &xgpu_ai_virt_ops;
 
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): 1568880041-19830-1-git-send-email-zhexi.zhang-5C7GfCeVMHo@public.gmane.org

#5 lore raw

Am 19.09.19 um 10:00 schrieb Jesse Zhang:

Quoted 19 lines

When compute fence did not signal, compute ring cannot detect hardware hang because its timeout value is set to be infinite by default.

In SR-IOV and passthrough mode, if user does not declare custome timeout value for compute ring, then use gfx ring timeout value as default. So that when there is a ture hardware hang, compute ring can detect it.

Change-Id I794ec0868c6c0aad407749457260ecfee0617c10
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c |  5 +----
  drivers/gpu/drm/amd/amdgpu/soc15.c        | 10 ++++++++++
  2 files changed, 11 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c +0 -0
index cbcaa7c..963b6d1 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c int amdgpu_fence_driver_init_ring(struct amdgpu_ring *ring, · line 470

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c +0 -0
@@ -468,10 +468,7 @@ int amdgpu_fence_driver_init_ring(struct amdgpu_ring *ring,
  			 * For sriov case, always use the timeout
  			 * as gfx ring
  			 */

Please also remove the comment since that is now stale.

Apart from that looks good to me,
Christian.

Quoted 19 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c +1 -4
-			if (!amdgpu_sriov_vf(ring->adev))
-				timeout = adev->compute_timeout;
-			else
-				timeout = adev->gfx_timeout;
+			timeout = adev->compute_timeout;
  			break;
  		case AMDGPU_RING_TYPE_SDMA:
  			timeout = adev->sdma_timeout;
drivers/gpu/drm/amd/amdgpu/soc15.c +3 -0
index 7c7e9f5..6cd5548 100644
@@ -687,6 +687,16 @@ int soc15_set_ip_blocks(struct amdgpu_device *adev)
  	adev->rev_id = soc15_get_rev_id(adev);
  	adev->nbio.funcs->detect_hw_virt(adev);
 
+	/*
+	 * If running under SR-IOV or passthrough mode and user did not set
+	 * custom value for compute ring timeout, set timeout to be the same

drivers/gpu/drm/amd/amdgpu/soc15.c int soc15_set_ip_blocks(struct amdgpu_device *adev) · line 702

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/soc15.c +7 -0
+	 * as gfx ring timeout to avoid compute ring cannot detect an true
+	 * hang.
+	 */
+	if ((amdgpu_sriov_vf(adev) || amdgpu_passthrough(adev)) &&
+		(adev->compute_timeout == MAX_SCHEDULE_TIMEOUT))
+		adev->compute_timeout = adev->gfx_timeout;
+
  	if (amdgpu_sriov_vf(adev))
  		adev->virt.ops = &xgpu_ai_virt_ops;
 

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

#6 lore raw

PATCH v5 1/1 drm/amd/amdgpu:Fix compute ring unable to detect hang.

In reply to a message not in the archive

When compute fence did signal, compute ring cannot detect hardware hang because its timeout value is set to be infinite by default.

In SR-IOV and passthrough mode, if user does not declare custome timeout value for compute ring, then use gfx ring timeout value as default. So that when there is a ture hardware hang, compute ring can detect it.

Change-Id I794ec0868c6c0aad407749457260ecfee0617c10
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 12 ++++++------
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c    |  4 +++-
 2 files changed, 9 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +6 -6
index 3b5282b..03ac5a1da 100644
@@ -1024,12 +1024,6 @@ static int amdgpu_device_check_arguments(struct amdgpu_device *adev)
 
 	amdgpu_device_check_block_size(adev);
 
-	ret = amdgpu_device_get_job_timeout_settings(adev);
-	if (ret) {
-		dev_err(adev->dev, "invalid lockup_timeout parameter syntax\n");
-		return ret;
-	}
-
 	adev->firmware.load_type = amdgpu_ucode_get_load_type(adev, amdgpu_fw_load_type);
 
 	return ret;
@@ -2732,6 +2726,12 @@ int amdgpu_device_init(struct amdgpu_device *adev,
 	if (r)
 		return r;
 
+	r = amdgpu_device_get_job_timeout_settings(adev);
+	if (r) {
+		dev_err(adev->dev, "invalid lockup_timeout parameter syntax\n");
+		return r;
+	}
+
 	/* doorbell bar mapping and doorbell index init*/
 	amdgpu_device_doorbell_init(adev);
 
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +3 -1
index 420888e..1236245 100644
@@ -1378,10 +1378,12 @@ int amdgpu_device_get_job_timeout_settings(struct amdgpu_device *adev)
 		}
 		/*
 		 * There is only one value specified and
-		 * it should apply to all non-compute jobs.
+		 * it should apply to all jobs.
 		 */
 		if (index == 1)
 			adev->sdma_timeout = adev->video_timeout = adev->gfx_timeout;
+			if (amdgpu_sriov_vf(adev) || amdgpu_passthrough(adev))
+				adev->compute_timeout = adev->gfx_timeout;
 	}
 
 	return ret;
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): 1568887741-1029-1-git-send-email-zhexi.zhang-5C7GfCeVMHo@public.gmane.org

#8 lore raw

Am 19.09.19 um 12:09 schrieb Jesse Zhang:

Quoted 32 lines

When compute fence did signal, compute ring cannot detect hardware hang because its timeout value is set to be infinite by default.

In SR-IOV and passthrough mode, if user does not declare custome timeout value for compute ring, then use gfx ring timeout value as default. So that when there is a ture hardware hang, compute ring can detect it.

Change-Id I794ec0868c6c0aad407749457260ecfee0617c10
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 12 ++++++------
  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c    |  4 +++-
  2 files changed, 9 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -6
index 3b5282b..03ac5a1da 100644
@@ -1024,12 +1024,6 @@ static int amdgpu_device_check_arguments(struct amdgpu_device *adev)
 
  	amdgpu_device_check_block_size(adev);
 
-	ret = amdgpu_device_get_job_timeout_settings(adev);
-	if (ret) {
-		dev_err(adev->dev, "invalid lockup_timeout parameter syntax\n");
-		return ret;
-	}
-
  	adev->firmware.load_type = amdgpu_ucode_get_load_type(adev, amdgpu_fw_load_type);
 
  	return ret;

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

Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +6 -0
@@ -2732,6 +2726,12 @@ int amdgpu_device_init(struct amdgpu_device *adev,
  	if (r)
  		return r;
 
+	r = amdgpu_device_get_job_timeout_settings(adev);
+	if (r) {
+		dev_err(adev->dev, "invalid lockup_timeout parameter syntax\n");
+		return r;
+	}
+

I assume that you move the code because previously SRIOV/passthrough setting is not available yet?

But even with this here you can still remove the extra SRIOV check in amdgpu_fence.c.

Regards,
Christian.

Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -0
  	/* doorbell bar mapping and doorbell index init*/
  	amdgpu_device_doorbell_init(adev);
 
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0 -0
index 420888e..1236245 100644
@@ -1378,10 +1378,12 @@ int amdgpu_device_get_job_timeout_settings(struct amdgpu_device *adev)
  		}
  		/*
  		 * There is only one value specified and

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c int amdgpu_device_get_job_timeout_settings(struct amdgpu_device *adev) · line 1389

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +3 -1
-		 * it should apply to all non-compute jobs.
+		 * it should apply to all jobs.
  		 */
  		if (index == 1)
  			adev->sdma_timeout = adev->video_timeout = adev->gfx_timeout;
+			if (amdgpu_sriov_vf(adev) || amdgpu_passthrough(adev))
+				adev->compute_timeout = adev->gfx_timeout;
  	}
 
  	return ret;

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

#9 lore raw

PATCH v6 1/1 drm/amd/amdgpu:Fix compute ring unable to detect hang.

In reply to a message not in the archive

When compute fence did signal, compute ring cannot detect hardware hang because its timeout value is set to be infinite by default.

In SR-IOV and passthrough mode, if user does not declare custome timeout value for compute ring, then use gfx ring timeout value as default. So that when there is a ture hardware hang, compute ring can detect it.

Change-Id I794ec0868c6c0aad407749457260ecfee0617c10
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 12 ++++++------
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c    |  4 +++-
 drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c  | 13 +------------
 3 files changed, 10 insertions(+), 19 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +6 -6
index 3b5282b..03ac5a1da 100644
@@ -1024,12 +1024,6 @@ static int amdgpu_device_check_arguments(struct amdgpu_device *adev)
 
 	amdgpu_device_check_block_size(adev);
 
-	ret = amdgpu_device_get_job_timeout_settings(adev);
-	if (ret) {
-		dev_err(adev->dev, "invalid lockup_timeout parameter syntax\n");
-		return ret;
-	}
-
 	adev->firmware.load_type = amdgpu_ucode_get_load_type(adev, amdgpu_fw_load_type);
 
 	return ret;
@@ -2732,6 +2726,12 @@ int amdgpu_device_init(struct amdgpu_device *adev,
 	if (r)
 		return r;
 
+	r = amdgpu_device_get_job_timeout_settings(adev);
+	if (r) {
+		dev_err(adev->dev, "invalid lockup_timeout parameter syntax\n");
+		return r;
+	}
+
 	/* doorbell bar mapping and doorbell index init*/
 	amdgpu_device_doorbell_init(adev);
 
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +3 -1
index 420888e..1236245 100644
@@ -1378,10 +1378,12 @@ int amdgpu_device_get_job_timeout_settings(struct amdgpu_device *adev)
 		}
 		/*
 		 * There is only one value specified and
-		 * it should apply to all non-compute jobs.
+		 * it should apply to all jobs.
 		 */
 		if (index == 1)
 			adev->sdma_timeout = adev->video_timeout = adev->gfx_timeout;
+			if (amdgpu_sriov_vf(adev) || amdgpu_passthrough(adev))
+				adev->compute_timeout = adev->gfx_timeout;
 	}
 
 	return ret;
drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c +1 -12
index cbcaa7c..9ef53ca 100644
@@ -460,18 +460,7 @@ int amdgpu_fence_driver_init_ring(struct amdgpu_ring *ring,
 			timeout = adev->gfx_timeout;
 			break;
 		case AMDGPU_RING_TYPE_COMPUTE:
-			/*
-			 * For non-sriov case, no timeout enforce
-			 * on compute ring by default. Unless user
-			 * specifies a timeout for compute ring.
-			 *
-			 * For sriov case, always use the timeout
-			 * as gfx ring
-			 */
-			if (!amdgpu_sriov_vf(ring->adev))
-				timeout = adev->compute_timeout;
-			else
-				timeout = adev->gfx_timeout;
+			timeout = adev->compute_timeout;
 			break;
 		case AMDGPU_RING_TYPE_SDMA:
 			timeout = adev->sdma_timeout;
Signature · 6 lines
2.7.4

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

PATCH v7 1/1 drm/amd/amdgpu:Fix compute ring unable to detect hang.

In reply to a message not in the archive

When compute fence did not signal, compute ring cannot detect hardware hang because its timeout value is set to be infinite by default.

In SR-IOV and passthrough mode, if user does not declare custome timeout value for compute ring, then use gfx ring timeout value as default. So that when there is a ture hardware hang, compute ring can detect it.

Change-Id I794ec0868c6c0aad407749457260ecfee0617c10
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 12 ++++++------
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c    |  4 +++-
 drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c  | 13 +------------
 3 files changed, 10 insertions(+), 19 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +6 -6
index 3b5282b..03ac5a1da 100644
@@ -1024,12 +1024,6 @@ static int amdgpu_device_check_arguments(struct amdgpu_device *adev)
 
 	amdgpu_device_check_block_size(adev);
 
-	ret = amdgpu_device_get_job_timeout_settings(adev);
-	if (ret) {
-		dev_err(adev->dev, "invalid lockup_timeout parameter syntax\n");
-		return ret;
-	}
-
 	adev->firmware.load_type = amdgpu_ucode_get_load_type(adev, amdgpu_fw_load_type);
 
 	return ret;
@@ -2732,6 +2726,12 @@ int amdgpu_device_init(struct amdgpu_device *adev,
 	if (r)
 		return r;
 
+	r = amdgpu_device_get_job_timeout_settings(adev);
+	if (r) {
+		dev_err(adev->dev, "invalid lockup_timeout parameter syntax\n");
+		return r;
+	}
+
 	/* doorbell bar mapping and doorbell index init*/
 	amdgpu_device_doorbell_init(adev);
 
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +3 -1
index 420888e..1236245 100644
@@ -1378,10 +1378,12 @@ int amdgpu_device_get_job_timeout_settings(struct amdgpu_device *adev)
 		}
 		/*
 		 * There is only one value specified and
-		 * it should apply to all non-compute jobs.
+		 * it should apply to all jobs.
 		 */
 		if (index == 1)
 			adev->sdma_timeout = adev->video_timeout = adev->gfx_timeout;
+			if (amdgpu_sriov_vf(adev) || amdgpu_passthrough(adev))
+				adev->compute_timeout = adev->gfx_timeout;
 	}
 
 	return ret;
drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c +1 -12
index cbcaa7c..9ef53ca 100644
@@ -460,18 +460,7 @@ int amdgpu_fence_driver_init_ring(struct amdgpu_ring *ring,
 			timeout = adev->gfx_timeout;
 			break;
 		case AMDGPU_RING_TYPE_COMPUTE:
-			/*
-			 * For non-sriov case, no timeout enforce
-			 * on compute ring by default. Unless user
-			 * specifies a timeout for compute ring.
-			 *
-			 * For sriov case, always use the timeout
-			 * as gfx ring
-			 */
-			if (!amdgpu_sriov_vf(ring->adev))
-				timeout = adev->compute_timeout;
-			else
-				timeout = adev->gfx_timeout;
+			timeout = adev->compute_timeout;
 			break;
 		case AMDGPU_RING_TYPE_SDMA:
 			timeout = adev->sdma_timeout;
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): 1568947109-5924-1-git-send-email-zhexi.zhang-5C7GfCeVMHo@public.gmane.org

#12 lore raw

PATCH v8 1/1 drm/amd/amdgpu:Fix compute ring unable to detect hang.

When compute fence did not signal, compute ring cannot detect hardware hang because its timeout value is set to be infinite by default.

In SR-IOV and passthrough mode, if user does not declare custome timeout value for compute ring, then use gfx ring timeout value as default. So that when there is a ture hardware hang, compute ring can detect it.

Change-Id I794ec0868c6c0aad407749457260ecfee0617c10
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 12 ++++++------
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c    |  7 ++++++-
 drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c  | 13 +------------
 3 files changed, 13 insertions(+), 19 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +6 -6
index 3b5282b..03ac5a1da 100644
@@ -1024,12 +1024,6 @@ static int amdgpu_device_check_arguments(struct amdgpu_device *adev)
 
 	amdgpu_device_check_block_size(adev);
 
-	ret = amdgpu_device_get_job_timeout_settings(adev);
-	if (ret) {
-		dev_err(adev->dev, "invalid lockup_timeout parameter syntax\n");
-		return ret;
-	}
-
 	adev->firmware.load_type = amdgpu_ucode_get_load_type(adev, amdgpu_fw_load_type);
 
 	return ret;
@@ -2732,6 +2726,12 @@ int amdgpu_device_init(struct amdgpu_device *adev,
 	if (r)
 		return r;
 
+	r = amdgpu_device_get_job_timeout_settings(adev);
+	if (r) {
+		dev_err(adev->dev, "invalid lockup_timeout parameter syntax\n");
+		return r;
+	}
+
 	/* doorbell bar mapping and doorbell index init*/
 	amdgpu_device_doorbell_init(adev);
 
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +6 -1
index 420888e..98be49b 100644
@@ -1338,10 +1338,15 @@ int amdgpu_device_get_job_timeout_settings(struct amdgpu_device *adev)
 	/*
 	 * By default timeout for non compute jobs is 10000.
 	 * And there is no timeout enforced on compute jobs.
+	 * In SR-IOV or passthrough mode, timeout for compute
+	 * jobs are 10000 by default.
 	 */
 	adev->gfx_timeout = msecs_to_jiffies(10000);
 	adev->sdma_timeout = adev->video_timeout = adev->gfx_timeout;
-	adev->compute_timeout = MAX_SCHEDULE_TIMEOUT;
+	if (amdgpu_sriov_vf(adev) || amdgpu_passthrough(adev))
+		adev->compute_timeout = adev->gfx_timeout;
+	else
+		adev->compute_timeout = MAX_SCHEDULE_TIMEOUT;
 
 	if (strnlen(input, AMDGPU_MAX_TIMEOUT_PARAM_LENTH)) {
 		while ((timeout_setting = strsep(&input, ",")) &&
drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c +1 -12
index cbcaa7c..9ef53ca 100644
@@ -460,18 +460,7 @@ int amdgpu_fence_driver_init_ring(struct amdgpu_ring *ring,
 			timeout = adev->gfx_timeout;
 			break;
 		case AMDGPU_RING_TYPE_COMPUTE:
-			/*
-			 * For non-sriov case, no timeout enforce
-			 * on compute ring by default. Unless user
-			 * specifies a timeout for compute ring.
-			 *
-			 * For sriov case, always use the timeout
-			 * as gfx ring
-			 */
-			if (!amdgpu_sriov_vf(ring->adev))
-				timeout = adev->compute_timeout;
-			else
-				timeout = adev->gfx_timeout;
+			timeout = adev->compute_timeout;
 			break;
 		case AMDGPU_RING_TYPE_SDMA:
 			timeout = adev->sdma_timeout;
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): 1568962637-26150-1-git-send-email-zhexi.zhang-5C7GfCeVMHo@public.gmane.org

Reviewed-by
#14 lore raw

Am 20.09.19 um 08:57 schrieb Jesse Zhang:

Quoted 9 lines

When compute fence did not signal, compute ring cannot detect hardware hang because its timeout value is set to be infinite by default.

In SR-IOV and passthrough mode, if user does not declare custome timeout value for compute ring, then use gfx ring timeout value as default. So that when there is a ture hardware hang, compute ring can detect it.

Change-Id I794ec0868c6c0aad407749457260ecfee0617c10
Quoted 71 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 12 ++++++------
  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c    |  7 ++++++-
  drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c  | 13 +------------
  3 files changed, 13 insertions(+), 19 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +6 -6
index 3b5282b..03ac5a1da 100644
@@ -1024,12 +1024,6 @@ static int amdgpu_device_check_arguments(struct amdgpu_device *adev)
 
  	amdgpu_device_check_block_size(adev);
 
-	ret = amdgpu_device_get_job_timeout_settings(adev);
-	if (ret) {
-		dev_err(adev->dev, "invalid lockup_timeout parameter syntax\n");
-		return ret;
-	}
-
  	adev->firmware.load_type = amdgpu_ucode_get_load_type(adev, amdgpu_fw_load_type);
 
  	return ret;
@@ -2732,6 +2726,12 @@ int amdgpu_device_init(struct amdgpu_device *adev,
  	if (r)
  		return r;
 
+	r = amdgpu_device_get_job_timeout_settings(adev);
+	if (r) {
+		dev_err(adev->dev, "invalid lockup_timeout parameter syntax\n");
+		return r;
+	}
+
  	/* doorbell bar mapping and doorbell index init*/
  	amdgpu_device_doorbell_init(adev);
 
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +6 -1
index 420888e..98be49b 100644
@@ -1338,10 +1338,15 @@ int amdgpu_device_get_job_timeout_settings(struct amdgpu_device *adev)
  	/*
  	 * By default timeout for non compute jobs is 10000.
  	 * And there is no timeout enforced on compute jobs.
+	 * In SR-IOV or passthrough mode, timeout for compute
+	 * jobs are 10000 by default.
  	 */
  	adev->gfx_timeout = msecs_to_jiffies(10000);
  	adev->sdma_timeout = adev->video_timeout = adev->gfx_timeout;
-	adev->compute_timeout = MAX_SCHEDULE_TIMEOUT;
+	if (amdgpu_sriov_vf(adev) || amdgpu_passthrough(adev))
+		adev->compute_timeout = adev->gfx_timeout;
+	else
+		adev->compute_timeout = MAX_SCHEDULE_TIMEOUT;
 
  	if (strnlen(input, AMDGPU_MAX_TIMEOUT_PARAM_LENTH)) {
  		while ((timeout_setting = strsep(&input, ",")) &&
drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c +0 -6
index cbcaa7c..9ef53ca 100644
@@ -460,18 +460,7 @@ int amdgpu_fence_driver_init_ring(struct amdgpu_ring *ring,
  			timeout = adev->gfx_timeout;
  			break;
  		case AMDGPU_RING_TYPE_COMPUTE:
-			/*
-			 * For non-sriov case, no timeout enforce
-			 * on compute ring by default. Unless user
-			 * specifies a timeout for compute ring.
-			 *
-			 * For sriov case, always use the timeout

drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c int amdgpu_fence_driver_init_ring(struct amdgpu_ring *ring, · line 466

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c +1 -6
-			 * as gfx ring
-			 */
-			if (!amdgpu_sriov_vf(ring->adev))
-				timeout = adev->compute_timeout;
-			else
-				timeout = adev->gfx_timeout;
+			timeout = adev->compute_timeout;
  			break;
  		case AMDGPU_RING_TYPE_SDMA:
  			timeout = adev->sdma_timeout;

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