mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "CK Hu (胡俊光)" <ck.hu@mediatek.com>
To: "p.zabel@pengutronix.de" <p.zabel@pengutronix.de>,
	"AngeloGioacchino Del Regno"
	<angelogioacchino.delregno@collabora.com>,
	"Zi-hao Huang (黃梓豪)" <Zi-hao.Huang@mediatek.com>,
	"chunkuang.hu@kernel.org" <chunkuang.hu@kernel.org>
Cc: "simona@ffwll.ch" <simona@ffwll.ch>,
	"Shaoming Chen (陈绍明)" <shaoming.chen@mediatek.com>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	"airlied@gmail.com" <airlied@gmail.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>,
	"linux-mediatek@lists.infradead.org"
	<linux-mediatek@lists.infradead.org>
Subject: Re: [PATCH v2] drm/mediatek: dsi: Don't let a signal cut the IRQ wait short
Date: Thu, 19 Nov 2026 01:28:08 +0000	[thread overview]
Message-ID: <26e896f79e5811514f2aa631d77f436c09ba1544.camel@mediatek.com> (raw)
In-Reply-To: <675eb0c5-96a1-4254-844e-234fb972d824@collabora.com>

On Wed, 2026-11-18 at 13:32 +0100, AngeloGioacchino Del Regno wrote:
> On 11/18/26 10:33, Zi-Hao Huang via B4 Relay wrote:
> > From: Zi-Hao Huang <zi-hao.huang@mediatek.com>
> > 
> > mtk_dsi_wait_for_irq_done() waits for the DSI IRQ with
> > wait_event_interruptible_timeout(). If it returns early, for example
> > with -ERESTARTSYS when a signal is pending, both callers still treat the
> > command as done, because they only handle a return value of 0 as a
> > failure.
> > 
> > On an MT8196 board this led to a hard lockup during shutdown. The wait
> > returned before the IRQ arrived, the panel disable sequence went on and
> > restarted video mode, and the late CMD_DONE interrupt was then handled
> > by mtk_dsi_irq().
> 
> This happens because of the hacks that you have downstream.
> 
> With the restructured mediatek-drm adding proper support for MT8196's Display
> Controller architecture, what you're describing does not happen, because the
> tear down path is correct.

So I need more information.

1. How this bug happen (include callstack, time sequence) before restructure.
2. How restructure fix this.

If this bug is trigger by some panel, the upstream SoC may have the same problem.
I would like a easy-backport patch rather than a restructure series.

Regards,
CK

> 
> Regards,
> Angelo
> 
> > The handler writes RACK and loops until DSI_BUSY
> > clears, but DSI_BUSY stays set while video mode is running, so the CPU
> > never leaves the handler until the watchdog fires. Forcing the wait to
> > return early reproduces the lockup every time, and it no longer
> > happens once the wait cannot return early.
> > 
> > The wait synchronises the driver with the hardware, and it is bounded by
> > its timeout. Use wait_event_timeout() so that it only ends on the IRQ or
> > the timeout.
> > 
> > wake_up_interruptible() cannot wake a task in uninterruptible sleep, so
> > switch mtk_dsi_irq() to wake_up(). Without it every wait would last
> > until its timeout.
> > 
> > Fixes: dd5080a54df8 ("drm/mediatek: add dsi interrupt control")
> > Signed-off-by: Zi-Hao Huang <zi-hao.huang@mediatek.com>
> > Reviewed-by: CK Hu <ck.hu@mediatek.com>
> > ---
> > Changes in v2:
> > - Drop the remark that the wait is not made on behalf of userspace, since
> >    a userspace backlight change can reach it (CK)
> > - Collect Reviewed-by
> > - Link to v1: https://lore.kernel.org/r/20261118-mtk-dsi-irq-wait-v1-1-205f25fac8b2@mediatek.com 
> > ---
> >   drivers/gpu/drm/mediatek/mtk_dsi.c | 7 +++----
> >   1 file changed, 3 insertions(+), 4 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
> > index f82506e10fd5..1315dd31a834 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);
> >   	}
> >   
> >   	return IRQ_HANDLED;
> > 
> > ---
> > base-commit: 067c5c24cef23d913b67eaaf71ae67e7169a6620
> > change-id: 20261118-mtk-dsi-irq-wait-a24712ada627
> > 
> > Best regards,


      reply	other threads:[~2026-11-19  1:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-18  9:33 Zi-Hao Huang via B4 Relay
2026-11-18 12:32 ` AngeloGioacchino Del Regno
2026-11-19  1:28   ` CK Hu (胡俊光) [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=26e896f79e5811514f2aa631d77f436c09ba1544.camel@mediatek.com \
    --to=ck.hu@mediatek.com \
    --cc=Zi-hao.Huang@mediatek.com \
    --cc=airlied@gmail.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=chunkuang.hu@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=p.zabel@pengutronix.de \
    --cc=shaoming.chen@mediatek.com \
    --cc=simona@ffwll.ch \
    /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

all inboxes | Powered by JetHome®