Skip to content

Commit

Permalink
drm/radeon: add error handling to radeon_vm_unbind_locked
Browse files Browse the repository at this point in the history
Waiting for a fence can fail for different reasons,
the most common is a deadlock.

Signed-off-by: Christian König <deathsimple@vodafone.de>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Jerome Glisse <jglisse@redhat.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
  • Loading branch information
Christian König committed Jul 17, 2012
1 parent 7ecc45e commit 35e56bd
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions drivers/gpu/drm/radeon/radeon_gart.c
Original file line number Diff line number Diff line change
Expand Up @@ -316,10 +316,21 @@ static void radeon_vm_unbind_locked(struct radeon_device *rdev,
}

/* wait for vm use to end */
if (vm->fence) {
radeon_fence_wait(vm->fence, false);
radeon_fence_unref(&vm->fence);
while (vm->fence) {
int r;
r = radeon_fence_wait(vm->fence, false);
if (r)
DRM_ERROR("error while waiting for fence: %d\n", r);
if (r == -EDEADLK) {
mutex_unlock(&rdev->vm_manager.lock);
r = radeon_gpu_reset(rdev);
mutex_lock(&rdev->vm_manager.lock);
if (!r)
continue;
}
break;
}
radeon_fence_unref(&vm->fence);

/* hw unbind */
rdev->vm_manager.funcs->unbind(rdev, vm);
Expand Down

0 comments on commit 35e56bd

Please sign in to comment.