All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Felix Kuehling" <felix.kuehling@amd.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v4] drm/amdkfd: fix doorbell allocation race creating duplicate allocations
Date: Wed, 14 Oct 2026 16:08:01 +0000	[thread overview]
Message-ID: <sashiko-outbox-171514@kernel.org> (raw)
In-Reply-To: <20261014154959.540809-1-felix.kuehling@amd.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] drm/amdkfd: pdd memory leak on kfd_init_apertures() error path
--

commit d555bec2fa5191157e4dad2138f047c49150f26e
Author: Henry Martin <bsdhenrymartin@gmail.com>

    drm/amdkfd: fix doorbell allocation race creating duplicate allocations

This patch introduces a per-process-device mutex to serialize process doorbell
allocation. It adds mutex initialization and destruction to the kfd process
lifecycle.

> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process.c b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
> index 226f52626e849..51b0df4984945 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_process.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_process.c

[ ... ]

> @@ -1802,6 +1803,7 @@ struct kfd_process_device *kfd_create_process_device_data(struct kfd_node *dev,
>  	pdd->dev = dev;
>  	INIT_LIST_HEAD(&pdd->qpd.queues_list);
>  	INIT_LIST_HEAD(&pdd->qpd.priv_queue_list);
> +	mutex_init(&pdd->doorbell_mutex);
>  	pdd->qpd.dqm = dev->dqm;
>  	pdd->qpd.pqm = &p->pqm;
>  	pdd->qpd.evicted = 0;

[Severity: Medium]
Will this mutex and the pdd struct be leaked if kfd_init_apertures() fails?

Looking at create_process(), if kfd_init_apertures() successfully allocates
one or more pdd structs but then encounters an error and fails, the error
handling path jumps to err_init_apertures:

create_process() {
    ...
    err = kfd_init_apertures(process);
    if (err != 0)
        goto err_init_apertures;
    ...
err_init_svm_range_list:
    kfd_process_free_outstanding_kfd_bos(process);
    kfd_process_destroy_pdds(process);
err_init_apertures:
    pqm_uninit(&process->pqm);
    ...
}

Because err_init_apertures bypasses the call to kfd_process_destroy_pdds(),
does this mean the newly initialized doorbell_mutex and the allocated pdd
structs are leaked?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261014154959.540809-1-felix.kuehling@amd.com?part=1

      reply	other threads:[~2026-10-14 16:08 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-09 10:18 [PATCH] amdkfd: fix doorbell allocation race creating duplicate allocations Henry Martin
2026-10-09 10:28 ` sashiko-bot
2026-10-09 15:00 ` Kuehling, Felix
2026-10-09 15:33   ` Kuehling, Felix
2026-10-10  2:55     ` henry martin
2026-10-10  3:02     ` [PATCH v2] " Henry Martin
2026-10-10  3:15       ` sashiko-bot
2026-10-13 17:39       ` Felix Kuehling
2026-10-14  3:02         ` henry martin
2026-10-14 15:32       ` [PATCH v3] drm/amdkfd: " Felix Kuehling
2026-10-14 15:44         ` sashiko-bot
2026-10-14 15:49       ` [PATCH v4] " Felix Kuehling
2026-10-14 16:08         ` sashiko-bot [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-171514@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=felix.kuehling@amd.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.