From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: drm/encoder: drm_encoder_cleanup: lock the encoder chain mutex during removal
Date: Wed, 25 Mar 2026 06:59:30 +1000 [thread overview]
Message-ID: <review-patch2-20260324-drm-bridge-alloc-encoder-chain-mutex-v5-2-8bf786c5c7e6@bootlin.com> (raw)
In-Reply-To: <20260324-drm-bridge-alloc-encoder-chain-mutex-v5-2-8bf786c5c7e6@bootlin.com>
Patch Review
The ABBA deadlock analysis in the commit message is excellent. The solution using `list_cut_before()` is correct:
```c
list_cut_before(&tmplist, &encoder->bridge_chain, &encoder->bridge_chain);
```
When `entry == head` (third arg == second arg), `list_cut_before` moves all entries to `tmplist` and leaves `bridge_chain` empty, which is the desired behavior. The empty-list case (`head->next == entry` when the list is empty, i.e., `head->next == head`) correctly initializes `tmplist` as empty and returns early.
**Minor note:** The comment says `drm_modeset_lock_fini()` but the code path described mentions `drm_atomic_private_obj_fini -> DRM_MODESET_LOCK_ALL_BEGIN()`. Worth verifying that `drm_modeset_lock_fini` is really what's meant here, but this is just a comment clarity issue.
**Concern:** After `list_cut_before`, bridges are detached without the mutex. During this window, another thread could see an empty `bridge_chain` and proceed with operations on a partially-torn-down encoder. However, since `drm_encoder_cleanup` is a teardown path, this is acceptable — no new operations should be starting on an encoder being cleaned up.
---
Generated by Claude Code Patch Reviewer
next prev parent reply other threads:[~2026-03-24 20:59 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-24 8:58 [PATCH v5 0/7] drm/bridge: protect encoder bridge chain with a mutex Luca Ceresoli
2026-03-24 8:58 ` [PATCH v5 1/7] drm/encoder: add mutex to protect the bridge chain Luca Ceresoli
2026-03-24 20:59 ` Claude review: " Claude Code Review Bot
2026-03-24 8:58 ` [PATCH v5 2/7] drm/encoder: drm_encoder_cleanup: lock the encoder chain mutex during removal Luca Ceresoli
2026-03-24 20:59 ` Claude Code Review Bot [this message]
2026-03-24 8:58 ` [PATCH v5 3/7] drm/bridge: drm_bridge_attach: lock the encoder chain mutex during insertion Luca Ceresoli
2026-03-24 20:59 ` Claude review: " Claude Code Review Bot
2026-03-24 8:58 ` [PATCH v5 4/7] drm/bridge: lock the encoder chain in scoped for_each loops Luca Ceresoli
2026-03-24 20:59 ` Claude review: " Claude Code Review Bot
2026-03-24 8:58 ` [PATCH v5 5/7] drm/bridge: prevent encoder chain changes while iterating with list_for_each_entry_from() Luca Ceresoli
2026-03-24 20:59 ` Claude review: " Claude Code Review Bot
2026-03-24 8:58 ` [PATCH v5 6/7] drm/bridge: prevent encoder chain changes while iterating with list_for_each_entry_reverse() Luca Ceresoli
2026-03-24 20:59 ` Claude review: " Claude Code Review Bot
2026-03-24 8:58 ` [PATCH v5 7/7] drm/bridge: prevent encoder chain changes in pre_enable/post_disable Luca Ceresoli
2026-03-24 20:59 ` Claude review: " Claude Code Review Bot
2026-03-24 20:59 ` Claude review: drm/bridge: protect encoder bridge chain with a mutex Claude Code Review 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=review-patch2-20260324-drm-bridge-alloc-encoder-chain-mutex-v5-2-8bf786c5c7e6@bootlin.com \
--to=claude-review@example.com \
--cc=dri-devel-reviews@example.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox