drm/amdkfd: flag added to handle errors from svm validate and map
authorAlex Sierra <alex.sierra@amd.com>
Mon, 29 May 2023 21:01:37 +0000 (16:01 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 9 Jun 2023 16:32:25 +0000 (12:32 -0400)
If a return error is raised during validation and mapping of a
prange, this flag is set. It is a rare occurrence, but it could happen
when `amdgpu_hmm_range_get_pages_done` returns true. In such cases,
the caller should retry. However, it is important to ensure that the
prange is updated correctly during the retry.

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

index ee16130ddc75e536697e667cf0b223dac20393dc..9c88d6e90c3b5f2d8b3154faa7803c32819ea1cc 100644 (file)
@@ -809,7 +809,7 @@ svm_range_is_same_attrs(struct kfd_process *p, struct svm_range *prange,
                }
        }
 
-       return true;
+       return !prange->is_error_flag;
 }
 
 /**
@@ -1691,6 +1691,7 @@ unlock_out:
 unreserve_out:
        svm_range_unreserve_bos(ctx);
 
+       prange->is_error_flag = !!r;
        if (!r)
                prange->validate_timestamp = ktime_get_boottime();
 
index 762679835e31baf36e23e3c2ae8f9eff47db243a..21b14510882b89364a0b2dce47745b4242cb0338 100644 (file)
@@ -134,6 +134,7 @@ struct svm_range {
        DECLARE_BITMAP(bitmap_aip, MAX_GPU_INSTANCE);
        bool                            validated_once;
        bool                            mapped_to_gpu;
+       bool                            is_error_flag;
 };
 
 static inline void svm_range_lock(struct svm_range *prange)