AMD General

Unneeded removed line at the end. Take care of that and it's

Reviewed-by: Kent Russell <[email protected]>



> -----Original Message-----
> From: amd-gfx <[email protected]> On Behalf Of David
> Francis
> Sent: June 4, 2026 3:43 PM
> To: [email protected]
> Cc: Yang, Philip <[email protected]>; Yat Sin, David
> <[email protected]>; Francis, David <[email protected]>
> Subject: [PATCH] drm/amdkfd: Properly acquire queue buffers in CRIU restore
>
> When kfd_queue_acquire_buffers() was split off from
> set_queue_properties_from_user(), set_queue_properties_from_criu()
> was missed. Thus, set_queue_properties_from_criu() is not
> filling out the buffer fields of queue_properties, which
> can come up when subsequent code expects them to be non-null.
>
> Add the proper call to kfd_queue_acquire_buffers(), and also
> use the right cast types in set_queue_properties_from_criu()
> (which were missed at the same time)
>
> Signed-off-by: David Francis <[email protected]>
> ---
>  .../gpu/drm/amd/amdkfd/kfd_process_queue_manager.c  | 13 ++++++++++---
>  1 file changed, 10 insertions(+), 3 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 9295d0f9dce4..67b282dafbe7 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c
> @@ -962,8 +962,8 @@ static void set_queue_properties_from_criu(struct
> queue_properties *qp,
>       qp->priority = q_data->priority;
>       qp->queue_address = q_data->q_address;
>       qp->queue_size = q_data->q_size;
> -     qp->read_ptr = (uint32_t *) q_data->read_ptr_addr;
> -     qp->write_ptr = (uint32_t *) q_data->write_ptr_addr;
> +     qp->read_ptr = (void __user *)q_data->read_ptr_addr;
> +     qp->write_ptr = (void __user *)q_data->write_ptr_addr;
>       qp->eop_ring_buffer_address = q_data->eop_ring_buffer_address;
>       qp->eop_ring_buffer_size = q_data->eop_ring_buffer_size;
>       qp->ctx_save_restore_area_address = q_data-
> >ctx_save_restore_area_address;
> @@ -1042,17 +1042,24 @@ 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;
>       }
>
>       if (q_data->gws)
>               ret = pqm_set_gws(&p->pqm, q_data->q_id, pdd->dev->gws);
> -
>  exit:
>       if (ret)
>               pr_err("Failed to restore queue (%d)\n", ret);
> --
> 2.34.1

Reply via email to