ARM: fiq_debugger: lock between tty and console writes
authorColin Cross <ccross@android.com>
Thu, 1 Nov 2012 00:41:39 +0000 (17:41 -0700)
committerArve Hjønnevåg <arve@android.com>
Mon, 1 Jul 2013 21:16:13 +0000 (14:16 -0700)
commit03a7e10237e9260411bfcbbd2e2730486e4bcd9e
treea4826032e25c67406e4d05ead874fc6464a242b5
parent2246f69d08be0ef64089718f1a3cdcf14b34a288
ARM: fiq_debugger: lock between tty and console writes

debug_console_write calls debug_uart_flush, which will usually wait
until the serial port fifo empties.  If another thread is continuously
calling fiq_tty_write, the fifo will constantly be refilled and
debug_uart_flush might never return.

Add a spinlock that is locked in debug_console_write and fiq_tty_write
to ensure they can't run at the same time.  This has an extra advantage
of preventing lines from the console and tty from being mixed together.

Also reduce the size returned by fiq_tty_write_room to keep the time
spent with the spinlock held to a reasonable value.

In addition, make sure fiq context can't loop forever by never calling
debug_uart_flush when the console is enabled.

Change-Id: I5712b01f740ca0c84f680d2032c9fa16b7656939
Signed-off-by: Colin Cross <ccross@android.com>
arch/arm/common/fiq_debugger.c