Hello Folks, I am using Linux kernel 3.18.y on board based on I.MX28 processor. While initializing Application Uart0 (2 Pin) for the first time after kernel boots, it always endup in below kernel assertion message. This affects initializing application that uses other Uarts. DTS Snap: auart0: serial@8006a000 { pinctrl-names = "default"; pinctrl-0 = <&auart0_2pins_a>; status = "okay"; }; Kernel Message on Console: ---------------------------------------- root@imx28evk:~# [ 29.336529] ------------[ cut here ]------------ [ 29.341262] WARNING: CPU: 0 PID: 296 at /home/ankur/linux/drivers/tty/serial/serial_core.c:2793 uart_handle_cts_change+0xbc/0xd8() [ 29.360310] Modules linked in: [ 29.363410] CPU: 0 PID: 296 Comm: zigbeemfg Not tainted 3.18.12-hpc_1.0 #35 [ 29.370445] [<c000e38c>] (unwind_backtrace) from [<c000c594>] (show_stack+0x10/0x14) [ 29.378252] [<c000c594>] (show_stack) from [<c0019138>] (warn_slowpath_common+0x6c/0x8c) [ 29.386392] [<c0019138>] (warn_slowpath_common) from [<c00191f4>] (warn_slowpath_null+0x1c/0x24) [ 29.395227] [<c00191f4>] (warn_slowpath_null) from [<c02f8818>] (uart_handle_cts_change+0xbc/0xd8) [ 29.404233] [<c02f8818>] (uart_handle_cts_change) from [<c02fafd0>] (mxs_auart_irq_handle+0x158/0x188) [ 29.413579] [<c02fafd0>] (mxs_auart_irq_handle) from [<c00503f4>] (handle_irq_event_percpu+0x3c/0x1f0) [ 29.422921] [<c00503f4>] (handle_irq_event_percpu) from [<c00505e4>] (handle_irq_event+0x3c/0x5c) [ 29.431830] [<c00505e4>] (handle_irq_event) from [<c0052a84>] (handle_level_irq+0x94/0x120) [ 29.440215] [<c0052a84>] (handle_level_irq) from [<c004fc24>] (generic_handle_irq+0x28/0x3c) [ 29.448685] [<c004fc24>] (generic_handle_irq) from [<c004fe8c>] (__handle_domain_irq+0x48/0x98) [ 29.457421] [<c004fe8c>] (__handle_domain_irq) from [<c000cfe4>] (__irq_svc+0x44/0x54) [ 29.465377] [<c000cfe4>] (__irq_svc) from [<c02fb978>] (mxs_auart_startup+0x54/0x78) [ 29.473162] [<c02fb978>] (mxs_auart_startup) from [<c02f7c48>] (uart_startup.part.6+0x88/0x1fc) [ 29.481900] [<c02f7c48>] (uart_startup.part.6) from [<c02f8374>] (uart_open+0xb4/0x10c) [ 29.489941] [<c02f8374>] (uart_open) from [<c02dd6f0>] (tty_open+0x12c/0x5c0) [ 29.497125] [<c02dd6f0>] (tty_open) from [<c00e2e0c>] (chrdev_open+0x9c/0x178) [ 29.504388] [<c00e2e0c>] (chrdev_open) from [<c00dd1e0>] (do_dentry_open.isra.13+0x1bc/0x2fc) [ 29.512958] [<c00dd1e0>] (do_dentry_open.isra.13) from [<c00ebe04>] (do_last.isra.46+0x690/0xca0) [ 29.521869] [<c00ebe04>] (do_last.isra.46) from [<c00ec4c8>] (path_openat+0xb4/0x5c8) [ 29.529738] [<c00ec4c8>] (path_openat) from [<c00ed52c>] (do_filp_open+0x2c/0x88) [ 29.537259] [<c00ed52c>] (do_filp_open) from [<c00de3c8>] (do_sys_open+0xf8/0x1c8) [ 29.544865] [<c00de3c8>] (do_sys_open) from [<c00095e0>] (ret_fast_syscall+0x0/0x44) [ 29.552628] ---[ end trace cd7d3866f5cabac3 ]--- After debugging, I found that while initialization of Uart0, when drivers receives AUART_INTR_CTSMIS interrupt, it tries to execute the uart_handle_cts_change under irq handler "mxs_auart_irq_handle" without holding any lock. This results inabove issue. This patch adds missing spin-lock before handling change in clear-to-send state Signed-off-by: Ankur Patel <ankur@xxxxxxxxxxxx> --- drivers/tty/serial/mxs-auart.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/tty/serial/mxs-auart.c b/drivers/tty/serial/mxs-auart.c index 10c2933..c74f301 100644 --- a/drivers/tty/serial/mxs-auart.c +++ b/drivers/tty/serial/mxs-auart.c @@ -683,8 +683,12 @@ static void mxs_auart_settermios(struct uart_port *u, static irqreturn_t mxs_auart_irq_handle(int irq, void *context) { u32 istat; + u32 stat; struct mxs_auart_port *s = context; - u32 stat = readl(s->port.membase + AUART_STAT); + + spin_lock(&s->port.lock); + + stat = readl(s->port.membase + AUART_STAT); istat = readl(s->port.membase + AUART_INTR); @@ -712,6 +716,7 @@ static irqreturn_t mxs_auart_irq_handle(int irq, void *context) mxs_auart_tx_chars(s); istat &= ~AUART_INTR_TXIS; } + spin_unlock(&s->port.lock); return IRQ_HANDLED; } -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-serial" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html