Skip to contentSkip to conversation

drm/amdgpu: treat negative lockup timeout as 'infinite timeout'

PATCH In review Evan Quan 2 participants 3 messages May 5, 2019 – May 7, 2019 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

Evan Quan

author
#0 lore raw

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

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

Change-Id I0d8387956a9c744073c0281ef2e1a547d4f16dec
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +10 -4
index 5b03e17e6e06..4d6dff6855f8 100644
@@ -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:
Signature · 6 lines
2.21.0

_______________________________________________
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): [email protected]

#2 lore raw

Am 05.05.19 um 16:23 schrieb Evan Quan:

Quoted 36 lines

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

Change-Id I0d8387956a9c744073c0281ef2e1a547d4f16dec
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 14 ++++++++++----
  1 file changed, 10 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +3 -4
index 5b03e17e6e06..4d6dff6855f8 100644
@@ -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) {

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

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +7 -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;

This is superfluous and maybe even harmful, msecs_to_jiffies() should take care of this conversion.

Maybe even convert the values directly here.

Christian.

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

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0 -0
  			switch (index++) {
  			case 0:

_______________________________________________
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): 03378dca-c0bb-443e-818a-3a01b69dcccb-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

author
#4 lore raw

Thanks! Just sent out a V2 version with this addressed.

Quoted 68 lines

-----Original Message-----
From: Christian König <[email protected]>
Sent: 2019年5月6日 19:26
To: Quan, Evan <[email protected]>; [email protected]
Cc: Koenig, Christian <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: treat negative lockup timeout as 'infinite timeout'

[CAUTION: External Email]

Am 05.05.19 um 16:23 schrieb Evan Quan:

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c module_param_named(msi, amdgpu_msi, int,

Quoted 15 lines

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

Change-Id I0d8387956a9c744073c0281ef2e1a547d4f16dec
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 14 ++++++++++----
  1 file changed, 10 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0 -0
index 5b03e17e6e06..4d6dff6855f8 100644
@@ -233,13 +233,14 @@ module_param_named(msi, amdgpu_msi, int,

0444);

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c module_param_named(msi, amdgpu_msi, int, 0444);

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0 -0
   * Set GPU scheduler timeout value in ms.
   *
   * The format can be [Non-Compute] or [GFX,Compute,SDMA,Video].

That

Quoted 6 lines

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.

Quoted 1 line

* - With multiple values specified, the first one will be for GFX. The

second one is for Compute.

Quoted 2 lines

* 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)

Quoted 5 lines

* 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), "

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c int

Quoted 2 lines
              "format is [Non-Compute] or [GFX,Compute,SDMA,Video]");
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0 -0
@@ -1248,11 +1249,16 @@ int

amdgpu_device_get_job_timeout_settings(struct amdgpu_device *adev)

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0 -2
                      if (ret)
                              return ret;
 
-                     /* Invalidate 0 and negative values */
-                     if (timeout <= 0) {

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

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +7 -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;
Quoted 10 lines

This is superfluous and maybe even harmful, msecs_to_jiffies() should take care of this conversion.

Maybe even convert the values directly here.

Christian.

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0 -0
                      switch (index++) {
                      case 0:

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