On Thu, Oct 15, 2026 at 3:13 PM David Francis <[email protected]> wrote:
>
> During CRIU restore, if cwsr is enabled, there is expected
> to be a control stack that needs to be restored for
> compute queues. In other cases, there shoudl be no control
> stack, but we were copying one over anyways.
>
> In that case, skip, and warn once.
>
> Signed-off-by: David Francis <[email protected]>
> ---
> drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c | 10 +++++++---
> 1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c
> b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c
> index 75e5a9f67d50..0350c7c2b307 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c
> @@ -463,9 +463,13 @@ static void restore_mqd(struct mqd_manager *mm, void
> **mqd,
> if (gart_addr)
> *gart_addr = addr;
>
> - /* Control stack is located one page after MQD. */
> - ctl_stack = (void *)((uintptr_t)*mqd + AMDGPU_GPU_PAGE_SIZE);
> - memcpy(ctl_stack, ctl_stack_src, ctl_stack_size);
> + if (mm->dev->kfd->cwsr_enabled && (qp->type ==
> KFD_QUEUE_TYPE_COMPUTE)) {
Do you need the queue type check? Doesn't SDMA use
restore_mqd_sdma()? Also is a bounds check needed for the memcpy?
Alex
> + /* Control stack is located one page after MQD. */
> + ctl_stack = (void *)((uintptr_t)*mqd + AMDGPU_GPU_PAGE_SIZE);
> + memcpy(ctl_stack, ctl_stack_src, ctl_stack_size);
> + } else if (ctl_stack_size > 0) {
> + drm_warn_once(adev_to_drm(mm->dev->adev), "Control stack for
> non-compute queue in CRIU restore\n");
> + }
>
> m->cp_hqd_pq_doorbell_control =
> qp->doorbell_off <<
> --
> 2.34.1
>