Re: [PATCH v2] drm/mediatek: dsi: Don't let a signal cut the IRQ wait short

From: Zi-Hao Huang

Date: Wed Nov 18 2026 - 22:36:56 EST


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