linux-stable/include
Huang Shijie 879eb9c3f9 tty_ldisc: add more limits to the @write_wakeup
In the uart_handle_cts_change(), uart_write_wakeup() is called after
we call @uart_port->ops->start_tx().

The Documentation/serial/driver tells us:
-----------------------------------------------
  start_tx(port)
	Start transmitting characters.

	Locking: port->lock taken.
	Interrupts: locally disabled.
-----------------------------------------------

So when the uart_write_wakeup() is called, the port->lock is taken by
the upper. See the following callstack:

	|_ uart_write_wakeup
	   |_ tty_wakeup
	      |_ ld->ops->write_wakeup

With the port->lock held, we call the @write_wakeup. Some implemetation of
the @write_wakeup does not notice that the port->lock is held, and it still
tries to send data with uart_write() which will try to grab the prot->lock.
A dead lock occurs, see the following log caught in the Bluetooth by uart:

--------------------------------------------------------------------
BUG: spinlock lockup suspected on CPU#0, swapper/0/0
 lock: 0xdc3f4410, .magic: dead4ead, .owner: swapper/0/0, .owner_cpu: 0
CPU: 0 PID: 0 Comm: swapper/0 Tainted: G        W    3.10.17-16839-ge4a1bef #1320
[<80014cbc>] (unwind_backtrace+0x0/0x138) from [<8001251c>] (show_stack+0x10/0x14)
[<8001251c>] (show_stack+0x10/0x14) from [<802816ac>] (do_raw_spin_lock+0x108/0x184)
[<802816ac>] (do_raw_spin_lock+0x108/0x184) from [<806a22b0>] (_raw_spin_lock_irqsave+0x54/0x60)
[<806a22b0>] (_raw_spin_lock_irqsave+0x54/0x60) from [<802f5754>] (uart_write+0x38/0xe0)
[<802f5754>] (uart_write+0x38/0xe0) from [<80455270>] (hci_uart_tx_wakeup+0xa4/0x168)
[<80455270>] (hci_uart_tx_wakeup+0xa4/0x168) from [<802dab18>] (tty_wakeup+0x50/0x5c)
[<802dab18>] (tty_wakeup+0x50/0x5c) from [<802f81a4>] (imx_rtsint+0x50/0x80)
[<802f81a4>] (imx_rtsint+0x50/0x80) from [<802f88f4>] (imx_int+0x158/0x17c)
[<802f88f4>] (imx_int+0x158/0x17c) from [<8007abe0>] (handle_irq_event_percpu+0x50/0x194)
[<8007abe0>] (handle_irq_event_percpu+0x50/0x194) from [<8007ad60>] (handle_irq_event+0x3c/0x5c)
--------------------------------------------------------------------

This patch adds more limits to the @write_wakeup, the one who wants to
implemet the @write_wakeup should follow the limits which avoid the deadlock.

Signed-off-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-04-24 16:16:33 -07:00
..
acpi IOMMU Upates for Linux v3.15 2014-04-05 18:46:26 -07:00
asm-generic mm: use paravirt friendly ops for NUMA hinting ptes 2014-04-18 16:40:09 -07:00
clocksource
crypto crypto: export NULL algorithms defines 2014-03-21 21:54:26 +08:00
drm Merge branch 'drm-next-3.15-wip' of git://people.freedesktop.org/~deathsimple/linux into drm-next 2014-04-19 11:16:02 +10:00
dt-bindings The clock framework changes for 3.15 look similar to past pull requests. 2014-04-05 18:39:18 -07:00
keys
kvm
linux tty_ldisc: add more limits to the @write_wakeup 2014-04-24 16:16:33 -07:00
math-emu
media [media] rc-core: remove generic scancode filter 2014-04-06 11:30:29 -03:00
memory
misc
net net: sctp: cache auth_enable per endpoint 2014-04-18 18:32:00 -04:00
pcmcia
ras
rdma Merge branches 'core', 'cxgb4', 'ip-roce', 'iser', 'misc', 'mlx4', 'nes', 'ocrdma', 'qib', 'sgwrapper', 'srp' and 'usnic' into for-next 2014-04-03 08:30:17 -07:00
rxrpc
scsi scsi: Make sure cmd_flags are 64-bit 2014-04-09 20:26:20 -06:00
sound ALSA: cs8427: separate HW initialization 2014-04-03 14:59:48 +02:00
target target/sbc: Add sbc_dif_read_strip software emulation 2014-04-07 01:48:57 -07:00
trace This includes the final patch to clean up and fix the issue with the 2014-04-12 13:06:10 -07:00
uapi Merge branch 'drm-fixes' of git://people.freedesktop.org/~airlied/linux 2014-04-19 10:35:30 -07:00
video fbdev changes for 3.15 (OMAP) 2014-04-07 10:47:51 -07:00
xen
Kbuild