From: Yu Huang <[email protected]>

amdgpu_vm_pt_leaves() treats @end as exclusive - it loops on
"cursor.pfn < end" and clamps with "entry_end = min(entry_end, end)" -
but both callers passed an inclusive last address.

In amdgpu_vm_unmap_range() that silently left the last page of every
range untouched.

In amdgpu_vm_handle_fault() it is worse: the call passes the same value
as start and end, so "addr < addr" is false and the loop body never runs
at all. That is the path which installs AMDGPU_VM_NORETRY_FLAGS to turn
an unservicable retry fault into a no-retry fault, so nothing was
written and the faulting wave kept retrying the same address forever.

Pass last + 1 and addr + 1 so both calls describe the half-open range the
helper expects.

Signed-off-by: Yu Huang <[email protected]>
Change-Id: I0b89042774e1e3352829e8bf3b9d9953954bc870
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index 9ea1a07577c2..4e9dd0485db0 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -1312,7 +1312,7 @@ int amdgpu_vm_unmap_range(struct amdgpu_device *adev, 
struct amdgpu_vm *vm,
        if (r)
                goto error_free;
 
-       amdgpu_vm_pt_leaves(&params, start, last, NULL, flags);
+       amdgpu_vm_pt_leaves(&params, start, last + 1, NULL, flags);
 
        r = vm->update_funcs->commit(&params, fence);
        if (r)
@@ -3171,7 +3171,7 @@ bool amdgpu_vm_handle_fault(struct amdgpu_device *adev, 
u32 pasid,
        if (r)
                goto error_end_critical;
 
-       amdgpu_vm_pt_leaves(&params, addr, addr, values, flags);
+       amdgpu_vm_pt_leaves(&params, addr, addr + 1, values, flags);
        r = vm->update_funcs->commit(&params, &vm->last_update);
 
 error_end_critical:
-- 
2.53.0

Reply via email to