Skip to content

Commit 9e4a91c

Browse files
alexsierragalexdeucher
authored andcommitted
drm/amdkfd: inc counter on child ranges with xnack off
During GPU page table invalidation with xnack off, new ranges split may occur concurrently in the same prange. Creating a new child per split. Each child should also increment its invalid counter, to assure GPU page table updates in these ranges. Signed-off-by: Alex Sierra <alex.sierra@amd.com> Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent 1d40ef9 commit 9e4a91c

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

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

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1590,6 +1590,7 @@ svm_range_evict(struct svm_range *prange, struct mm_struct *mm,
15901590
unsigned long start, unsigned long last)
15911591
{
15921592
struct svm_range_list *svms = prange->svms;
1593+
struct svm_range *pchild;
15931594
struct kfd_process *p;
15941595
int r = 0;
15951596

@@ -1601,7 +1602,19 @@ svm_range_evict(struct svm_range *prange, struct mm_struct *mm,
16011602
if (!p->xnack_enabled) {
16021603
int evicted_ranges;
16031604

1604-
atomic_inc(&prange->invalid);
1605+
list_for_each_entry(pchild, &prange->child_list, child_list) {
1606+
mutex_lock_nested(&pchild->lock, 1);
1607+
if (pchild->start <= last && pchild->last >= start) {
1608+
pr_debug("increment pchild invalid [0x%lx 0x%lx]\n",
1609+
pchild->start, pchild->last);
1610+
atomic_inc(&pchild->invalid);
1611+
}
1612+
mutex_unlock(&pchild->lock);
1613+
}
1614+
1615+
if (prange->start <= last && prange->last >= start)
1616+
atomic_inc(&prange->invalid);
1617+
16051618
evicted_ranges = atomic_inc_return(&svms->evicted_ranges);
16061619
if (evicted_ranges != 1)
16071620
return r;
@@ -1618,7 +1631,6 @@ svm_range_evict(struct svm_range *prange, struct mm_struct *mm,
16181631
schedule_delayed_work(&svms->restore_work,
16191632
msecs_to_jiffies(AMDGPU_SVM_RANGE_RESTORE_DELAY_MS));
16201633
} else {
1621-
struct svm_range *pchild;
16221634
unsigned long s, l;
16231635

16241636
pr_debug("invalidate unmap svms 0x%p [0x%lx 0x%lx] from GPUs\n",

0 commit comments

Comments
 (0)