linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Fix cpm uart corruption with PREEMPT_RT
@ 2008-05-20 19:39 Rune Torgersen
  2008-05-20 19:42 ` Scott Wood
  2008-07-01  5:28 ` Kumar Gala
  0 siblings, 2 replies; 6+ messages in thread
From: Rune Torgersen @ 2008-05-20 19:39 UTC (permalink / raw)
  To: linuxppc-dev

Fix CPM serial port corruption when running with CONFIG_PREEMPT_RT.
Userland usage of console, and kernel printf's were stepping on each others toes.
Also only take lock if not in an oops.

Signed-off-by: Rune Torgersen <runet@innovsys.com>

diff --git a/drivers/serial/cpm_uart/cpm_uart_core.c b/drivers/serial/cpm_uart/cpm_uart_core.c
index fb93403..11bee62 100755
--- a/drivers/serial/cpm_uart/cpm_uart_core.c
+++ b/drivers/serial/cpm_uart/cpm_uart_core.c
@@ -1214,6 +1214,14 @@ static void cpm_uart_console_write(struct console *co, const char *s,
 	unsigned int i;
 	cbd_t __iomem *bdp, *bdbase;
 	unsigned char *cp;
+	unsigned long flags;
+	int nolock = oops_in_progress;
+
+	if (unlikely(nolock)) {
+		local_irq_save(flags);
+	} else {
+		spin_lock_irqsave(&pinfo->port.lock, flags);
+	}
 
 	/* Get the address of the host memory buffer.
 	 */
@@ -1282,6 +1290,12 @@ static void cpm_uart_console_write(struct console *co, const char *s,
 		;
 
 	pinfo->tx_cur = bdp;
+
+	if (unlikely(nolock)) {
+		local_irq_restore(flags);
+	} else {
+		spin_unlock_irqrestore(&pinfo->port.lock, flags);
+	}
 }
 
 

^ permalink raw reply related	[flat|nested] 6+ messages in thread
* [PATCH] Fix cpm uart corruption with PREEMPT_RT
@ 2008-05-20 19:28 Rune Torgersen
  2008-05-20 19:33 ` Scott Wood
  0 siblings, 1 reply; 6+ messages in thread
From: Rune Torgersen @ 2008-05-20 19:28 UTC (permalink / raw)
  To: linuxppc-dev

Fix CPM serial port corruption when running with CONFIG_PREEMPT_RT.
Userland usage of console, and kernel printf's were stepping on each others toes.

Signed-off-by: Rune Torgersen <runet@innovsys.com>

diff --git a/drivers/serial/cpm_uart/cpm_uart_core.c b/drivers/serial/cpm_uart/cpm_uart_core.c
index fb93403..79c109d 100755
--- a/drivers/serial/cpm_uart/cpm_uart_core.c
+++ b/drivers/serial/cpm_uart/cpm_uart_core.c
@@ -1214,7 +1214,9 @@ static void cpm_uart_console_write(struct console *co, const char *s,
 	unsigned int i;
 	cbd_t __iomem *bdp, *bdbase;
 	unsigned char *cp;
+	unsigned long flags;
 
+	spin_lock_irqsave(&pinfo->port.lock, flags);
 	/* Get the address of the host memory buffer.
 	 */
 	bdp = pinfo->tx_cur;
@@ -1282,6 +1284,8 @@ static void cpm_uart_console_write(struct console *co, const char *s,
 		;
 
 	pinfo->tx_cur = bdp;
+
+	spin_unlock_irqrestore(&pinfo->port.lock, flags);
 }
 
 

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-07-01  5:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-20 19:39 [PATCH] Fix cpm uart corruption with PREEMPT_RT Rune Torgersen
2008-05-20 19:42 ` Scott Wood
2008-07-01  5:28 ` Kumar Gala
  -- strict thread matches above, loose matches on Subject: below --
2008-05-20 19:28 Rune Torgersen
2008-05-20 19:33 ` Scott Wood
2008-05-20 19:35   ` Rune Torgersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).