On 10/2/2025 12:43 PM, Philip Yang wrote:
svm_range_unmap_from_gpus uses page aligned start, end address, the end
address is inclusive.
Fixes: 38c55f6719f7 ("drm/amdkfd: Handle lack of READ permissions in SVM
mapping")
Signed-off-by: Philip Yang <[email protected]>
---
drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
index e8a15751c125..742c28833650 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
@@ -1723,8 +1723,8 @@ static int svm_range_validate_and_map(struct mm_struct
*mm,
svm_range_lock(prange);
if (vma->vm_flags & VM_WRITE)
pr_debug("VM_WRITE without VM_READ is not
supported");
- s = max(start, prange->start);
- e = min(end, prange->last);
+ s = max(start >> PAGE_SHIFT, prange->start);
+ e = min((end - 1) >> PAGE_SHIFT, prange->last);
I think the problem is more than that. Here "end" is the last place for
prange gpu mapping and the handling here is for a vma. Should use end of
the vma range to get "e".
Regards
Xiaogang
if (e >= s)
r = svm_range_unmap_from_gpus(prange,
s, e,
KFD_SVM_UNMAP_TRIGGER_UNMAP_FROM_CPU);