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

Christian König deathsimple at vodafone.de
Mon May 1 14:56:17 UTC 2017


Am 01.05.2017 um 08:34 schrieb Monk Liu:
> this is to prevent fence forever waiting if FLR occured
> during register accessing.
>
> Change-Id: I32cc219a08f5a67654beb26c45d1b95d2b60cc96
> Signed-off-by: Monk Liu <Monk.Liu at amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 12 +++++++-----
>   1 file changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
> index 1363239..6ab500b 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
> @@ -129,10 +129,12 @@ uint32_t amdgpu_virt_kiq_rreg(struct amdgpu_device *adev, uint32_t reg)
>   	amdgpu_ring_commit(ring);
>   	mutex_unlock(&adev->virt.lock_kiq);
>   
> -	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(10000));

We should probably add a define for that somewhere.

Apart from that the change looks good to me,
Christian.

>   	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];
>   
> @@ -155,8 +157,8 @@ void amdgpu_virt_kiq_wreg(struct amdgpu_device *adev, uint32_t reg, uint32_t v)
>   	amdgpu_ring_commit(ring);
>   	mutex_unlock(&adev->virt.lock_kiq);
>   
> -	r = fence_wait(f, false);
> -	if (r)
> +	r = fence_wait_timeout(f, false, msecs_to_jiffies(10000));
> +	if (r < 1)
>   		DRM_ERROR("wait for kiq fence error: %ld.\n", r);
>   	fence_put(f);
>   }




More information about the amd-gfx mailing list