From: sashiko-bot@kernel.org
To: "Maxime Ripard" <mripard@kernel.org>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v9 08/10] drm/msm/dpu1: Carry the mixers over to created CRTC states
Date: Tue, 10 Nov 2026 17:30:08 +0000 [thread overview]
Message-ID: <sashiko-outbox-207478@kernel.org> (raw)
In-Reply-To: <20261110-drm-reset-state-flag-v9-8-ddb0e26324a0@kernel.org>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] drm/msm/dpu: stale mixers and dead CTLs copied in
dpu_crtc_atomic_check()
--
commit 1b109324be16b20d23b18d888d3626797044015c
Author: Maxime Ripard <mripard@kernel.org>
drm/msm/dpu1: Carry the mixers over to created CRTC states
This commit copies mixers and CTLs from the old CRTC state to the new
CRTC state in dpu_crtc_atomic_check() when the new state has no mixers
assigned and no modeset occurred.
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> index 77a2d1f6700d0..97deadc976ed7 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> @@ -1540,6 +1540,27 @@ static int dpu_crtc_atomic_check(struct drm_crtc *crtc,
> rc = dpu_crtc_assign_resources(crtc, crtc_state);
> if (rc < 0)
> return rc;
> + } else if (!cstate->num_mixers) {
> + struct dpu_crtc_state *old_cstate =
> + to_dpu_crtc_state(drm_atomic_get_old_crtc_state(state,
> + crtc));
> +
> + /*
> + * A CRTC that keeps its configuration keeps its mixers.
> + * A duplicated state carries them over, but a state
> + * created through atomic_create_state() comes with
> + * none, so copy them from the current state like a
> + * duplicated state would, to make sure the checks and
> + * the commit see the mixers in use.
> + */
> + if (old_cstate->num_mixers) {
> + cstate->num_mixers = old_cstate->num_mixers;
> + memcpy(cstate->mixers, old_cstate->mixers,
> + sizeof(cstate->mixers));
> + cstate->num_ctls = old_cstate->num_ctls;
> + memcpy(cstate->hw_ctls, old_cstate->hw_ctls,
> + sizeof(cstate->hw_ctls));
> + }
> }
>
> if (crtc_state->planes_changed || crtc_state->zpos_changed) {
[Severity: Medium]
Can this copy stale mixers onto a disabled CRTC state when
crtc_state->enable is false?
When a CRTC is disabled in an earlier commit that uses
dpu_crtc_duplicate_state(), dpu_crtc_assign_resources() releases the
resources in dpu_rm and returns early on !crtc_state->enable without
clearing cstate->num_mixers or cstate->mixers[]:
drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c:dpu_crtc_assign_resources() {
...
dpu_rm_release(global_state, crtc);
if (!crtc_state->enable)
return 0;
...
}
If a subsequent commit built with drm_atomic_commit_fill_with_defaults()
leaves that CRTC disabled, mode_changed, connectors_changed, and
color_mgmt_changed are all false. This branch then copies the already
released mixers from old_cstate into the new disabled cstate, where
consumers that inspect cstate->num_mixers without checking
crtc_state->enable (such as dpu_crtc_set_crc_source() via
dpu_crtc_setup_lm_misr()) can access hardware resources that may have
been reassigned to another active CRTC.
Also, cstate->num_ctls and cstate->hw_ctls are unused fields in struct
dpu_crtc_state that dpu_crtc_assign_resources() never populates (CTL
pointers are stored in cstate->mixers[i].lm_ctl).
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261110-drm-reset-state-flag-v9-0-ddb0e26324a0@kernel.org?part=8
next prev parent reply other threads:[~2026-11-10 17:30 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-10 16:02 [PATCH v9 00/10] drm: Add DRM_MODE_ATOMIC_RESET flag Maxime Ripard
2026-11-10 16:02 ` [PATCH v9 01/10] drm/amd/display: Fix planes atomic_create_state implementation Maxime Ripard
2026-11-10 16:02 ` [PATCH v9 02/10] drm/atomic: Add drm_atomic_implements_create_state() helper Maxime Ripard
2026-11-10 16:02 ` [PATCH v9 03/10] drm/lease: Add a helper to tell whether a lease was revoked Maxime Ripard
2026-11-10 16:02 ` [PATCH v9 04/10] drm/atomic: Allow filling a commit with pristine object states Maxime Ripard
2026-11-10 16:49 ` sashiko-bot
2026-11-10 16:02 ` [PATCH v9 05/10] drm/tests: atomic: Add tests for drm_atomic_commit_fill_with_defaults() Maxime Ripard
2026-11-10 16:02 ` [PATCH v9 06/10] drm/amd/display: Take over the current stream and dc_state Maxime Ripard
2026-11-10 16:02 ` [PATCH v9 07/10] drm/vc4: Carry the HVS channel over to created CRTC states Maxime Ripard
2026-11-10 16:02 ` [PATCH v9 08/10] drm/msm/dpu1: Carry the mixers " Maxime Ripard
2026-11-10 17:30 ` sashiko-bot [this message]
2026-11-10 16:02 ` [PATCH v9 09/10] drm/atomic-uapi: Add DRM_MODE_ATOMIC_RESET flag Maxime Ripard
2026-11-10 17:46 ` sashiko-bot
2026-11-10 16:02 ` [PATCH v9 10/10] drm/vkms: Add driver-specific plane property for testing Maxime Ripard
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-207478@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=mripard@kernel.org \
--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.