[PATCH 1/2] tty: serial: imx: console write routing is unsafe on SMP

Shawn Guo shawn.guo at linaro.org
Mon Aug 27 18:33:05 EDT 2012


On Mon, Aug 27, 2012 at 09:36:51AM +0200, Dirk Behme wrote:
> From: Xinyu Chen <xinyu.chen at freescale.com>
> 
> The console feature's write routing is unsafe on SMP with
> the startup/shutdown call.
> 
> There could be several 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.
> 
> Add a spin_lock for startup/shutdown/console_write routing.
> 
> This patch is a port from Freescale's Android kernel.
> 
> Signed-off-by: Xinyu Chen <xinyu.chen at freescale.com>
> Tested-by: Dirk Behme <dirk.behme at de.bosch.com>
> CC: Shawn Guo <shawn.guo at linaro.org>
> CC: Sascha Hauer <s.hauer at pengutronix.de>

Acked-by: Shawn Guo <shawn.guo at linaro.org>



More information about the linux-arm-kernel mailing list