From: sashiko-bot@kernel.org
To: "Saim Shujah" <saimzst@gmail.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/msm/dpu: clear pending flush state before physical cleanup
Date: Wed, 26 Aug 2026 18:38:28 +0000 [thread overview]
Message-ID: <20260826183828.A8D0F1F00ADF@smtp.kernel.org> (raw)
In-Reply-To: <20260826182459.1506522-1-saimzst@gmail.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
Pre-existing issues:
- [High] dpu_hw_ctl_clear_pending_flush() fails to clear pending_periph_flush_mask, leaving stale peripheral flush state across encoder teardowns.
- [High] Sleeping function usleep_range() is called from display driver atomic contexts during encoder cleanup.
--
commit 8f92b7c700308d037e1db8696d21fde498d38560
Author: Saim Shujah <saimzst@gmail.com>
drm/msm/dpu: clear pending flush state before physical cleanup
Hardware can consume an active-frame CTL flush while the cached software
pending-flush mask retains the submitted bits. The patch clears the cached
pending-flush bookkeeping before constructing the teardown state.
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
> index 1f20695f81e35..45189b6076bc4 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
> @@ -2263,6 +2263,7 @@ void dpu_encoder_helper_phys_cleanup(struct dpu_encoder_phys *phys_enc)
>
> dpu_enc = to_dpu_encoder_virt(phys_enc->parent);
>
> + ctl->ops.clear_pending_flush(ctl);
[Severity: High]
This isn't a bug introduced by this patch, but does dpu_hw_ctl_clear_pending_flush()
leave stale peripheral flush state across encoder teardowns?
In drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c:dpu_hw_ctl_clear_pending_flush():
ctx->pending_flush_mask = 0x0;
ctx->pending_intf_flush_mask = 0;
ctx->pending_wb_flush_mask = 0;
ctx->pending_cwb_flush_mask = 0;
ctx->pending_merge_3d_flush_mask = 0;
ctx->pending_dsc_flush_mask = 0;
ctx->pending_cdm_flush_mask = 0;
memset(ctx->pending_dspp_flush_mask, 0,
sizeof(ctx->pending_dspp_flush_mask));
The function clears most software state caches, but ctx->pending_periph_flush_mask
is missed.
Because pending_periph_flush_mask is omitted from the clear operation, any
peripheral flush bits set from the previous active frame remain in the software
cache. When the encoder is later re-enabled or flushed, this stale mask could
be inadvertently flushed to the CTL_PERIPH_FLUSH hardware register, potentially
causing unexpected hardware states or hangs.
> ctl->ops.reset(ctl);
[Severity: High]
This is a pre-existing issue, but does this hardware cleanup execute a sleeping
polling path while in an atomic context?
dpu_encoder_helper_phys_cleanup() is called from the encoder atomic disable
callback. ctl->ops.reset(ctl) resolves to dpu_hw_ctl_reset_control(), which
polls the hardware and calls usleep_range():
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c:dpu_hw_ctl_poll_reset_status():
if (status)
usleep_range(20, 50);
Calling sleeping functions like usleep_range() from atomic context paths in
display drivers can cause kernel warnings, system instability, and potential
deadlocks.
>
> dpu_encoder_helper_reset_mixers(phys_enc);
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260826182459.1506522-1-saimzst@gmail.com?part=1
next prev parent reply other threads:[~2026-08-26 18:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-26 18:24 [PATCH] drm/msm/dpu: clear pending flush state before physical cleanup Saim Shujah
2026-08-26 18:38 ` sashiko-bot [this message]
2026-09-13 21:59 ` Dmitry Baryshkov
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=20260826183828.A8D0F1F00ADF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=saimzst@gmail.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.