[PATCH] drm/amdgpu: Fix SDMA TO after GPU reset v2

Christian König ckoenig.leichtzumerken at gmail.com
Tue Sep 11 14:51:50 UTC 2018


Am 11.09.2018 um 16:43 schrieb Andrey Grodzovsky:
> After GPU reset amdgpu_vm_clear_bo triggers VM flush
> but job->vm_pd_addr is not set causing SDMA TO.
>
> v2:
> Per advise by Christian König avoid flushing VM for jobs where
> job->vm_pd_addr wasn't explicitly set.
>
> Fixes cbd5285 drm/amdgpu: move setting the GART addr into TTM.
> Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky at amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 1 +
>   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c  | 2 +-
>   2 files changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
> index 34e54d4..755f733 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
> @@ -73,6 +73,7 @@ int amdgpu_job_alloc(struct amdgpu_device *adev, unsigned num_ibs,
>   	amdgpu_sync_create(&(*job)->sync);
>   	amdgpu_sync_create(&(*job)->sched_sync);
>   	(*job)->vram_lost_counter = atomic_read(&adev->vram_lost_counter);
> +	(*job)->vm_pd_addr = AMDGPU_BO_INVALID_OFFSET;
>   
>   	return 0;
>   }
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> index f5a9600..30beb52 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> @@ -865,7 +865,7 @@ int amdgpu_vm_flush(struct amdgpu_ring *ring, struct amdgpu_job *job, bool need_
>   	if (need_pipe_sync)
>   		amdgpu_ring_emit_pipeline_sync(ring);
>   
> -	if (vm_flush_needed) {
> +	if (vm_flush_needed && job->vm_pd_addr != AMDGPU_BO_INVALID_OFFSET) {

IIRC we had a shortcut a bit above where vm_flush_needed is assigned.

You could do something like "vm_flush_needed &= job->vm_pd_addr != 
AMDGPU_BO_INVALID_OFFSET" and same the whole prefixing stuff here as well.

Apart from looks good to me and BTW that is quite a good catch.

Thanks,
Christian.

>   		trace_amdgpu_vm_flush(ring, job->vmid, job->vm_pd_addr);
>   		amdgpu_ring_emit_vm_flush(ring, job->vmid, job->vm_pd_addr);
>   	}



More information about the amd-gfx mailing list