RE: [PATCH v2] drm/amdkfd: fix QID bit leak in pqm_create_queue()

"Russell, Kent" <[email protected]>
Newsgroups org.freedesktop.lists.amd-gfx
Message-ID <BL1PR12MB589821DBA41880C98D44744185C62@BL1PR12MB5898.namprd12.prod.outlook.com>
AMD General

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



> -----Original Message-----
> From: amd-gfx <[email protected]> On Behalf Of
> Marioukhine, Vladimir
> Sent: June 17, 2026 5:02 PM
> To: [email protected]
> Cc: Deucher, Alexander <[email protected]>
> Subject: [PATCH v2] drm/amdkfd: fix QID bit leak in pqm_create_queue()
>
> [Some people who received this message don't often get email from
> [email protected]. Learn why this is important at
> https://aka.ms/LearnAboutSenderIdentification ]
>
> When MES is enabled and amdgpu_amdkfd_alloc_kernel_mem() fails during
> the first queue creation for a process, pqm_create_queue() returns
> early via 'return retval' without going through the err_create_queue
> cleanup label.
>
> This means clear_bit(*qid, pqm->queue_slot_bitmap) is never called,
> leaving the reserved QID bit permanently set in queue_slot_bitmap.
> Over time this leaks QID slots, potentially exhausting all available
> queue slots.
>
> Fix this by replacing 'return retval' with 'goto err_create_queue'
> so that clear_bit() is always called on the error path.
>
> Fixes: AILIKFD-813
> Reported-by: Deucher, Alexander <[email protected]>
> Signed-off-by: Vladimir Marioukhine <[email protected]>
>
> Changes in v2:
> - Fixed author name format to First Last order (suggested by A. Deucher)
> - Removed incorrect attachments from mailing list submission
>
> ---
>  drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> 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 1234567..abcdefg 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c
> @@ -378,7 +378,7 @@
>                                                      false);
>                 if (retval) {
>                         dev_err(dev->adev->dev, "failed to allocate process context bo\n");
> -                       return retval;
> +                       goto err_create_queue;
>                 }
>                 memset(pdd->proc_ctx_cpu_ptr, 0, AMDGPU_MES_PROC_CTX_SIZE);
>         }
> --
> 2.34.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.