drm/amdgpu: Fix one list corruption when create queue fails
Subsystems (3)
PATCH 1/1 drm/amdgpu: Fix one list corruption when create queue fails
Queue would be freed when create_queue_cpsch fails
So lets do queue cleanup otherwise various list and memory issues happen.
--- drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +5 -6
@@ -1674,14 +1674,13 @@ static int create_queue_cpsch(struct device_queue_manager *dqm, struct queue *q,if (q->properties.is_active) {increment_queue_count (dqm, qpd, q); -if (!dqm->dev->shared_resources.enable_mes) { +if (!dqm->dev->shared_resources.enable_mes) retval =execute_queues_cpsch (dqm, -KFD_UNMAP_QUEUES_FILTER_DYNAMIC_QUEUES ,0 ); - }else { +KFD_UNMAP_QUEUES_FILTER_DYNAMIC_QUEUES ,0 ); +else retval =add_queue_mes (dqm, q, qpd); -if (retval) - goto cleanup_queue; - } +if (retval) + goto cleanup_queue; }/*
Signature · 1 line
2.34.1
On 2022-07-07 06:28, xinhui pan wrote:
Queue would be freed when create_queue_cpsch fails So lets do queue cleanup otherwise various list and memory issues happen. This bug was introduced when adding MES support, as we used to ignore execute_queues_cpsch return value. Cleanup and return error to user space looks good to me.
Felix Kuehling
maintainerAm 2022-07-07 um 09:39 schrieb philip yang:
Quoted 9 lines · xinhui pan
Quoted 3 lines
Queue would be freed when
create_queue_cpschfails
So lets do queue cleanup otherwise various list and memory issues happen.This bug was introduced when adding MES support, as we used to ignore
execute_queues_cpschreturn value. Cleanup and return error to user space looks good to me.
This is similar to the queue destroy failure you looked at. A failure in execute_queues_cpsch doesn't really indicate that the queue creation failed. There is nothing specifically wrong with this queue. It just means that HWS is probably hanging. So this problem will be handled with a GPU reset anyway.
Regards,
Felix
Quoted 31 lines
Reviewed-by Philip Yang <[email protected]>Quoted 29 lines
Signed-off-by xinhui pan<[email protected]>--- drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +5
-6@@ -1674,14 +1674,13 @@ static int create_queue_cpsch(struct device_queue_manager *dqm, struct queue *q,if (q->properties.is_active) {increment_queue_count (dqm, qpd, q); -if (!dqm->dev->shared_resources.enable_mes) { +if (!dqm->dev->shared_resources.enable_mes) retval =execute_queues_cpsch (dqm, -KFD_UNMAP_QUEUES_FILTER_DYNAMIC_QUEUES ,0 ); - }else { +KFD_UNMAP_QUEUES_FILTER_DYNAMIC_QUEUES ,0 ); +else retval =add_queue_mes (dqm, q, qpd); -if (retval) - goto cleanup_queue; - } +if (retval) + goto cleanup_queue; }/*