• Qipan Li's avatar
    serial: sirf: fix spinlock deadlock issue · 07d410e0
    Qipan Li authored
    commit fb78b811 provide a workaround for
    kernel panic, but bring potential deadlock risk. that is in
    sirfsoc_rx_tmo_process_tl while enter into sirfsoc_uart_pio_rx_chars
    cpu hold uart_port->lock, if uart interrupt comes cpu enter into
    sirfsoc_uart_isr and deadlock occurs in getting uart_port->lock.
    
    the patch replace spin_lock version to spin_lock_irq* version to avoid
    spinlock dead lock issue. let function tty_flip_buffer_push in tasklet
    outof spin_lock_irq* protect area to avoid add the pair of spin_lock and
    spin_unlock for tty_flip_buffer_push.
    BTW drop self defined unused spinlock protect of tx_lock/rx_lock.
    
    56274.220464] BUG: spinlock lockup suspected on CPU#0, swapper/0/0
    [56274.223648]  lock: 0xc05d9db0, .magic: dead4ead, .owner: swapper/0/0,
    	.owner_cpu: 0
    	[56274.231278] CPU: 0 PID: 0 Comm: swapper/0 Tainted: G
    	O 3.10.35 #1
    	[56274.238241] [<c0015530>] (unwind_backtrace+0x0/0xf4) from
    	[<c00120d8>] (show_stack+0x10/0x14)
    	[56274.246742] [<c00120d8>] (show_stack+0x10/0x14) from
    	[<c01b11b0>] (do_raw_spin_lock+0x110/0x184)
    	[56274.255501] [<c01b11b0>] (do_raw_spin_lock+0x110/0x184) from
    	[<c02124c8>] (sirfsoc_uart_isr+0x20/0x42c)
    	[56274.264874] [<c02124c8>] (sirfsoc_uart_isr+0x20/0x42c) from
    	[<c0075790>] (handle_irq_event_percpu+0x54/0x17c)
    	[56274.274758] [<c0075790>] (handle_irq_event_percpu+0x54/0x17c)
    	from [<c00758f4>] (handle_irq_event+0x3c/0x5c)
    	[56274.284561] [<c00758f4>] (handle_irq_event+0x3c/0x5c) from
    	[<c0077fa0>] (handle_level_irq+0x98/0xfc)
    	[56274.293670] [<c0077fa0>] (handle_level_irq+0x98/0xfc) from
    	[<c0074f44>] (generic_handle_irq+0x2c/0x3c)
    	[56274.302952] [<c0074f44>] (generic_handle_irq+0x2c/0x3c) from
    	[<c000ef80>] (handle_IRQ+0x40/0x90)
    	[56274.311706] [<c000ef80>] (handle_IRQ+0x40/0x90) from
    	[<c000dc80>] (__irq_svc+0x40/0x70)
    	[56274.319697] [<c000dc80>] (__irq_svc+0x40/0x70) from
    	[<c038113c>] (_raw_spin_unlock_irqrestore+0x10/0x48)
    	[56274.329158] [<c038113c>]
    	(_raw_spin_unlock_irqrestore+0x10/0x48) from [<c0200034>]
    	(tty_port_tty_get+0x58/0x90)
    	[56274.339213] [<c0200034>] (tty_port_tty_get+0x58/0x90) from
    	[<c0212008>] (sirfsoc_uart_pio_rx_chars+0x1c/0xc8)
    	[56274.349097] [<c0212008>]
    	(sirfsoc_uart_pio_rx_chars+0x1c/0xc8) from [<c0212ef8>]
    	(sirfsoc_rx_tmo_process_tl+0xe4/0x1fc)
    	[56274.359853] [<c0212ef8>]
    	(sirfsoc_rx_tmo_process_tl+0xe4/0x1fc) from [<c0027c04>]
    	(tasklet_action+0x84/0x114)
    	[56274.369739] [<c0027c04>] (tasklet_action+0x84/0x114) from
    	[<c0027db4>] (__do_softirq+0x120/0x200)
    	[56274.378585] [<c0027db4>] (__do_softirq+0x120/0x200) from
    	[<c0027f44>] (do_softirq+0x54/0x5c)
    	[56274.386998] [<c0027f44>] (do_softirq+0x54/0x5c) from
    	[<c00281ec>] (irq_exit+0x9c/0xd0)
    	[56274.394899] [<c00281ec>] (irq_exit+0x9c/0xd0) from
    	[<c000ef84>] (handle_IRQ+0x44/0x90)
    	[56274.402790] [<c000ef84>] (handle_IRQ+0x44/0x90) from
    	[<c000dc80>] (__irq_svc+0x40/0x70)
    	[56274.410774] [<c000dc80>] (__irq_svc+0x40/0x70) from
    	[<c0288af4>] (cpuidle_enter_state+0x50/0xe0)
    	[56274.419532] [<c0288af4>] (cpuidle_enter_state+0x50/0xe0) from
    	[<c0288c34>] (cpuidle_idle_call+0xb0/0x148)
    	[56274.429080] [<c0288c34>] (cpuidle_idle_call+0xb0/0x148) from
    	[<c000f3ac>] (arch_cpu_idle+0x8/0x38)
    	[56274.438016] [<c000f3ac>] (arch_cpu_idle+0x8/0x38) from
    	[<c0059344>] (cpu_startup_entry+0xfc/0x140)
    	[56274.446956] [<c0059344>] (cpu_startup_entry+0xfc/0x140) from
    	[<c04a3a54>] (start_kernel+0x2d8/0x2e4)
    Signed-off-by: default avatarQipan Li <Qipan.Li@csr.com>
    Signed-off-by: default avatarBarry Song <Baohua.Song@csr.com>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    07d410e0
sirfsoc_uart.c 47.1 KB