[PATCH] drm/amdgpu: fix losting fence signal

Christian König deathsimple at vodafone.de
Wed Jun 22 11:56:50 UTC 2016


Am 22.06.2016 um 08:58 schrieb Chunming Zhou:
> Change-Id: Ibfb7e8af796cc178dfb40d8aaabda472de3c5eda
> Signed-off-by: Chunming Zhou <David1.Zhou at amd.com>

NAK, this could lead to a situation where we try to signal a fence twice.

Why do you think that we would loose fences otherwise?

Regards,
Christian.

> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 7 ++++---
>   1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
> index 17bd5af..6a69336 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
> @@ -192,9 +192,10 @@ static void amdgpu_fence_schedule_fallback(struct amdgpu_ring *ring)
>   void amdgpu_fence_process(struct amdgpu_ring *ring)
>   {
>   	struct amdgpu_fence_driver *drv = &ring->fence_drv;
> -	uint32_t seq, last_seq;
> +	uint32_t seq, last_seq, old_seq;
>   	int r;
>   
> +	old_seq = atomic_read(&ring->fence_drv.last_seq);
>   	do {
>   		last_seq = atomic_read(&ring->fence_drv.last_seq);
>   		seq = amdgpu_fence_read(ring);
> @@ -204,10 +205,10 @@ void amdgpu_fence_process(struct amdgpu_ring *ring)
>   	if (seq != ring->fence_drv.sync_seq)
>   		amdgpu_fence_schedule_fallback(ring);
>   
> -	while (last_seq != seq) {
> +	while (old_seq != seq) {
>   		struct fence *fence, **ptr;
>   
> -		ptr = &drv->fences[++last_seq & drv->num_fences_mask];
> +		ptr = &drv->fences[++old_seq & drv->num_fences_mask];
>   
>   		/* There is always exactly one thread signaling this fence slot */
>   		fence = rcu_dereference_protected(*ptr, 1);



More information about the amd-gfx mailing list