AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu: treat negative lockup timeout as 'infinite timeout' V2
@ 2019-05-07  1:47 Evan Quan
       [not found] ` <20190507014715.16505-1-evan.quan-5C7GfCeVMHo@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Evan Quan @ 2019-05-07  1:47 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
  Cc: Evan Quan, Christian.Koenig-5C7GfCeVMHo

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@amd.com>
---
 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);
 				break;
 			default:
 				break;
-- 
2.21.0

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] drm/amdgpu: treat negative lockup timeout as 'infinite timeout' V2
       [not found] ` <20190507014715.16505-1-evan.quan-5C7GfCeVMHo@public.gmane.org>
@ 2019-05-07  7:42   ` Christian König
  0 siblings, 0 replies; 2+ messages in thread
From: Christian König @ 2019-05-07  7:42 UTC (permalink / raw)
  To: Evan Quan, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
  Cc: Christian.Koenig-5C7GfCeVMHo

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@amd.com>
> ---
>   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@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-05-07  7:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-07  1:47 [PATCH] drm/amdgpu: treat negative lockup timeout as 'infinite timeout' V2 Evan Quan
     [not found] ` <20190507014715.16505-1-evan.quan-5C7GfCeVMHo@public.gmane.org>
2019-05-07  7:42   ` Christian König

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox