[PATCH 41/44] drm/amdkfd: Remove broken deferred mapping
Felix Kuehling
Felix.Kuehling at amd.com
Mon Mar 22 10:58:57 UTC 2021
Mapping without validation is broken. Also removed saving the pages from
the last migration. They may be invalidated without an MMU notifier to
catch it, so let the next proper validation take care of it.
Signed-off-by: Felix Kuehling <Felix.Kuehling at amd.com>
---
drivers/gpu/drm/amd/amdkfd/kfd_migrate.c | 14 --------------
drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 13 ++-----------
2 files changed, 2 insertions(+), 25 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c b/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c
index 101d1f71db84..6748c5db64f5 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c
@@ -539,18 +539,6 @@ svm_migrate_copy_to_ram(struct amdgpu_device *adev, struct svm_range *prange,
src = (uint64_t *)(scratch + npages);
dst = scratch;
- /* FIXME: Is it legal to hold on to this page array? We don't have
- * proper references to the pages and we may not have an MMU notifier
- * set up for the range at this point that could invalidate it (if
- * it's a child range).
- */
- prange->pages_addr = kvmalloc_array(npages, sizeof(*prange->pages_addr),
- GFP_KERNEL | __GFP_ZERO);
- if (!prange->pages_addr) {
- r = -ENOMEM;
- goto out_oom;
- }
-
for (i = 0, j = 0; i < npages; i++, j++, addr += PAGE_SIZE) {
struct page *spage;
@@ -590,8 +578,6 @@ svm_migrate_copy_to_ram(struct amdgpu_device *adev, struct svm_range *prange,
pr_debug("dma mapping dst to 0x%llx, page_to_pfn 0x%lx\n",
dst[i] >> PAGE_SHIFT, page_to_pfn(dpage));
- prange->pages_addr[i] = page_to_pfn(dpage);
-
migrate->dst[i] = migrate_pfn(page_to_pfn(dpage));
migrate->dst[i] |= MIGRATE_PFN_LOCKED;
}
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
index 081d6bb75b09..aedb2c84131e 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
@@ -1695,7 +1695,6 @@ static void
svm_range_handle_list_op(struct svm_range_list *svms, struct svm_range *prange)
{
struct mm_struct *mm = prange->work_item.mm;
- int r;
switch (prange->work_item.op) {
case SVM_OP_NULL:
@@ -1718,11 +1717,7 @@ svm_range_handle_list_op(struct svm_range_list *svms, struct svm_range *prange)
pr_debug("update and map 0x%p prange 0x%p [0x%lx 0x%lx]\n",
svms, prange, prange->start, prange->last);
svm_range_update_notifier_and_interval_tree(mm, prange);
- /* FIXME: need to validate somewhere */
- r = svm_range_map_to_gpus(prange, true);
- if (r)
- pr_debug("failed %d map 0x%p [0x%lx 0x%lx]\n",
- r, svms, prange->start, prange->last);
+ /* TODO: implement deferred validation and mapping */
break;
case SVM_OP_ADD_RANGE:
pr_debug("add 0x%p prange 0x%p [0x%lx 0x%lx]\n", svms, prange,
@@ -1735,11 +1730,7 @@ svm_range_handle_list_op(struct svm_range_list *svms, struct svm_range *prange)
prange, prange->start, prange->last);
svm_range_add_to_svms(prange);
svm_range_add_notifier_locked(mm, prange);
- /* FIXME: need to validate somewhere */
- r = svm_range_map_to_gpus(prange, true);
- if (r)
- pr_debug("failed %d map 0x%p [0x%lx 0x%lx]\n",
- r, svms, prange->start, prange->last);
+ /* TODO: implement deferred validation and mapping */
break;
default:
WARN_ONCE(1, "Unknown prange 0x%p work op %d\n", prange,
--
2.31.0
More information about the amd-gfx
mailing list