On 11/19/26 15:40, Benjamin Cheng wrote:
> Normally last_unlocked lives on the same entity (vm->delayed) as the
> SDMA commit so they would use the same slot, but in this case handle_fault
> calls update_range in immediate mode, making the SDMA commit live in the
> immediate entity.
>
> Since the two fences are not in the same entity, we need to reserve two
> fence slots here.
>
> Fixes: 2b665c3735b3 ("drm/amdgpu: reserve fence slot to update page table")
> Signed-off-by: Benjamin Cheng <[email protected]>
> ---
> v3:
> (Christian)
> - No TLB fence or TTM_NUM_MOVE_FENCES need to be added here.
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> index 4d31c41fb684..b1d2779a2aee 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> @@ -3187,7 +3187,11 @@ bool amdgpu_vm_handle_fault(struct amdgpu_device
> *adev, u32 pasid,
> value = 0;
> }
>
> - r = dma_resv_reserve_fences(vm->root.bo->tbo.base.resv, 1);
> + /* update_range operates in immediate mode here meaning the SDMA commit
> + * is on the immediate entity, while the last_unlocked comes from the
> + * delayed entity.
> + */
Oh that is a good catch but clearly not the right way of fixing this.
We should not touch the last_unlocked fence in any way possible while doing an
immediate update to handle a page fault.
My patch set already drops that handling, so we should be save for now. Please
review patch "drm/amdgpu/vm: add amdgpu_vm_pt_leaves() v4" on the mailing list
instead.
Thanks,
Christian.
> + r = dma_resv_reserve_fences(vm->root.bo->tbo.base.resv, 2);
> if (r) {
> pr_debug("failed %d to reserve fence slot\n", r);
> goto error_unlock;