Re: [BUG][2.6.8.1] serial driver hangs SMP kernel, but not the UPkernel

From: Paul Fulghum
Date: Fri Oct 29 2004 - 16:41:35 EST


On Fri, 2004-10-29 at 14:55, Tim_T_Murphy@xxxxxxxx wrote:
> Oct 29 13:34:48 racjag-1 chat[3886]: expect (CLIENTSERVER)
> Oct 29 13:34:48 racjag-1 kernel: drivers/serial/serial_core.c:102: spin_lock(drivers/serial/serial_core.c:023f2548) already locked by drivers/serial/8250.c/1015
> Oct 29 13:34:48 racjag-1 kernel: drivers/serial/8250.c:1017: spin_unlock(drivers/serial/serial_core.c:023f2548) not locked
> Oct 29 13:34:48 racjag-1 chat[3886]: CLIENTSERVER

One way this can happen is a receive interrupt:

serial8250_interrupt();
spin_lock(port->lock);
serial8250_handle_port();
receive_chars();
flip.work.func(); /* if FLIP buffer full */
ldisc->receive_buf(); /* N_TTY */
tty->driver->flush_chars();
uart_start();
spin_lock(port->lock); *BANG*

Try the attached patch and report what happens.

--
Paul Fulghum
paulkf@xxxxxxxxxxxxx

--- linux-2.6.8/drivers/serial/8250.c 2004-08-14 00:36:13.000000000 -0500
+++ b/drivers/serial/8250.c 2004-10-29 15:58:28.076014336 -0500
@@ -830,9 +830,13 @@ receive_chars(struct uart_8250_port *up,

do {
if (unlikely(tty->flip.count >= TTY_FLIPBUF_SIZE)) {
- tty->flip.work.func((void *)tty);
- if (tty->flip.count >= TTY_FLIPBUF_SIZE)
- return; // if TTY_DONT_FLIP is set
+ /* no room in flip buffer, discard rx FIFO contents to clear IRQ */
+ do {
+ serial_inp(up, UART_RX);
+ up->port.icount.overrun++;
+ *status = serial_inp(up, UART_LSR);
+ } while ((*status & UART_LSR_DR) && (max_count-- > 0));
+ return; /* if TTY_DONT_FLIP is set */
}
ch = serial_inp(up, UART_RX);
*tty->flip.char_buf_ptr = ch;


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/