From 7a6fbc9a887193a1e9f8658703881c528040afbc Mon Sep 17 00:00:00 2001 From: Alexander Shiyan Date: Tue, 27 Mar 2012 12:22:49 +0400 Subject: ARM: clps711x: serial driver hungs are a result of call disable_irq within ISR Since 2.6.30-rc1 clps711x serial driver hungs system. This is a result of call disable_irq from ISR. synchronize_irq waits for end of interrupt and goes to infinite loop. This patch fix this problem. Signed-off-by: Alexander Shiyan Cc: stable Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/clps711x.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'drivers/tty') diff --git a/drivers/tty/serial/clps711x.c b/drivers/tty/serial/clps711x.c index e6c3dbd..836fe273 100644 --- a/drivers/tty/serial/clps711x.c +++ b/drivers/tty/serial/clps711x.c @@ -154,10 +154,9 @@ static irqreturn_t clps711xuart_int_tx(int irq, void *dev_id) port->x_char = 0; return IRQ_HANDLED; } - if (uart_circ_empty(xmit) || uart_tx_stopped(port)) { - clps711xuart_stop_tx(port); - return IRQ_HANDLED; - } + + if (uart_circ_empty(xmit) || uart_tx_stopped(port)) + goto disable_tx_irq; count = port->fifosize >> 1; do { @@ -171,8 +170,11 @@ static irqreturn_t clps711xuart_int_tx(int irq, void *dev_id) if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) uart_write_wakeup(port); - if (uart_circ_empty(xmit)) - clps711xuart_stop_tx(port); + if (uart_circ_empty(xmit)) { + disable_tx_irq: + disable_irq_nosync(TX_IRQ(port)); + tx_enabled(port) = 0; + } return IRQ_HANDLED; } -- cgit v1.1 From af6d17cdc8c89aeb3101f0d27cd32fc0592b40b2 Mon Sep 17 00:00:00 2001 From: Tomoya MORINAGA Date: Thu, 12 Apr 2012 10:47:50 +0900 Subject: pch_uart: Fix dma channel unallocated issue This driver anticipates pch_uart_verify_port() is not called during installation. However, actually pch_uart_verify_port() is called during installation. As a result, memory access violation occurs like below. 0. initial value: use_dma=0 1. starup() - dma channel is not allocated because use_dma=0 2. pch_uart_verify_port() - Set use_dma=1 3. UART processing acts DMA mode because use_dma=1 - memory access violation occurs! This patch fixes the issue. Solution: Whenever pch_uart_verify_port() is called and then dma channel is not allocated, the channel should be allocated. Signed-off-by: Tomoya MORINAGA Cc: stable Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/pch_uart.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'drivers/tty') diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c index bbbec4a..c2816f4 100644 --- a/drivers/tty/serial/pch_uart.c +++ b/drivers/tty/serial/pch_uart.c @@ -1447,9 +1447,11 @@ static int pch_uart_verify_port(struct uart_port *port, __func__); return -EOPNOTSUPP; #endif - priv->use_dma = 1; priv->use_dma_flag = 1; dev_info(priv->port.dev, "PCH UART : Use DMA Mode\n"); + if (!priv->use_dma) + pch_request_dma(port); + priv->use_dma = 1; } return 0; -- cgit v1.1 From d3a7b83f865b46bb7b5e1ed18a129ce1af349db4 Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Thu, 19 Apr 2012 18:12:40 +0200 Subject: drivers/tty/amiserial.c: add missing tty_unlock tty_unlock is used on all other exits from the function. Signed-off-by: Julia Lawall Acked-by: Jiri Slaby Cc: stable Signed-off-by: Greg Kroah-Hartman --- drivers/tty/amiserial.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'drivers/tty') diff --git a/drivers/tty/amiserial.c b/drivers/tty/amiserial.c index 24145c3..6cc4358 100644 --- a/drivers/tty/amiserial.c +++ b/drivers/tty/amiserial.c @@ -1073,8 +1073,10 @@ static int set_serial_info(struct tty_struct *tty, struct serial_state *state, (new_serial.close_delay != port->close_delay) || (new_serial.xmit_fifo_size != state->xmit_fifo_size) || ((new_serial.flags & ~ASYNC_USR_MASK) != - (port->flags & ~ASYNC_USR_MASK))) + (port->flags & ~ASYNC_USR_MASK))) { + tty_unlock(); return -EPERM; + } port->flags = ((port->flags & ~ASYNC_USR_MASK) | (new_serial.flags & ASYNC_USR_MASK)); state->custom_divisor = new_serial.custom_divisor; -- cgit v1.1 From 810b4de25e53459323ff48957b0162b48d6cbd57 Mon Sep 17 00:00:00 2001 From: Larry Finger Date: Sat, 28 Apr 2012 18:53:49 -0500 Subject: tty/serial/pmac_zilog: Fix "nobody cared" IRQ message Following commit a79dd5a titled "tty/serial/pmac_zilog: Fix suspend & resume", my Powerbook G4 Titanium showed the following stack dump: [ 36.878225] irq 23: nobody cared (try booting with the "irqpoll" option) [ 36.878251] Call Trace: [ 36.878291] [dfff3f00] [c000984c] show_stack+0x7c/0x194 (unreliable) [ 36.878322] [dfff3f40] [c00a6868] __report_bad_irq+0x44/0xf4 [ 36.878339] [dfff3f60] [c00a6b04] note_interrupt+0x1ec/0x2ac [ 36.878356] [dfff3f80] [c00a48d0] handle_irq_event_percpu+0x250/0x2b8 [ 36.878372] [dfff3fd0] [c00a496c] handle_irq_event+0x34/0x54 [ 36.878389] [dfff3fe0] [c00a753c] handle_fasteoi_irq+0xb4/0x124 [ 36.878412] [dfff3ff0] [c000f5bc] call_handle_irq+0x18/0x28 [ 36.878428] [deef1f10] [c000719c] do_IRQ+0x114/0x1cc [ 36.878446] [deef1f40] [c0015868] ret_from_except+0x0/0x1c [ 36.878484] --- Exception: 501 at 0xf497610 [ 36.878489] LR = 0xfdc3dd0 [ 36.878497] handlers: [ 36.878510] [] pmz_interrupt [ 36.878520] Disabling IRQ #23 From an E-mail exchange about this problem, Andreas Schwab noticed a typo that resulted in the wrong condition being tested. The patch also corrects 2 typos that incorrectly report why an error branch is being taken. Signed-off-by: Larry Finger Signed-off-by: Benjamin Herrenschmidt --- drivers/tty/serial/pmac_zilog.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/tty') diff --git a/drivers/tty/serial/pmac_zilog.c b/drivers/tty/serial/pmac_zilog.c index 08ebe90..654755a 100644 --- a/drivers/tty/serial/pmac_zilog.c +++ b/drivers/tty/serial/pmac_zilog.c @@ -469,7 +469,7 @@ static irqreturn_t pmz_interrupt(int irq, void *dev_id) tty = NULL; if (r3 & (CHAEXT | CHATxIP | CHARxIP)) { if (!ZS_IS_OPEN(uap_a)) { - pmz_debug("ChanA interrupt while open !\n"); + pmz_debug("ChanA interrupt while not open !\n"); goto skip_a; } write_zsreg(uap_a, R0, RES_H_IUS); @@ -493,8 +493,8 @@ static irqreturn_t pmz_interrupt(int irq, void *dev_id) spin_lock(&uap_b->port.lock); tty = NULL; if (r3 & (CHBEXT | CHBTxIP | CHBRxIP)) { - if (!ZS_IS_OPEN(uap_a)) { - pmz_debug("ChanB interrupt while open !\n"); + if (!ZS_IS_OPEN(uap_b)) { + pmz_debug("ChanB interrupt while not open !\n"); goto skip_b; } write_zsreg(uap_b, R0, RES_H_IUS); -- cgit v1.1 From 84f904ecd3aa2ccb5779b815b69c1cb592f07bb5 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Tue, 1 May 2012 16:12:19 +0100 Subject: vt: Fix deadlock on scroll-lock Fixing the locking accidentally replaced a race in the scroll lock handling with a deadlock. Turn it back into a race for now. The basic problem is that there are two paths into the tty stop/start helpers. One via the tty layer ^S/^Q handling where we need to take the kbd_event_lock and one via the special keyboard handler for fn_hold where we already hold it. Probably we need to split out into a separate LED lock but for now just go back to the race as it's a bit close to release. Reported-by: Clemens Ladisch Cc: Jiri Kosina Signed-off-by: Alan Cox Signed-off-by: Greg Kroah-Hartman --- drivers/tty/vt/keyboard.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) (limited to 'drivers/tty') diff --git a/drivers/tty/vt/keyboard.c b/drivers/tty/vt/keyboard.c index 86dd1e3..29ca20d 100644 --- a/drivers/tty/vt/keyboard.c +++ b/drivers/tty/vt/keyboard.c @@ -1085,15 +1085,21 @@ void vt_set_led_state(int console, int leds) * * Handle console start. This is a wrapper for the VT layer * so that we can keep kbd knowledge internal + * + * FIXME: We eventually need to hold the kbd lock here to protect + * the LED updating. We can't do it yet because fn_hold calls stop_tty + * and start_tty under the kbd_event_lock, while normal tty paths + * don't hold the lock. We probably need to split out an LED lock + * but not during an -rc release! */ void vt_kbd_con_start(int console) { struct kbd_struct * kbd = kbd_table + console; - unsigned long flags; - spin_lock_irqsave(&kbd_event_lock, flags); +/* unsigned long flags; */ +/* spin_lock_irqsave(&kbd_event_lock, flags); */ clr_vc_kbd_led(kbd, VC_SCROLLOCK); set_leds(); - spin_unlock_irqrestore(&kbd_event_lock, flags); +/* spin_unlock_irqrestore(&kbd_event_lock, flags); */ } /** @@ -1102,22 +1108,28 @@ void vt_kbd_con_start(int console) * * Handle console stop. This is a wrapper for the VT layer * so that we can keep kbd knowledge internal + * + * FIXME: We eventually need to hold the kbd lock here to protect + * the LED updating. We can't do it yet because fn_hold calls stop_tty + * and start_tty under the kbd_event_lock, while normal tty paths + * don't hold the lock. We probably need to split out an LED lock + * but not during an -rc release! */ void vt_kbd_con_stop(int console) { struct kbd_struct * kbd = kbd_table + console; - unsigned long flags; - spin_lock_irqsave(&kbd_event_lock, flags); +/* unsigned long flags; */ +/* spin_lock_irqsave(&kbd_event_lock, flags); */ set_vc_kbd_led(kbd, VC_SCROLLOCK); set_leds(); - spin_unlock_irqrestore(&kbd_event_lock, flags); +/* spin_unlock_irqrestore(&kbd_event_lock, flags); */ } /* * This is the tasklet that updates LED state on all keyboards * attached to the box. The reason we use tasklet is that we * need to handle the scenario when keyboard handler is not - * registered yet but we already getting updates form VT to + * registered yet but we already getting updates from the VT to * update led state. */ static void kbd_bh(unsigned long dummy) -- cgit v1.1