AMD General

Reviewed-by: "David Yat Sin <[email protected]>"

> -----Original Message-----
> From: amd-gfx <[email protected]> On Behalf Of David
> Francis
> Sent: Tuesday, June 30, 2026 2:37 PM
> To: [email protected]
> Cc: Francis, David <[email protected]>
> Subject: [PATCH] drm/amdkfd: Don't acquire buffers during CRIU queue restore.
>
> kfd_criu_restore_queue's call of kfd_queue_acquire_buffers was failing for 
> multiple
> reasons
> - The ctl_stack_size set by the CRIU plugin doesn't match what is expected by
> acquire_buffers
> - The svm buffer cannot be acquired at this point because CRIU may not have
> restored it, or may have restored it to a different address.
>
> The only reason acquire_buffers was necessary here was to avoid a null ptr
> dereference in init_user_queue.
>
> Just put in a check for that dereference; it doesn't appear to come up in 
> real use
> cases right now. That is, there is no usage of CRIU with shared MES.
>
> This is a partial revert of d3f670cfb535f
> (drm/amdkfd: Properly acquire queue buffers in CRIU restore)
>
> Signed-off-by: David Francis <[email protected]>
> ---
>  .../gpu/drm/amd/amdkfd/kfd_process_queue_manager.c  | 13 +++++--------
>  1 file changed, 5 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c
> b/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c
> index 071f956f183c..3bbda47a4439 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c
> @@ -265,6 +265,11 @@ static int init_user_queue(struct process_queue_manager
> *pqm,
>       (*q)->process = pqm->process;
>
>       if (dev->kfd->shared_resources.enable_mes) {
> +             if (!q_properties->wptr_bo) {
> +                     pr_debug("Queue initialization with shared MES requires
> queue buffers to be initialized\n");
> +                     return -EINVAL;
> +             }
> +
>               retval = amdgpu_amdkfd_alloc_kernel_mem(dev->adev,
>                                               AMDGPU_MES_GANG_CTX_SIZE,
>                                               AMDGPU_GEM_DOMAIN_GTT,
> @@ -1042,18 +1047,10 @@ int kfd_criu_restore_queue(struct kfd_process *p,
>       memset(&qp, 0, sizeof(qp));
>       set_queue_properties_from_criu(&qp, q_data, NUM_XCC(pdd->dev->adev-
> >gfx.xcc_mask));
>
> -     ret = kfd_queue_acquire_buffers(pdd, &qp);
> -     if (ret) {
> -             pr_debug("failed to acquire user queue buffers for CRIU\n");
> -             goto exit;
> -     }
> -
>       print_queue_properties(&qp);
>
>       ret = pqm_create_queue(&p->pqm, pdd->dev, &qp, &queue_id, q_data, mqd,
> ctl_stack, NULL);
>       if (ret) {
> -             kfd_queue_unref_bo_vas(pdd, &qp);
> -             kfd_queue_release_buffers(pdd, &qp);
>               pr_err("Failed to create new queue err:%d\n", ret);
>               goto exit;
>       }
> --
> 2.34.1

Reply via email to