[PATCH] drm/amdgpu: Simplify amdgpu_lockup_timeout usage.

Christian König ckoenig.leichtzumerken at gmail.com
Thu Dec 14 08:43:17 UTC 2017


Am 13.12.2017 um 20:44 schrieb Andrey Grodzovsky:
> With introduction of amdgpu_gpu_recovery we don't need any more
> to rely on amdgpu_lockup_timeout == 0 for disabling GPU reset.
>
> Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky at amd.com>

Reviewed-by: Christian König <christian.koenig at amd.com>

> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_device.c |  7 ++++++-
>   drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c    |  4 ++--
>   drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c  | 14 +-------------
>   drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c      |  2 +-
>   drivers/gpu/drm/amd/amdgpu/mxgpu_vi.c      |  2 +-
>   5 files changed, 11 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index a074502..98fb9f9d 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -1229,6 +1229,11 @@ static void amdgpu_check_arguments(struct amdgpu_device *adev)
>   			 amdgpu_vram_page_split);
>   		amdgpu_vram_page_split = 1024;
>   	}
> +
> +	if (amdgpu_lockup_timeout == 0) {
> +		dev_warn(adev->dev, "lockup_timeout msut be > 0, adjusting to 10000\n");
> +		amdgpu_lockup_timeout = 10000;
> +	}
>   }
>   
>   /**
> @@ -2831,7 +2836,7 @@ bool amdgpu_need_backup(struct amdgpu_device *adev)
>   	if (adev->flags & AMD_IS_APU)
>   		return false;
>   
> -	return amdgpu_lockup_timeout > 0 ? true : false;
> +	return amdgpu_gpu_recovery;
>   }
>   
>   static int amdgpu_recover_vram_from_shadow(struct amdgpu_device *adev,
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> index b734cd6..1fc5499 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> @@ -90,7 +90,7 @@ int amdgpu_disp_priority = 0;
>   int amdgpu_hw_i2c = 0;
>   int amdgpu_pcie_gen2 = -1;
>   int amdgpu_msi = -1;
> -int amdgpu_lockup_timeout = 0;
> +int amdgpu_lockup_timeout = 10000;
>   int amdgpu_dpm = -1;
>   int amdgpu_fw_load_type = -1;
>   int amdgpu_aspm = -1;
> @@ -166,7 +166,7 @@ module_param_named(pcie_gen2, amdgpu_pcie_gen2, int, 0444);
>   MODULE_PARM_DESC(msi, "MSI support (1 = enable, 0 = disable, -1 = auto)");
>   module_param_named(msi, amdgpu_msi, int, 0444);
>   
> -MODULE_PARM_DESC(lockup_timeout, "GPU lockup timeout in ms (default 0 = disable)");
> +MODULE_PARM_DESC(lockup_timeout, "GPU lockup timeout in ms > 0 (default 10000)");
>   module_param_named(lockup_timeout, amdgpu_lockup_timeout, int, 0444);
>   
>   MODULE_PARM_DESC(dpm, "DPM support (1 = enable, 0 = disable, -1 = auto)");
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
> index 854baf0..9484aed 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
> @@ -410,7 +410,6 @@ int amdgpu_fence_driver_start_ring(struct amdgpu_ring *ring,
>   int amdgpu_fence_driver_init_ring(struct amdgpu_ring *ring,
>   				  unsigned num_hw_submission)
>   {
> -	long timeout;
>   	int r;
>   
>   	/* Check that num_hw_submission is a power of two */
> @@ -434,20 +433,9 @@ int amdgpu_fence_driver_init_ring(struct amdgpu_ring *ring,
>   
>   	/* No need to setup the GPU scheduler for KIQ ring */
>   	if (ring->funcs->type != AMDGPU_RING_TYPE_KIQ) {
> -		timeout = msecs_to_jiffies(amdgpu_lockup_timeout);
> -		if (timeout == 0) {
> -			/*
> -			 * FIXME:
> -			 * Delayed workqueue cannot use it directly,
> -			 * so the scheduler will not use delayed workqueue if
> -			 * MAX_SCHEDULE_TIMEOUT is set.
> -			 * Currently keep it simple and silly.
> -			 */
> -			timeout = MAX_SCHEDULE_TIMEOUT;
> -		}
>   		r = drm_sched_init(&ring->sched, &amdgpu_sched_ops,
>   				   num_hw_submission, amdgpu_job_hang_limit,
> -				   timeout, ring->name);
> +				   msecs_to_jiffies(amdgpu_lockup_timeout), ring->name);
>   		if (r) {
>   			DRM_ERROR("Failed to create scheduler on ring %s.\n",
>   				  ring->name);
> diff --git a/drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c b/drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c
> index 7ade56d..43e74ec 100644
> --- a/drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c
> +++ b/drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c
> @@ -277,7 +277,7 @@ static int xgpu_ai_mailbox_rcv_irq(struct amdgpu_device *adev,
>   	int r;
>   
>   	/* trigger gpu-reset by hypervisor only if TDR disbaled */
> -	if (amdgpu_lockup_timeout == 0) {
> +	if (!amdgpu_gpu_recovery) {
>   		/* see what event we get */
>   		r = xgpu_ai_mailbox_rcv_msg(adev, IDH_FLR_NOTIFICATION);
>   
> diff --git a/drivers/gpu/drm/amd/amdgpu/mxgpu_vi.c b/drivers/gpu/drm/amd/amdgpu/mxgpu_vi.c
> index e05823d..da7c261 100644
> --- a/drivers/gpu/drm/amd/amdgpu/mxgpu_vi.c
> +++ b/drivers/gpu/drm/amd/amdgpu/mxgpu_vi.c
> @@ -545,7 +545,7 @@ static int xgpu_vi_mailbox_rcv_irq(struct amdgpu_device *adev,
>   	int r;
>   
>   	/* trigger gpu-reset by hypervisor only if TDR disbaled */
> -	if (amdgpu_lockup_timeout == 0) {
> +	if (!amdgpu_gpu_recovery) {
>   		/* see what event we get */
>   		r = xgpu_vi_mailbox_rcv_msg(adev, IDH_FLR_NOTIFICATION);
>   



More information about the amd-gfx mailing list