drm/amdkfd: Check before ctl stack copy in CRIU restore
Subsystems (3)
PATCH 1/1 drm/amdkfd: Check before ctl stack copy in CRIU restore
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.
--- drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c +7 -3
@@ -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 )) { +/* 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 <<
Signature · 1 line
2.34.1
Quoted 18 lines · David Francis
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(-)drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c +0
-0
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c static void restore_mqd(struct mqd_manager *mm, void **mqd, · line 466
Quoted 7 lines
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c +1
-3@@ -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
Quoted 12 lines
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c +6
-1+/* 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