mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Zi-Hao Huang <zi-hao.huang@mediatek.com>
To: <ck.hu@mediatek.com>
Cc: <Zi-hao.Huang@mediatek.com>, <airlied@gmail.com>,
	<angelogioacchino.delregno@collabora.com>,
	<chunkuang.hu@kernel.org>, <dri-devel@lists.freedesktop.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>,
	<linux-mediatek@lists.infradead.org>, <matthias.bgg@gmail.com>,
	<p.zabel@pengutronix.de>, <shaoming.chen@mediatek.com>,
	<simona@ffwll.ch>
Subject: Re: [PATCH v2] drm/mediatek: dsi: Don't let a signal cut the IRQ wait short
Date: Thu, 19 Nov 2026 11:36:34 +0800	[thread overview]
Message-ID: <20261119033634.1844084-1-zi-hao.huang@mediatek.com> (raw)
In-Reply-To: <26e896f79e5811514f2aa631d77f436c09ba1544.camel@mediatek.com>

Hi CK, Angelo,

On Thu, 2026-11-19 at 01:28 +0000, CK Hu wrote:
> So I need more information.
>
> 1. How this bug happen (include callstack, time sequence) before restructure.

I'm not sure the trigger is specific to our downstream driver. On
v7.4-rc2, panel-novatek-nt36536 sends display off (0x28) and enter
sleep (0x10) from .unprepare. Because the panel sets prepare_prev_first,
this runs before mtk_dsi_bridge_atomic_post_disable(), and
mtk_dsi_bridge_atomic_disable() only clears dsi->enabled. So both
commands go through mtk_dsi_host_transfer() while video mode is running:
stop video mode, send the command, wait for CMD_DONE, restore video
mode. If that wait returns early, video mode is restarted before
CMD_DONE has been handled.

On MT8196 we hit this in a warm reboot stress test. The commands were
sent from an atomic commit by the compositor (hwcomposer) while the
system was going down. With debug prints:

  - 0x28 is sent, and mtk_dsi_wait_for_irq_done() returns after about
    11 us without a timeout warning, before CMD_DONE has been handled
  - restore_dsi_mode sets DSI_START, so video mode runs again
  - 4 to 26 us later CMD_DONE arrives, with DSI_BUSY set because video
    mode is running
  - mtk_dsi_irq() writes RACK and loops on DSI_BUSY; nothing stops video
    mode, so it never leaves the handler until the watchdog reports a
    hard lockup

Backtrace of the stuck CPU from another occurrence, without debug
prints:

  readl+0x40/0x80 [mediatek_drm]
  mtk_dsi_irq+0x48/0xbc [mediatek_drm]
  handle_irq_event+0x88/0x2f8
  handle_fasteoi_irq+0xa0/0x2e0
  generic_handle_domain_irq+0x4c/0x74
  gic_handle_irq+0x64/0x264
  do_interrupt_handler+0x80/0x90
  el1_interrupt+0x40/0x8c
  el1h_64_irq_handler+0x18/0x24
  el1h_64_irq+0x7c/0x80

wait_event_interruptible_timeout() can only return early like this if
the condition is already true or a signal is pending, and a task being
torn down during reboot is likely to have a signal pending. I did not
catch the signal directly. wait_event_timeout() would still return
early on a condition that is already true, but with only the wait made
uninterruptible the lockup did not show up in 2500 warm reboots, nor in
1500 more with this patch. Forcing -ERESTARTSYS for these two commands,
with CMD_DONE held off until video mode is restored, reproduces it
every time. I have not tried mainline, since it has no MT8196 display
support.

> 2. How restructure fix this.

Angelo, in the restructured driver, does the panel's .unprepare still
send its commands while DSI is in video mode? If so, I think the same
early return can happen there.

Thanks,
Zi-Hao

  reply	other threads:[~2026-11-19  3:36 UTC|newest]

Thread overview: 5+ 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 (胡俊光)
2026-11-19  3:36     ` Zi-Hao Huang [this message]
2026-11-24  0:31       ` Ryan Brue

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=20261119033634.1844084-1-zi-hao.huang@mediatek.com \
    --to=zi-hao.huang@mediatek.com \
    --cc=airlied@gmail.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=chunkuang.hu@kernel.org \
    --cc=ck.hu@mediatek.com \
    --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®