From: sashiko-bot@kernel.org
To: "Zi-Hao Huang" <zi-hao.huang@mediatek.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/mediatek: dsi: Don't let a signal cut the IRQ wait short
Date: Wed, 18 Nov 2026 01:30:09 +0000 [thread overview]
Message-ID: <sashiko-outbox-219902@kernel.org> (raw)
In-Reply-To: <20261118-mtk-dsi-irq-wait-v1-1-205f25fac8b2@mediatek.com>
Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [High] drm/mediatek: data race on dsi->irq_data in
mtk_dsi_irq_data_clear() [1]
--
commit 05e9a152e55dc7fe529c1070f18d57f8b05d8243
Author: Zi-Hao Huang <zi-hao.huang@mediatek.com>
drm/mediatek: dsi: Don't let a signal cut the IRQ wait short
This commit switches mtk_dsi_wait_for_irq_done() to wait_event_timeout()
and mtk_dsi_irq() to wake_up() so that pending signals do not abort hardware
IRQ waits prematurely.
> diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
> index f82506e10fd59..1315dd31a8349 100644
> --- a/drivers/gpu/drm/mediatek/mtk_dsi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
> @@ -627,9 +627,8 @@ static s32 mtk_dsi_wait_for_irq_done(struct mtk_dsi *dsi, u32 irq_flag,
> unsigned long jiffies = msecs_to_jiffies(timeout);
> struct drm_device *drm = dsi->bridge.dev;
>
> - ret = wait_event_interruptible_timeout(dsi->irq_wait_queue,
> - dsi->irq_data & irq_flag,
> - jiffies);
> + ret = wait_event_timeout(dsi->irq_wait_queue,
> + dsi->irq_data & irq_flag, jiffies);
> if (ret == 0) {
> drm_warn(drm, "Wait DSI IRQ(0x%08x) Timeout\n", irq_flag);
>
> @@ -656,7 +655,7 @@ static irqreturn_t mtk_dsi_irq(int irq, void *dev_id)
>
> mtk_dsi_mask(dsi, DSI_INTSTA, status, 0);
> mtk_dsi_irq_data_set(dsi, status);
> - wake_up_interruptible(&dsi->irq_wait_queue);
> + wake_up(&dsi->irq_wait_queue);
[Severity: High]
This problem wasn't introduced by this patch, but can a data race on
dsi->irq_data between mtk_dsi_irq_data_clear() and mtk_dsi_irq_data_set()
[1] lose an interrupt flag?
drivers/gpu/drm/mediatek/mtk_dsi.c:
static void mtk_dsi_irq_data_set(struct mtk_dsi *dsi, u32 irq_bit)
{
dsi->irq_data |= irq_bit;
}
static void mtk_dsi_irq_data_clear(struct mtk_dsi *dsi, u32 irq_bit)
{
dsi->irq_data &= ~irq_bit;
}
Both helpers perform non-atomic read-modify-write operations on
dsi->irq_data without synchronization:
CPU0 <hardirq>
mtk_dsi_irq_data_clear()
read dsi->irq_data
mtk_dsi_irq()
mtk_dsi_irq_data_set()
dsi->irq_data |= status
write stale dsi->irq_data <-- clobbers newly set status bits
When mtk_dsi_irq_data_clear() overwrites the flag set by mtk_dsi_irq(),
mtk_dsi_wait_for_irq_done() misses the completion and times out, causing
DSI command transfers or mode switches to fail.
[1] https://sashiko.dev/#/bug/linux-366e515b-3237-4b5e-90f0-3615e8a40df5
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261118-mtk-dsi-irq-wait-v1-1-205f25fac8b2@mediatek.com?part=1
prev parent reply other threads:[~2026-11-18 1:30 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-18 1:25 [PATCH] drm/mediatek: dsi: Don't let a signal cut the IRQ wait short Zi-Hao Huang
2026-11-18 1:25 ` Zi-Hao Huang via B4 Relay
2026-11-18 1:30 ` sashiko-bot [this message]
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-219902@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=zi-hao.huang@mediatek.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 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.