[PATCH 5/6] drm/amdgpu:kiq reg access need timeout(v2)

Yu, Xiangliang Xiangliang.Yu at amd.com
Wed May 3 06:35:14 UTC 2017


Reviewed-by: Xiangliang Yu <Xiangliang.Yu at amd.com>


Thanks!
Xiangliang Yu


> -----Original Message-----
> From: amd-gfx [mailto:amd-gfx-bounces at lists.freedesktop.org] On Behalf
> Of Monk Liu
> Sent: Wednesday, May 03, 2017 11:48 AM
> To: amd-gfx at lists.freedesktop.org
> Cc: Liu, Monk <Monk.Liu at amd.com>
> Subject: [PATCH 5/6] drm/amdgpu:kiq reg access need timeout(v2)
> 
> this is to prevent fence forever waiting if FLR occured during register
> accessing.
> 
> v2:
> use define instead of hardcode for the timeout msec
> 
> Change-Id: I32cc219a08f5a67654beb26c45d1b95d2b60cc96
> Signed-off-by: Monk Liu <Monk.Liu at amd.com>
> Reviewed-by: Christian König <christian.koenig at amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 13 ++++++++-----
>  1 file changed, 8 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
> index 966bf7f..757cbc4 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
> @@ -22,6 +22,7 @@
>   */
> 
>  #include "amdgpu.h"
> +#define MAX_KIQ_REG_WAIT	100000
> 
>  int amdgpu_allocate_static_csa(struct amdgpu_device *adev)  { @@ -128,10
> +129,12 @@ uint32_t amdgpu_virt_kiq_rreg(struct amdgpu_device *adev,
> uint32_t reg)
>  	amdgpu_ring_commit(ring);
>  	mutex_unlock(&kiq->ring_mutex);
> 
> -	r = fence_wait(f, false);
> -	if (r)
> -		DRM_ERROR("wait for kiq fence error: %ld.\n", r);
> +	r = fence_wait_timeout(f, false,
> msecs_to_jiffies(MAX_KIQ_REG_WAIT));
>  	fence_put(f);
> +	if (r < 1) {
> +		DRM_ERROR("wait for kiq fence error: %ld.\n", r);
> +		return ~0;
> +	}
> 
>  	val = adev->wb.wb[adev->virt.reg_val_offs];
> 
> @@ -154,8 +157,8 @@ void amdgpu_virt_kiq_wreg(struct amdgpu_device
> *adev, uint32_t reg, uint32_t v)
>  	amdgpu_ring_commit(ring);
>  	mutex_unlock(&kiq->ring_mutex);
> 
> -	r = fence_wait(f, false);
> -	if (r)
> +	r = fence_wait_timeout(f, false,
> msecs_to_jiffies(MAX_KIQ_REG_WAIT));
> +	if (r < 1)
>  		DRM_ERROR("wait for kiq fence error: %ld.\n", r);
>  	fence_put(f);
>  }
> --
> 2.7.4
> 
> _______________________________________________
> amd-gfx mailing list
> amd-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


More information about the amd-gfx mailing list