Skip to content

Commit 3abfe30

Browse files
PhilipYangAalexdeucher
authored andcommitted
drm/amdkfd: process_info lock not needed for svm
process_info->lock is used to protect kfd_bo_list, vm_list_head, n_vms and userptr valid/inval list, svm_range_restore_work and svm_range_set_attr don't access those, so do not need to take process_info lock. This will avoid potential circular locking issue. Signed-off-by: Philip Yang <[email protected]> Reviewed-by: Felix Kuehling <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 428890a commit 3abfe30

File tree

1 file changed

+0
-9
lines changed

1 file changed

+0
-9
lines changed

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

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1574,7 +1574,6 @@ svm_range_list_lock_and_flush_work(struct svm_range_list *svms,
15741574
static void svm_range_restore_work(struct work_struct *work)
15751575
{
15761576
struct delayed_work *dwork = to_delayed_work(work);
1577-
struct amdkfd_process_info *process_info;
15781577
struct svm_range_list *svms;
15791578
struct svm_range *prange;
15801579
struct kfd_process *p;
@@ -1594,12 +1593,10 @@ static void svm_range_restore_work(struct work_struct *work)
15941593
* the lifetime of this thread, kfd_process and mm will be valid.
15951594
*/
15961595
p = container_of(svms, struct kfd_process, svms);
1597-
process_info = p->kgd_process_info;
15981596
mm = p->mm;
15991597
if (!mm)
16001598
return;
16011599

1602-
mutex_lock(&process_info->lock);
16031600
svm_range_list_lock_and_flush_work(svms, mm);
16041601
mutex_lock(&svms->lock);
16051602

@@ -1652,7 +1649,6 @@ static void svm_range_restore_work(struct work_struct *work)
16521649
out_reschedule:
16531650
mutex_unlock(&svms->lock);
16541651
mmap_write_unlock(mm);
1655-
mutex_unlock(&process_info->lock);
16561652

16571653
/* If validation failed, reschedule another attempt */
16581654
if (evicted_ranges) {
@@ -3181,7 +3177,6 @@ static int
31813177
svm_range_set_attr(struct kfd_process *p, uint64_t start, uint64_t size,
31823178
uint32_t nattr, struct kfd_ioctl_svm_attribute *attrs)
31833179
{
3184-
struct amdkfd_process_info *process_info = p->kgd_process_info;
31853180
struct mm_struct *mm = current->mm;
31863181
struct list_head update_list;
31873182
struct list_head insert_list;
@@ -3200,8 +3195,6 @@ svm_range_set_attr(struct kfd_process *p, uint64_t start, uint64_t size,
32003195

32013196
svms = &p->svms;
32023197

3203-
mutex_lock(&process_info->lock);
3204-
32053198
svm_range_list_lock_and_flush_work(svms, mm);
32063199

32073200
r = svm_range_is_valid(p, start, size);
@@ -3277,8 +3270,6 @@ svm_range_set_attr(struct kfd_process *p, uint64_t start, uint64_t size,
32773270
mutex_unlock(&svms->lock);
32783271
mmap_read_unlock(mm);
32793272
out:
3280-
mutex_unlock(&process_info->lock);
3281-
32823273
pr_debug("pasid 0x%x svms 0x%p [0x%llx 0x%llx] done, r=%d\n", p->pasid,
32833274
&p->svms, start, start + size - 1, r);
32843275

0 commit comments

Comments
 (0)