Commit 7574f303 authored by Philip Yang's avatar Philip Yang Committed by Alex Deucher
Browse files

drm/amdkfd: Fix mmap write lock not release



If mmap write lock is taken while draining retry fault, mmap write lock
is not released because svm_range_restore_pages calls mmap_read_unlock
then returns. This causes deadlock and system hangs later because mmap
read or write lock cannot be taken.

Downgrade mmap write lock to read lock if draining retry fault fix this
bug.

Signed-off-by: default avatarPhilip Yang <Philip.Yang@amd.com>
Reviewed-by: default avatarHarish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 58e6fc2f
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -3045,6 +3045,8 @@ svm_range_restore_pages(struct amdgpu_device *adev, unsigned int pasid,
	if (svms->checkpoint_ts[gpuidx] != 0) {
		if (amdgpu_ih_ts_after_or_equal(ts,  svms->checkpoint_ts[gpuidx])) {
			pr_debug("draining retry fault, drop fault 0x%llx\n", addr);
			if (write_locked)
				mmap_write_downgrade(mm);
			r = -EAGAIN;
			goto out_unlock_svms;
		} else {