Skip to content

Commit e7c9bc7

Browse files
PhilipYangASasha Levin
authored andcommitted
drm/amdkfd: Fix mmap write lock not release
[ Upstream commit 7574f30 ] 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 <Philip.Yang@amd.com> Reviewed-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent e0dff83 commit e7c9bc7

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

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

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

0 commit comments

Comments
 (0)