Skip to contentSkip to conversation

Patch "serial: 8250_port: Remove dangerous pr_debug()" has been added to the 4.9-stable tree

PATCH [email protected] 1 participant 1 message Oct 5, 2017

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

serial: 8250_port: Remove dangerous pr_debug()

to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
serial-8250_port-remove-dangerous-pr_debug.patch
and it can be found in the queue-4.9 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From foo@baz Thu Oct 5 10:28:31 CEST 2017

From: Alexey Brodkin <[email protected]>
Date: Tue, 10 Jan 2017 18:11:29 +0300
Subject: serial: 8250_port: Remove dangerous pr_debug()

From: Alexey Brodkin <[email protected]>

[ Upstream commit 699a11ba7ec869b006623182881f2f1f5b4aea53 ]

With CONFIG_DYNAMIC_DEBUG if dyndbg enables debug output in 8250_port.c deadlock happens inevitably on UART IRQ handling.

That's the problematic execution path:
---------------------------->8------------------------ UART IRQ:
serial8250_interrupt() ->

    serial8250_handle_irq(): lock "port->lock" ->
      pr_debug() ->
        serial8250_console_write(): bump in locked "port->lock".

      OR (if above pr_debug() gets removed):
      serial8250_tx_chars() ->
        pr_debug() ->
          serial8250_console_write(): bump in locked "port->lock".

---------------------------->8------------------------

So let's get rid of those not that much useful debug entries.

Discussed problem could be easily reproduced with QEMU for x86_64. As well as this fix could be mimicked with muting of dynamic debug for the problematic lines as simple as:
---------------------------->8------------------------ dyndbg="+p; file 8250_port.c line 1756 -p; file 8250_port.c line 1822 -p" ---------------------------->8------------------------

Cc Jiri Slaby <[email protected]>
Cc Peter Hurley <[email protected]>
Cc Phillip Raffeck <[email protected]>
Cc Anton Wuerfel <[email protected]>
Cc "Matwey V. Kornilov" <[email protected]>
Cc Yegor Yefremov <[email protected]>
Cc Thor Thayer <[email protected]>
---
 drivers/tty/serial/8250/8250_port.c |    4 ----
 1 file changed, 4 deletions(-)
drivers/tty/serial/8250/8250_port.c +0 -4
@@ -1751,8 +1751,6 @@ void serial8250_tx_chars(struct uart_825
 	if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
 		uart_write_wakeup(port);
 
-	pr_debug("%s: THRE\n", __func__);
-
 	/*
 	 * With RPM enabled, we have to wait until the FIFO is empty before the
 	 * HW can go idle. So we get here once again with empty FIFO and disable
@@ -1817,8 +1815,6 @@ int serial8250_handle_irq(struct uart_po
 
 	status = serial_port_in(port, UART_LSR);
 
-	pr_debug("%s: status = %x\n", __func__, status);
-
 	if (status & (UART_LSR_DR | UART_LSR_BI)) {
 		if (!up->dma || handle_rx_dma(up, iir))
 			status = serial8250_rx_chars(up, status);

Patches currently in stable-queue which might be from [email protected] are

queue-4.9/serial-8250_port-remove-dangerous-pr_debug.patch