On 11/18/26 20:07, Benjamin Cheng wrote:
> When creating a BO that shares the VM root PD's resv, TTM eviction
> fences are added to the resv, and there is another fence added for the
> BO clear job.
Good catch.
> Fixes: 897ee11ec020 ("drm/amdgpu: create multiple clear/move ttm entities")
Yeah that is most likely incorrect. The bug existed for as long as the driver
was upstream.
It's just that nobody ever noticed because it doesn't matter in practice (the
VM root PD should always have enough free slots).
It's just that the automated checkers could complain if we start to run them
together with lockdep enablement.
> Signed-off-by: Benjamin Cheng <[email protected]>
Reviewed-by: Christian König <[email protected]>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
> index 9da7ae6b9ef3..eb7473ed9e0e 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
> @@ -504,6 +504,14 @@ int amdgpu_gem_create_ioctl(struct drm_device *dev, void
> *data,
> if (r)
> return r;
>
> + /* ttm_bo_init_reserved() + clear fence */
> + r = dma_resv_reserve_fences(vm->root.bo->tbo.base.resv,
> + TTM_NUM_MOVE_FENCES + 1);
> + if (r) {
> + amdgpu_bo_unreserve(vm->root.bo);
> + return r;
> + }
> +
> resv = vm->root.bo->tbo.base.resv;
> }
>