[PATCH] drm/amdgpu: treat negative lockup timeout as 'infinite timeout'

Evan Quan evan.quan at amd.com
Sun May 5 14:23:53 UTC 2019


Negative lockup timeout is valid and will be treated as
'infinite timeout'.

Change-Id: I0d8387956a9c744073c0281ef2e1a547d4f16dec
Signed-off-by: Evan Quan <evan.quan at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index 5b03e17e6e06..4d6dff6855f8 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -233,13 +233,14 @@ module_param_named(msi, amdgpu_msi, int, 0444);
  * Set GPU scheduler timeout value in ms.
  *
  * The format can be [Non-Compute] or [GFX,Compute,SDMA,Video]. That is there can be one or
- * multiple values specified. 0 and negative values are invalidated. They will be adjusted
- * to default timeout.
+ * multiple values specified.
  *  - With one value specified, the setting will apply to all non-compute jobs.
  *  - With multiple values specified, the first one will be for GFX. The second one is for Compute.
  *    And the third and fourth ones are for SDMA and Video.
  * By default(with no lockup_timeout settings), the timeout for all non-compute(GFX, SDMA and Video)
  * jobs is 10000. And there is no timeout enforced on compute jobs.
+ * Value 0 is invalidated, will be adjusted to default timeout settings.
+ * Negative values mean 'infinite timeout' (MAX_JIFFY_OFFSET).
  */
 MODULE_PARM_DESC(lockup_timeout, "GPU lockup timeout in ms (default: 10000 for non-compute jobs and no timeout for compute jobs), "
 		"format is [Non-Compute] or [GFX,Compute,SDMA,Video]");
@@ -1248,11 +1249,16 @@ int amdgpu_device_get_job_timeout_settings(struct amdgpu_device *adev)
 			if (ret)
 				return ret;
 
-			/* Invalidate 0 and negative values */
-			if (timeout <= 0) {
+			/*
+			 * Value 0 will be adjusted to default timeout settings.
+			 * Negative values mean 'infinite timeout' (MAX_JIFFY_OFFSET).
+			 */
+			if (!timeout) {
 				index++;
 				continue;
 			}
+			if (timeout < 0)
+				timeout = MAX_JIFFY_OFFSET;
 
 			switch (index++) {
 			case 0:
-- 
2.21.0



More information about the amd-gfx mailing list