From: sashiko-bot@kernel.org
To: "Rob Clark" <robin.clark@oss.qualcomm.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v5 02/10] drm/msm: Rework queuelock
Date: Thu, 16 Jul 2026 20:39:17 +0000 [thread overview]
Message-ID: <20260716203919.55DF71F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260716201538.365824-3-robin.clark@oss.qualcomm.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] The conversion to `guard(rwsem_write)` in `msm_submitqueue_remove()` extends the lock's scope to cover `msm_submitqueue_put()`, leading to lock contention and potential deadlocks.
--
--- Patch [2]: [PATCH v5 02/10] drm/msm: Rework queuelock ---
commit 578ea2d7dbb1b26cbd22beab7c73963f3cc195e7
Author: Rob Clark <robin.clark@oss.qualcomm.com>
drm/msm: Rework queuelock
This commit renames queuelock to ctxlock and changes it from a rwlock
to a rw_semaphore. It also introduces cleanup guards to manage releasing
the lock.
> diff --git a/drivers/gpu/drm/msm/msm_submitqueue.c b/drivers/gpu/drm/msm/msm_submitqueue.c
> index 1a5a77b280163..8b5980d5a6a79 100644
> --- a/drivers/gpu/drm/msm/msm_submitqueue.c
> +++ b/drivers/gpu/drm/msm/msm_submitqueue.c
[ ... ]
> @@ -335,19 +330,16 @@ int msm_submitqueue_remove(struct msm_context *ctx, u32 id)
> if (!id)
> return -ENOENT;
>
> - write_lock(&ctx->queuelock);
> + guard(rwsem_write)(&ctx->ctxlock);
>
> list_for_each_entry(entry, &ctx->submitqueues, node) {
> if (entry->id == id) {
> list_del(&entry->node);
> - write_unlock(&ctx->queuelock);
> -
> msm_submitqueue_put(entry);
[Severity: High]
Does extending the lock's scope over msm_submitqueue_put() create a deadlock
risk?
By using guard(rwsem_write), the ctxlock remains held until the function
returns. Previously, the lock was explicitly released before calling
msm_submitqueue_put().
For VM_BIND queues, dropping the last reference can call
drm_sched_entity_destroy(), which blocks in drm_sched_entity_flush() waiting
for pending jobs to finish. If userspace submits a job with an in-fence
dependency and then removes the queue, the kernel will wait inside
msm_submitqueue_put() while still holding the write lock.
If another thread needs the ctxlock to signal the dependency or perform other
IOCTLs on the same context, could this result in a permanent deadlock?
> return 0;
> }
> }
>
> - write_unlock(&ctx->queuelock);
> return -ENOENT;
> }
>
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260716201538.365824-1-robin.clark@oss.qualcomm.com?part=2
next prev parent reply other threads:[~2026-07-16 20:39 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-16 20:15 [PATCH v5 00/10] drm/msm: A couple lazy-vm fixes Rob Clark
2026-07-16 20:15 ` [PATCH v5 01/10] drm/msm: Fix barriers accessing ctx vm Rob Clark
2026-07-16 20:31 ` sashiko-bot
2026-07-16 20:15 ` [PATCH v5 02/10] drm/msm: Rework queuelock Rob Clark
2026-07-16 20:39 ` sashiko-bot [this message]
2026-07-16 20:15 ` [PATCH v5 03/10] drm/msm: Synchronize VM creation on ctxlock Rob Clark
2026-07-16 20:33 ` sashiko-bot
2026-07-16 20:15 ` [PATCH v5 04/10] drm/msm/a6xx: Access VM directly in submit path Rob Clark
2026-07-16 20:43 ` sashiko-bot
2026-07-16 20:15 ` [PATCH v5 05/10] drm/msm: Add helper to check for per-process pgtables VM Rob Clark
2026-07-16 20:15 ` [PATCH v5 06/10] drm/msm: Allow lazy VM creation to fail Rob Clark
2026-07-16 20:33 ` sashiko-bot
2026-07-16 20:15 ` [PATCH v5 07/10] drm/msm: Don't fallback to shared VM for VM_BIND Rob Clark
2026-07-16 20:28 ` sashiko-bot
2026-07-16 20:15 ` [PATCH v5 08/10] drm/msm: Validate lazy VM in GEM_NEW Rob Clark
2026-07-16 20:29 ` sashiko-bot
2026-07-16 20:15 ` [PATCH v5 09/10] drm/msm: Fix per-process-pgtables check Rob Clark
2026-07-16 20:48 ` sashiko-bot
2026-07-16 20:15 ` [PATCH v5 10/10] drm/msm: Remove invalid overflow check Rob Clark
2026-07-16 20:34 ` sashiko-bot
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=20260716203919.55DF71F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=robin.clark@oss.qualcomm.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.