[PATCH 3/4] drm/amdgpu: id reset count only is updated when used end

Christian König deathsimple at vodafone.de
Wed May 10 08:20:41 UTC 2017


Am 10.05.2017 um 09:31 schrieb Chunming Zhou:
> before that, we have function to check if reset happens by using reset count.
>
> Change-Id: I2e941dd35295d4210d57a9593d39b5ee9021be9f
> Signed-off-by: Chunming Zhou <David1.Zhou at amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> index 58cde30..bbb3587 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> @@ -450,7 +450,6 @@ static int amdgpu_vm_grab_reserved_vmid_locked(struct amdgpu_vm *vm,
>   		id->flushed_updates = fence_get(updates);
>   	}
>   	id->pd_gpu_addr = job->vm_pd_addr;
> -	id->current_gpu_reset_count = atomic_read(&adev->gpu_reset_counter);
>   	atomic64_set(&id->owner, vm->client_id);
>   	job->vm_needs_flush = needs_flush;
>   	if (needs_flush) {
> @@ -598,7 +597,6 @@ int amdgpu_vm_grab_id(struct amdgpu_vm *vm, struct amdgpu_ring *ring,
>   	id->pd_gpu_addr = job->vm_pd_addr;
>   	fence_put(id->flushed_updates);
>   	id->flushed_updates = fence_get(updates);
> -	id->current_gpu_reset_count = atomic_read(&adev->gpu_reset_counter);
>   	atomic64_set(&id->owner, vm->client_id);
>   
>   needs_flush:
> @@ -783,6 +781,8 @@ int amdgpu_vm_flush(struct amdgpu_ring *ring, struct amdgpu_job *job)
>   		mutex_lock(&id_mgr->lock);
>   		fence_put(id->last_flush);
>   		id->last_flush = fence;
> +		if (amdgpu_vm_had_gpu_reset(adev, id))
> +			id->current_gpu_reset_count = atomic_read(&adev->gpu_reset_counter);

Just drop the "if", checking the memory location first to avoid the 
write is rather pointless with an atomic.

With that fixed the patch is Reviewed-by: Christian König 
<christian.koenig at amd.com>.

Regards,
Christian.

>   		mutex_unlock(&id_mgr->lock);
>   	}
>   




More information about the amd-gfx mailing list