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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am 07.05.19 um 03:47 schrieb Evan Quan:
Negative lockup timeout is valid and will be treated as
'infinite timeout'.

- V2: use msecs_to_jiffies for negative values

Change-Id: I0d8387956a9c744073c0281ef2e1a547d4f16dec
Signed-off-by: Evan Quan <evan.quan@xxxxxxx>
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 20 ++++++++++++--------
  1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index c5fba79c3660..bcd59ba07bb0 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -237,13 +237,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]");
@@ -1339,24 +1340,27 @@ 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;
  			}
switch (index++) {
  			case 0:
-				adev->gfx_timeout = timeout;
+				adev->gfx_timeout = msecs_to_jiffies(timeout);
  				break;
  			case 1:
-				adev->compute_timeout = timeout;
+				adev->compute_timeout = msecs_to_jiffies(timeout);
  				break;
  			case 2:
-				adev->sdma_timeout = timeout;
+				adev->sdma_timeout = msecs_to_jiffies(timeout);
  				break;
  			case 3:
-				adev->video_timeout = timeout;
+				adev->video_timeout = msecs_to_jiffies(timeout);

Maybe move the msecs_to_jiffies() call before the switch to add it only once.

Apart from that looks good to me,
Christian.

  				break;
  			default:
  				break;

_______________________________________________
amd-gfx mailing list
amd-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/amd-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux