Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1392171 > unrolled thread

[PATCH stable] serial: samsung: Reorder the sequence of clock control when call s3c24xx_serial_set_termios()

Started byKrzysztof Kozlowski <k.kozlowski@samsung.com>
First post2016-05-02 14:30 +0200
Last post2016-05-03 12:10 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH stable] serial: samsung: Reorder the sequence of clock control  when call s3c24xx_serial_set_termios() Krzysztof Kozlowski <k.kozlowski@samsung.com> - 2016-05-02 14:30 +0200
    Re: [PATCH stable] serial: samsung: Reorder the sequence of clock  control when call s3c24xx_serial_set_termios() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-02 20:30 +0200
      Re: [PATCH stable] serial: samsung: Reorder the sequence of clock  control when call s3c24xx_serial_set_termios() Krzysztof Kozlowski <k.kozlowski@samsung.com> - 2016-05-03 12:10 +0200

#1392171 — [PATCH stable] serial: samsung: Reorder the sequence of clock control when call s3c24xx_serial_set_termios()

FromKrzysztof Kozlowski <k.kozlowski@samsung.com>
Date2016-05-02 14:30 +0200
Subject[PATCH stable] serial: samsung: Reorder the sequence of clock control when call s3c24xx_serial_set_termios()
Message-ID<rul98-3f2-13@gated-at.bofh.it>
From: Chanwoo Choi <cw00.choi@samsung.com>

commit b8995f527aac143e83d3900ff39357651ea4e0f6 upstream

This patch fixes the broken serial log when changing the clock source
of uart device. Before disabling the original clock source, this patch
enables the new clock source to protect the clock off state for a split second.

[k.kozlowski]:
On SMP systems this opens a short time window when both clocks (old and
new) are disabled and a second thread uses TTY/UART. This leads to
broken log or imprecise external abort (on one of ARM64 boards):

Unhandled fault: synchronous external abort (0x96000210) at 0xffffff8008080008
Internal error: : 96000210 [#1] PREEMPT SMP
[<ffffff8008427634>] s3c24xx_serial_console_putchar+0x8/0x64
[<ffffff8008427fa0>] s3c24xx_serial_console_write+0x30/0x38
[<ffffff80080f4e68>] call_console_drivers.constprop.22+0x100/0x108
[<ffffff80080f5d34>] console_unlock+0x504/0x58c
[<ffffff80080f6088>] vprintk_emit+0x2cc/0x478
[<ffffff80080f63ac>] vprintk_default+0x38/0x40
[<ffffff800814beb4>] printk+0xac/0xb8
[<ffffff800812f20c>] audit_printk_skb+0x68/0x6c
[<ffffff800812f4ec>] audit_log_end+0x13c/0x188
[<ffffff8008306064>] common_lsm_audit+0xb4/0x618
[<ffffff8008302cb0>] smack_log+0xe8/0x10c
[<ffffff8008303408>] smk_tskacc+0x8c/0xa4
[<ffffff800830344c>] smk_curacc+0x2c/0x34
[<ffffff800830066c>] smack_inode_permission+0x60/0x70
[<ffffff80082fb7d8>] security_inode_permission+0x58/0x80
[<ffffff80081c15a4>] __inode_permission+0x40/0xa0
[<ffffff80081c1618>] inode_permission+0x14/0x4c
[<ffffff80081c1e4c>] may_open+0x5c/0x10c
[<ffffff80081c47e8>] path_openat+0x13c/0xec8
[<ffffff80081c64f8>] do_filp_open+0x64/0xc0
[<ffffff80081b5ea0>] do_sys_open+0x144/0x208
[<ffffff80081b5f9c>] SyS_openat+0x10/0x18
[<ffffff8008085ecc>] __sys_trace_return+0x0/0x4

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Reviewed-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: <stable@vger.kernel.org>
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
[k.kozlowski: Backport to stable, update commit msg]
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>

---

The original Samsung serial driver was broken so this should be
backported as far as possible including the 2.6.12. :)
---
 drivers/tty/serial/samsung.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c
index ac7f8df54406..99bb23161dd6 100644
--- a/drivers/tty/serial/samsung.c
+++ b/drivers/tty/serial/samsung.c
@@ -1271,6 +1271,8 @@ static void s3c24xx_serial_set_termios(struct uart_port *port,
 	/* check to see if we need  to change clock source */
 
 	if (ourport->baudclk != clk) {
+		clk_prepare_enable(clk);
+
 		s3c24xx_serial_setsource(port, clk_sel);
 
 		if (!IS_ERR(ourport->baudclk)) {
@@ -1278,8 +1280,6 @@ static void s3c24xx_serial_set_termios(struct uart_port *port,
 			ourport->baudclk = ERR_PTR(-EINVAL);
 		}
 
-		clk_prepare_enable(clk);
-
 		ourport->baudclk = clk;
 		ourport->baudclk_rate = clk ? clk_get_rate(clk) : 0;
 	}
-- 
1.9.1

[toc] | [next] | [standalone]


#1392436 — Re: [PATCH stable] serial: samsung: Reorder the sequence of clock control when call s3c24xx_serial_set_termios()

FromGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Date2016-05-02 20:30 +0200
SubjectRe: [PATCH stable] serial: samsung: Reorder the sequence of clock control when call s3c24xx_serial_set_termios()
Message-ID<ruqLw-5E-5@gated-at.bofh.it>
In reply to#1392171
On Mon, May 02, 2016 at 02:25:07PM +0200, Krzysztof Kozlowski wrote:
> From: Chanwoo Choi <cw00.choi@samsung.com>
> 
> commit b8995f527aac143e83d3900ff39357651ea4e0f6 upstream

This isn't in Linus's tree yet, so we can't take this into any -stable
trees yet.  Please wait for that to happen, can you resend this when
that happens?

thanks,

greg k-h

[toc] | [prev] | [next] | [standalone]


#1393269 — Re: [PATCH stable] serial: samsung: Reorder the sequence of clock control when call s3c24xx_serial_set_termios()

FromKrzysztof Kozlowski <k.kozlowski@samsung.com>
Date2016-05-03 12:10 +0200
SubjectRe: [PATCH stable] serial: samsung: Reorder the sequence of clock control when call s3c24xx_serial_set_termios()
Message-ID<ruFrb-6jc-5@gated-at.bofh.it>
In reply to#1392436
On Mon, May 02, 2016 at 11:24:59AM -0700, Greg Kroah-Hartman wrote:
> On Mon, May 02, 2016 at 02:25:07PM +0200, Krzysztof Kozlowski wrote:
> > From: Chanwoo Choi <cw00.choi@samsung.com>
> > 
> > commit b8995f527aac143e83d3900ff39357651ea4e0f6 upstream
> 
> This isn't in Linus's tree yet, so we can't take this into any -stable
> trees yet.  Please wait for that to happen, can you resend this when
> that happens?

Of course, no problem. I will resend this.

Best regards,
Krzysztof

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web