]> git.karo-electronics.de Git - karo-tx-linux.git/commit
ENGR00163703 uart: console write routing is unsafe on SMP
authorXinyu Chen <xinyu.chen@freescale.com>
Fri, 2 Dec 2011 06:38:21 +0000 (14:38 +0800)
committerLothar Waßmann <LW@KARO-electronics.de>
Fri, 24 May 2013 06:33:33 +0000 (08:33 +0200)
commite4b3ccb5426bec41cd5ecf6ad3f655e9b8cb000f
tree1845dca43f43d01978313ac33e0f75eb1fb9c297
parent19723b569423a342da849822463b5713e2c5b47f
ENGR00163703 uart: console write routing is unsafe on SMP

The console feature's write routing is unsafe on SMP with
the startup/shutdown call. It happend to cause Android bootup
without shell runnable.

Actually on Android boot, there's 3 consumers of the console
* the kernel printk
* the init process using /dev/kmsg to call printk to show log
* shell, which open /dev/console and write with sys_write()

The shell goes into the normal uart open/write routing,
but the other two go into the console operations.
The open routing calls imx serial startup, which will write USR1/2
register without any lock and critical with imx_console_write call.

Here add spin_lock for startup/shutdown/console_write routing.
Remove the imx_setup_ufcr() call on startup when CONSOLE enabled,
as this will cause clock reinit, and output garbage.

Signed-off-by: Xinyu Chen <xinyu.chen@freescale.com>
drivers/tty/serial/imx.c