fix(kernel/rockchip64-7.0): restore SysRq-via-BREAK on dw-apb-uart (8250_dw)#9750
Conversation
…250_dw) Sending a serial BREAK followed by a SysRq command character stopped working on dw-apb-uart (e.g. RK3399 / helios64) in linux-7.0.y. The refactor that introduced the regression replaced the explicit uart_unlock_and_check_sysrq_irqrestore() in serial8250_handle_irq() with a guard(uart_port_lock_irqsave) scope. The guard releases the port lock at scope exit, but does NOT check port->sysrq_ch and therefore never calls handle_sysrq(). Other 8250-family drivers (amba-pl011, meson_uart, msm_serial, ...) each call uart_unlock_and_check_sysrq() explicitly in their IRQ handler; 8250_dw relied on serial8250_handle_irq() doing it for it. Fix: in dw8250_handle_irq() replace the guard() with explicit uart_port_lock_irqsave() + uart_unlock_and_check_sysrq_irqrestore() on the normal exit path; early-exit paths (UART_IIR_NO_INT / UART_IIR_BUSY) get plain uart_port_unlock_irqrestore() since they do not process RX chars. The same fix is applied to serial8250_handle_irq() as defence-in-depth for any other caller that goes through it. Verified on helios64 (RK3399, dw-apb-uart, ttyS2 @ 1.5 Mbaud): BREAK + 'h' on the picocom serial console produces the expected 'sysrq: HELP : ...' line from the kernel. Assisted-by: Claude:claude-opus-4-7
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis patch fixes a SysRq BREAK handling regression in Linux 7.0's ChangesSysRq BREAK Handling Fix in UART IRQ Handlers
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.Comment |
|
✅ This PR has been reviewed and approved — all set for merge! |
The mvebu kernel uses the same dw-apb-uart driver (drivers/tty/serial/8250/8250_dw.c) on Armada 388 / 38x SoCs as RK3399 does, and inherits the same SysRq-via-BREAK regression introduced by the guard(uart_port_lock_irqsave) refactor that PR #9750 fixes for kernel-rockchip64-7.0. Verified on helios4 (Armada 388, kernel-mvebu 6.18-edge) 2026-05-05: - Without patch: BREAK + 'h' through picocom is consumed by the IRQ handler (port->sysrq_ch is latched correctly), but uart_unlock_and_check_sysrq_irqrestore() is never called from the handler tail, so handle_sysrq() never runs. - With patch: BREAK + 'h' produces 'sysrq: HELP : ...' on the serial console (after raising console_loglevel above the boot-default 1). - Diagnostic trace_printk patch (local userpatches, not part of this PR) confirmed that has_sysrq=1, sysrq_armed=jiffies+5HZ after BREAK, sysrq_ch=104 ('h'=0x68) after the next char — i.e. all preconditions for handle_sysrq() are met, the only thing missing was the call site, which this patch restores. This is a verbatim copy of the rockchip64-7.0 patch (PR #9750) into patch/kernel/archive/mvebu-6.18/. Hunk context matches, applies cleanly. Per-board impact is identical to the original PR #9750: any mvebu board whose serial console is dw-apb-uart-derived (Armada 38x family — helios4, espressobin, clearfog, etc.) gets working sysrq via BREAK back. Companion to PR #9750 (rockchip64-7.0). No upstream submission planned (per maintainer decision in #9750 thread). Assisted-by: Claude:claude-opus-4.7 Signed-off-by: Igor Velkov <325961+iav@users.noreply.github.com>
The mvebu kernel uses the same dw-apb-uart driver (drivers/tty/serial/8250/8250_dw.c) on Armada 388 / 38x SoCs as RK3399 does, and inherits the same SysRq-via-BREAK regression introduced by the guard(uart_port_lock_irqsave) refactor that PR #9750 fixes for kernel-rockchip64-7.0. Verified on helios4 (Armada 388, kernel-mvebu 6.18-edge) 2026-05-05: - Without patch: BREAK + 'h' through picocom is consumed by the IRQ handler (port->sysrq_ch is latched correctly), but uart_unlock_and_check_sysrq_irqrestore() is never called from the handler tail, so handle_sysrq() never runs. - With patch: BREAK + 'h' produces 'sysrq: HELP : ...' on the serial console (after raising console_loglevel above the boot-default 1). - Diagnostic trace_printk patch (local userpatches, not part of this PR) confirmed that has_sysrq=1, sysrq_armed=jiffies+5HZ after BREAK, sysrq_ch=104 ('h'=0x68) after the next char — i.e. all preconditions for handle_sysrq() are met, the only thing missing was the call site, which this patch restores. This is a verbatim copy of the rockchip64-7.0 patch (PR #9750) into patch/kernel/archive/mvebu-6.18/. Hunk context matches, applies cleanly. Per-board impact is identical to the original PR #9750: any mvebu board whose serial console is dw-apb-uart-derived (Armada 38x family — helios4, espressobin, clearfog, etc.) gets working sysrq via BREAK back. Companion to PR #9750 (rockchip64-7.0). No upstream submission planned (per maintainer decision in #9750 thread). Assisted-by: Claude:claude-opus-4.7 Signed-off-by: Igor Velkov <325961+iav@users.noreply.github.com>
The mvebu kernel uses the same dw-apb-uart driver (drivers/tty/serial/8250/8250_dw.c) on Armada 388 / 38x SoCs as RK3399 does, and inherits the same SysRq-via-BREAK regression introduced by the guard(uart_port_lock_irqsave) refactor that PR #9750 fixes for kernel-rockchip64-7.0. Verified on helios4 (Armada 388, kernel-mvebu 6.18-edge) 2026-05-05: - Without patch: BREAK + 'h' through picocom is consumed by the IRQ handler (port->sysrq_ch is latched correctly), but uart_unlock_and_check_sysrq_irqrestore() is never called from the handler tail, so handle_sysrq() never runs. - With patch: BREAK + 'h' produces 'sysrq: HELP : ...' on the serial console (after raising console_loglevel above the boot-default 1). - Diagnostic trace_printk patch (local userpatches, not part of this PR) confirmed that has_sysrq=1, sysrq_armed=jiffies+5HZ after BREAK, sysrq_ch=104 ('h'=0x68) after the next char — i.e. all preconditions for handle_sysrq() are met, the only thing missing was the call site, which this patch restores. This is a verbatim copy of the rockchip64-7.0 patch (PR #9750) into patch/kernel/archive/mvebu-6.18/. Hunk context matches, applies cleanly. Per-board impact is identical to the original PR #9750: any mvebu board whose serial console is dw-apb-uart-derived (Armada 38x family — helios4, espressobin, clearfog, etc.) gets working sysrq via BREAK back. Companion to PR #9750 (rockchip64-7.0). No upstream submission planned (per maintainer decision in #9750 thread). Assisted-by: Claude:claude-opus-4.7 Signed-off-by: Igor Velkov <325961+iav@users.noreply.github.com>
Summary
8324a54f604d"serial: 8250: Add serial8250_handle_irq_locked()" (PATCH v2 4/7) and883c5a2bc934"serial: 8250_dw: Rework dw8250_handle_irq() locking and IIR handling" (PATCH v2 5/7) by Ilpo Järvinen, both in thetty-7.0-rc5pull (merged46d5c838344); they replaced the explicituart_unlock_and_check_sysrq_irqrestore()call with aguard(uart_port_lock_irqsave)scope. The guard releases the port lock at scope exit but never checksport->sysrq_ch, sohandle_sysrq()is no longer called.amba-pl011,meson_uart,msm_serial, …) calluart_unlock_and_check_sysrq()explicitly;8250_dwrelied onserial8250_handle_irq()doing it for it. The fix restores that call on both paths.Cc: stable, so the regression also reaches v6.19.10 in the 6.19.y series.patch/kernel/archive/rockchip64-7.0/— no build-framework or extension changes.Test plan
C-a C-\(BREAK) followed byhproducessysrq: HELP : …from the kernel.Summary by CodeRabbit