Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 35e56bd0 authored by Christian König's avatar Christian König
Browse files

drm/radeon: add error handling to radeon_vm_unbind_locked



Waiting for a fence can fail for different reasons,
the most common is a deadlock.

Signed-off-by: default avatarChristian König <deathsimple@vodafone.de>
Reviewed-by: default avatarMichel Dänzer <michel.daenzer@amd.com>
Reviewed-by: default avatarJerome Glisse <jglisse@redhat.com>
Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 7ecc45e3
Loading
Loading
Loading
Loading
+14 −3
Original line number Diff line number Diff line
@@ -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);