Skip to content

Commit 7574f30

Browse files
amd-yangpalexdeucher
authored andcommitted
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: Philip Yang <[email protected]> Reviewed-by: Harish Kasiviswanathan <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 58e6fc2 commit 7574f30

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

drivers/gpu/drm/amd/amdkfd/kfd_svm.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3045,6 +3045,8 @@ svm_range_restore_pages(struct amdgpu_device *adev, unsigned int pasid,
30453045
if (svms->checkpoint_ts[gpuidx] != 0) {
30463046
if (amdgpu_ih_ts_after_or_equal(ts, svms->checkpoint_ts[gpuidx])) {
30473047
pr_debug("draining retry fault, drop fault 0x%llx\n", addr);
3048+
if (write_locked)
3049+
mmap_write_downgrade(mm);
30483050
r = -EAGAIN;
30493051
goto out_unlock_svms;
30503052
} else {

0 commit comments

Comments
 (0)