Commit 7a0a48dd authored by Christian König's avatar Christian König Committed by Alex Deucher

drm/amdgpu: set -ECANCELED when dropping jobs

And return from the wait functions the fence error code.
Signed-off-by: default avatarChristian König <christian.koenig@amd.com>
Reviewed-by: default avatarNicolai Hähnle <nicolai.haehnle@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent e55f2b64
...@@ -1298,6 +1298,8 @@ int amdgpu_cs_wait_ioctl(struct drm_device *dev, void *data, ...@@ -1298,6 +1298,8 @@ int amdgpu_cs_wait_ioctl(struct drm_device *dev, void *data,
r = PTR_ERR(fence); r = PTR_ERR(fence);
else if (fence) { else if (fence) {
r = dma_fence_wait_timeout(fence, true, timeout); r = dma_fence_wait_timeout(fence, true, timeout);
if (r > 0 && fence->error)
r = fence->error;
dma_fence_put(fence); dma_fence_put(fence);
} else } else
r = 1; r = 1;
...@@ -1435,6 +1437,9 @@ static int amdgpu_cs_wait_all_fences(struct amdgpu_device *adev, ...@@ -1435,6 +1437,9 @@ static int amdgpu_cs_wait_all_fences(struct amdgpu_device *adev,
if (r == 0) if (r == 0)
break; break;
if (fence->error)
return fence->error;
} }
memset(wait, 0, sizeof(*wait)); memset(wait, 0, sizeof(*wait));
...@@ -1495,7 +1500,7 @@ static int amdgpu_cs_wait_any_fence(struct amdgpu_device *adev, ...@@ -1495,7 +1500,7 @@ static int amdgpu_cs_wait_any_fence(struct amdgpu_device *adev,
wait->out.status = (r > 0); wait->out.status = (r > 0);
wait->out.first_signaled = first; wait->out.first_signaled = first;
/* set return value 0 to indicate success */ /* set return value 0 to indicate success */
r = 0; r = array[first]->error;
err_free_fence_array: err_free_fence_array:
for (i = 0; i < fence_count; i++) for (i = 0; i < fence_count; i++)
......
...@@ -197,6 +197,7 @@ static struct dma_fence *amdgpu_job_run(struct amd_sched_job *sched_job) ...@@ -197,6 +197,7 @@ static struct dma_fence *amdgpu_job_run(struct amd_sched_job *sched_job)
trace_amdgpu_sched_run_job(job); trace_amdgpu_sched_run_job(job);
/* skip ib schedule when vram is lost */ /* skip ib schedule when vram is lost */
if (job->vram_lost_counter != atomic_read(&adev->vram_lost_counter)) { if (job->vram_lost_counter != atomic_read(&adev->vram_lost_counter)) {
dma_fence_set_error(&job->base.s_fence->finished, -ECANCELED);
DRM_ERROR("Skip scheduling IBs!\n"); DRM_ERROR("Skip scheduling IBs!\n");
} else { } else {
r = amdgpu_ib_schedule(job->ring, job->num_ibs, job->ibs, job, r = amdgpu_ib_schedule(job->ring, job->num_ibs, job->ibs, job,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment