[PATCH] drm/amdgpu: add entity error check in amdgpu_ctx_get_entity

Alex Deucher alexdeucher at gmail.com
Wed May 17 20:54:27 UTC 2023


On Thu, May 11, 2023 at 5:29 AM ZhenGuo Yin <zhenguo.yin at amd.com> wrote:
>
> [Why]
> UMD is not aware of entity error, and will keep submitting jobs
> into the error entity.
>
> [How]
> Add entity error check when getting entity from ctx.
>
> Signed-off-by: ZhenGuo Yin <zhenguo.yin at amd.com>

Looks correct to me.
Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
> index e3d047663d61..077e010e29d4 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
> @@ -417,6 +417,7 @@ int amdgpu_ctx_get_entity(struct amdgpu_ctx *ctx, u32 hw_ip, u32 instance,
>                           u32 ring, struct drm_sched_entity **entity)
>  {
>         int r;
> +       struct drm_sched_entity *ctx_entity;
>
>         if (hw_ip >= AMDGPU_HW_IP_NUM) {
>                 DRM_ERROR("unknown HW IP type: %d\n", hw_ip);
> @@ -440,7 +441,14 @@ int amdgpu_ctx_get_entity(struct amdgpu_ctx *ctx, u32 hw_ip, u32 instance,
>                         return r;
>         }
>
> -       *entity = &ctx->entities[hw_ip][ring]->entity;
> +       ctx_entity = &ctx->entities[hw_ip][ring]->entity;
> +       r = drm_sched_entity_error(ctx_entity);
> +       if (r) {
> +               DRM_DEBUG("error entity %p\n", ctx_entity);
> +               return r;
> +       }
> +
> +       *entity = ctx_entity;
>         return 0;
>  }
>
> --
> 2.35.1
>


More information about the amd-gfx mailing list