drm/amdkfd: retry after EBUSY is returned from hmm_ranges_get_pages
authorAlex Sierra <alex.sierra@amd.com>
Tue, 15 Aug 2023 20:42:52 +0000 (15:42 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 31 Aug 2023 21:54:41 +0000 (17:54 -0400)
if hmm_range_get_pages returns EBUSY error during
svm_range_validate_and_map, within the context of a page fault
interrupt. This should retry through svm_range_restore_pages
callback. Therefore we treat this as EAGAIN error instead, and defer
it to restore pages fallback.

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>
drivers/gpu/drm/amd/amdkfd/kfd_svm.c

index dbbe6559d6bc4f558014114a9f8783278743c1e5..49b62c2172ccf4f38b358fa7adf6f510f50eeebc 100644 (file)
@@ -1686,6 +1686,8 @@ static int svm_range_validate_and_map(struct mm_struct *mm,
                WRITE_ONCE(p->svms.faulting_task, NULL);
                if (r) {
                        pr_debug("failed %d to get svm range pages\n", r);
+                       if (r == -EBUSY)
+                               r = -EAGAIN;
                        goto unreserve_out;
                }