From: sashiko-bot@kernel.org
To: "Andreas Kemnade" <andreas@kemnade.info>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v4] drm/omap: dsi: avoid sending bta sync all the time in writes
Date: Mon, 29 Jun 2026 16:04:47 +0000 [thread overview]
Message-ID: <20260629160448.13D001F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260629-vm-upstr-v4-1-9f0c62d8808e@kemnade.info>
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [High] Stack Use-After-Free due to race between IRQ handler and unregistering on-stack completion
- [Medium] Regression for command-mode panels due to missing DCS NOP and incorrect channel for BTA
- [Medium] Missing Error IRQ registration causes a 500ms stall on hardware transmission errors
--
commit 30f75c50c586dd648e75b97e7fe46e6f3d854488
Author: Andreas Kemnade <andreas@kemnade.info>
Subject: drm/omap: dsi: avoid sending bta sync all the time in writes
This patch avoids sending a BTA sync during writes if no ACKs are requested,
instead waiting for the packet to be sent to prevent FIFO overflows. It also
replaces the NOP sent between frames with a BTA sync during channel updates.
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index 27fe7bca9e2cf..3f22929c36e2a 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -2194,28 +2194,38 @@ static int dsi_vc_send_null(struct dsi_data *dsi, int vc, int channel)
> static int dsi_vc_write_common(struct omap_dss_device *dssdev, int vc,
> const struct mipi_dsi_msg *msg)
> {
> + DECLARE_COMPLETION_ONSTACK(completion);
> struct dsi_data *dsi = to_dsi_data(dssdev);
> int r;
>
> + /* wait for IRQ for packet transmission confirmation */
> + r = dsi_register_isr_vc(dsi, vc, dsi_completion_handler,
> + &completion, DSI_VC_IRQ_PACKET_SENT);
[Severity: Medium]
Will this stall for the full 500ms timeout if a hardware transmission error
occurs?
Since this is only registered for DSI_VC_IRQ_PACKET_SENT, an error interrupt
(like DSI_IRQ_HS_TX_TIMEOUT) wouldn't wake up the completion. Other functions
like dsi_vc_send_bta_sync() also register for DSI_IRQ_ERROR_MASK to handle
this case.
> + if (r)
> + return r;
> +
> if (mipi_dsi_packet_format_is_short(msg->type))
> r = dsi_vc_send_short(dsi, vc, msg);
> else
> r = dsi_vc_send_long(dsi, vc, msg);
>
> - if (r < 0)
> + if ((!r) && wait_for_completion_timeout(&completion,
> + msecs_to_jiffies(500)) == 0)
> + r = -EIO;
> +
> + dsi_unregister_isr_vc(dsi, vc, dsi_completion_handler,
> + &completion, DSI_VC_IRQ_PACKET_SENT);
> + if (r)
> return r;
[Severity: High]
Could this lead to a stack use-after-free if the timeout is reached?
The wait_for_completion_timeout() can return 0 (timeout), after which
dsi_unregister_isr_vc() unregisters the ISR and the function returns,
destroying the on-stack completion.
However, dsi_unregister_isr_vc() doesn't appear to synchronize with the IRQ
handler. If the hardware IRQ fires right after the timeout and the handler
executes from its lockless copy of the ISR table, could it call
dsi_completion_handler() with a dangling pointer to the destroyed stack
frame?
[ ... ]
> @@ -3268,13 +3263,13 @@ static int dsi_update_channel(struct omap_dss_device *dssdev, int vc)
> DSSDBG("dsi_update_channel: %d", vc);
>
> /*
> - * Send NOP between the frames. If we don't send something here, the
> + * Transition to LP here. If we don't send something here, the
> * updates stop working. This is probably related to DSI spec stating
> * that the DSI host should transition to LP at least once per frame.
> */
> - r = _dsi_send_nop(dsi, VC_CMD, dsi->dsidev->channel);
> + r = dsi_vc_send_bta_sync(dssdev, vc);
[Severity: Medium]
Will this break command-mode panels?
The original code explicitly sent a DCS NOP on VC_CMD (which is typically
configured for Low Power/CPU). This replaces it with a BTA sync on the vc
passed to the function, which is usually VC_VIDEO (configured as High
Speed/Video Port).
Is a BTA sync on a Video Port channel valid hardware behavior here? Also,
will panels that depend on receiving the DCS NOP payload to transition to
LP mode stop updating?
> if (r < 0) {
> - DSSWARN("failed to send nop between frames: %d\n", r);
> + DSSWARN("failed to send bta sync between frames: %d\n", r);
> goto err;
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260629-vm-upstr-v4-1-9f0c62d8808e@kemnade.info?part=1
next prev parent reply other threads:[~2026-06-29 16:04 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-29 15:50 [PATCH v4] drm/omap: dsi: avoid sending bta sync all the time in writes Andreas Kemnade
2026-06-29 16:04 ` sashiko-bot [this message]
2026-06-29 16:48 ` Andreas Kemnade
2026-06-29 16:59 ` Andreas Kemnade
2026-06-30 5:42 ` Ivaylo Dimitrov
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=20260629160448.13D001F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=andreas@kemnade.info \
--cc=dri-devel@lists.freedesktop.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.