Skip to contentSkip to conversation

patch "serial: imx: Initialize lock for non-registered console" added to tty-next

PATCH [email protected] 3 participants 5 messages May 28, 2020 – Jun 16, 2020

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

serial: imx: Initialize lock for non-registered console

to my tty git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git
in the tty-next branch.

The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.)

The patch will also be merged in the next major kernel release during the merge window.

If you have any questions about this process, please let me know.

From 8f065acec7573672dd15916e31d1e9b2e785566c Mon Sep 17 00:00:00 2001
From: Andy Shevchenko <[email protected]>
Date: Mon, 25 May 2020 13:59:52 +0300
Subject: serial: imx: Initialize lock for non-registered console

The commit a3cb39d258ef
("serial: core: Allow detach and attach serial device for console") changed a bit logic behind lock initialization since for most of the console driver it's supposed to have lock already initialized even if console is not enabled. However, it's not the case for Freescale IMX console.

Initialize lock explicitly in the ->probe().

Note, there is still an open question should or shouldn't not this driver register console properly.

Fixes a3cb39d258ef ("serial: core: Allow detach and attach serial device for console")
Cc stable <[email protected]>
---
 drivers/tty/serial/imx.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/tty/serial/imx.c +3 -0
index 986d902fb7fe..6b078e395931 100644
@@ -2404,6 +2404,9 @@ static int imx_uart_probe(struct platform_device *pdev)
 		}
 	}
 
+	/* We need to initialize lock even for non-registered console */
+	spin_lock_init(&sport->port.lock);
+
 	imx_uart_ports[sport->port.line] = sport;
 
 	platform_set_drvdata(pdev, sport);
Signature · 1 line
2.26.2
#1 lore raw
Quoted 50 lines · On Thu, 28 May 2020 at 12:49, <[email protected]> wrote:

This is a note to let you know that I've just added the patch titled

serial: imx: Initialize lock for non-registered console

to my tty git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git
in the tty-next branch.

The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.)

The patch will also be merged in the next major kernel release during the merge window.

If you have any questions about this process, please let me know.

From 8f065acec7573672dd15916e31d1e9b2e785566c Mon Sep 17 00:00:00 2001
From: Andy Shevchenko <[email protected]>
Date: Mon, 25 May 2020 13:59:52 +0300
Subject: serial: imx: Initialize lock for non-registered console

The commit a3cb39d258ef
("serial: core: Allow detach and attach serial device for console") changed a bit logic behind lock initialization since for most of the console driver it's supposed to have lock already initialized even if console is not enabled. However, it's not the case for Freescale IMX console.

Initialize lock explicitly in the ->probe().

Note, there is still an open question should or shouldn't not this driver register console properly.

Fixes a3cb39d258ef ("serial: core: Allow detach and attach serial device for console")
Cc stable <[email protected]>
---
 drivers/tty/serial/imx.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/tty/serial/imx.c +0 -0
index 986d902fb7fe..6b078e395931 100644

drivers/tty/serial/imx.c static int imx_uart_probe(struct platform_device *pdev) · line 2408

Quoted 5 lines
drivers/tty/serial/imx.c +2 -0
@@ -2404,6 +2404,9 @@ static int imx_uart_probe(struct platform_device *pdev)
                }
        }
 
+       /* We need to initialize lock even for non-registered console */
+       spin_lock_init(&sport->port.lock);

On arm64 Hikey devices running stable-rc 5.7 branch kernel reported following kernel INFO while booting.

[    2.059344] mmc2: new SDIO card at address 0001
[    2.105114] f7111000.uart: ttyAMA1 at MMIO 0xf7111000 (irq = 8,
base_baud = 0) is a PL011 rev2
[    2.105886] serial serial0: tty port ttyAMA1 registered
[    2.106843] f7112000.uart: ttyAMA2 at MMIO 0xf7112000 (irq = 9,
base_baud = 0) is a PL011 rev2
[    2.109759] f7113000.uart: ttyAMA3 at MMIO 0xf7113000 (irq = 10,
base_baud = 0) is a PL011 rev2
[    2.109916] INFO: trying to register non-static key.
[    2.109936] the code is fine but needs lockdep annotation.
[    2.109956] turning off the locking correctness validator.
[    2.109982] CPU: 2 PID: 57 Comm: kworker/2:1 Not tainted 5.7.3-rc1 #1
[    2.110004] Hardware name: HiKey Development Board (DT)
[    2.110040] Workqueue: events deferred_probe_work_func
[    2.110063] Call trace:
[    2.110082]  dump_backtrace+0x0/0x1e0
[    2.110100]  show_stack+0x24/0x30
[    2.110120]  dump_stack+0xe8/0x150
[    2.110140]  register_lock_class+0x640/0x680
[    2.110159]  __lock_acquire+0x7c/0x1728
[    2.110178]  lock_acquire+0xf8/0x458
[    2.110200]  _raw_spin_lock_irqsave+0x60/0x80
[    2.110221]  uart_add_one_port+0x3ac/0x4e8
[    2.110242]  pl011_register_port+0x70/0xd8
[    2.110262]  pl011_probe+0x154/0x1a0
[    2.110283]  amba_probe+0xcc/0x170
[    2.110301]  really_probe+0x290/0x498
[    2.110319]  driver_probe_device+0x12c/0x148
[    2.110339]  __device_attach_driver+0xa4/0x120
[    2.110359]  bus_for_each_drv+0x78/0xd8
[    2.110378]  __device_attach+0xe8/0x170
[    2.110397]  device_initial_probe+0x24/0x30
[    2.110416]  bus_probe_device+0xa0/0xa8
[    2.110435]  deferred_probe_work_func+0x94/0xf0
[    2.110458]  process_one_work+0x2b0/0x770
[    2.110477]  worker_thread+0x48/0x4a0
[    2.110496]  kthread+0x158/0x168
[    2.110515]  ret_from_fork+0x10/0x18
[    4.158216] printk: console [ttyAMA3] enabled
[    4.165009] 5V_HUB: supplied by SYS_5V

Please refer full test log,
https://lkft.validation.linaro.org/scheduler/job/1496830#L3764

metadata:
git branch: linux-5.7.y
git repo: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
git commit: f2c964aa9a1ce76f00767fd3fdcebf8e0db2b99e
kernel-config:
http://snapshots.linaro.org/openembedded/lkft/lkft/sumo/hikey/lkft/linux-stable-rc-5.7/6/config

--
Linaro LKFT
https://lkft.linaro.org

#2 lore raw
Quoted 54 lines · Naresh Kamboju
Quoted 53 lines · On Thu, 28 May 2020 at 12:49, <[email protected]> wrote:

This is a note to let you know that I've just added the patch titled

serial: imx: Initialize lock for non-registered console

to my tty git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git
in the tty-next branch.

The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.)

The patch will also be merged in the next major kernel release during the merge window.

If you have any questions about this process, please let me know.

From 8f065acec7573672dd15916e31d1e9b2e785566c Mon Sep 17 00:00:00 2001
From: Andy Shevchenko <[email protected]>
Date: Mon, 25 May 2020 13:59:52 +0300
Subject: serial: imx: Initialize lock for non-registered console

The commit a3cb39d258ef
("serial: core: Allow detach and attach serial device for console") changed a bit logic behind lock initialization since for most of the console driver it's supposed to have lock already initialized even if console is not enabled. However, it's not the case for Freescale IMX console.

Initialize lock explicitly in the ->probe().

Note, there is still an open question should or shouldn't not this driver register console properly.

Fixes a3cb39d258ef ("serial: core: Allow detach and attach serial device for console")
Cc stable <[email protected]>
---
 drivers/tty/serial/imx.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/tty/serial/imx.c +0 -0
index 986d902fb7fe..6b078e395931 100644
@@ -2404,6 +2404,9 @@ static int imx_uart_probe(struct platform_device *pdev)
                }
        }
 
Quoted 5 lines

drivers/tty/serial/imx.c static int imx_uart_probe(struct platform_device *pdev) · line 2408

Quoted 2 lines
drivers/tty/serial/imx.c +2 -0
+       /* We need to initialize lock even for non-registered console */
+       spin_lock_init(&sport->port.lock);

On arm64 Hikey devices running stable-rc 5.7 branch kernel reported following kernel INFO while booting.

Does backporting (applying)

8508f4cba308 ("serial: amba-pl011: Make sure we initialize the port.lock spinlock")

fix the issue?

Quoted 56 lines
[    2.059344] mmc2: new SDIO card at address 0001
[    2.105114] f7111000.uart: ttyAMA1 at MMIO 0xf7111000 (irq = 8,
base_baud = 0) is a PL011 rev2
[    2.105886] serial serial0: tty port ttyAMA1 registered
[    2.106843] f7112000.uart: ttyAMA2 at MMIO 0xf7112000 (irq = 9,
base_baud = 0) is a PL011 rev2
[    2.109759] f7113000.uart: ttyAMA3 at MMIO 0xf7113000 (irq = 10,
base_baud = 0) is a PL011 rev2
[    2.109916] INFO: trying to register non-static key.
[    2.109936] the code is fine but needs lockdep annotation.
[    2.109956] turning off the locking correctness validator.
[    2.109982] CPU: 2 PID: 57 Comm: kworker/2:1 Not tainted 5.7.3-rc1 #1
[    2.110004] Hardware name: HiKey Development Board (DT)
[    2.110040] Workqueue: events deferred_probe_work_func
[    2.110063] Call trace:
[    2.110082]  dump_backtrace+0x0/0x1e0
[    2.110100]  show_stack+0x24/0x30
[    2.110120]  dump_stack+0xe8/0x150
[    2.110140]  register_lock_class+0x640/0x680
[    2.110159]  __lock_acquire+0x7c/0x1728
[    2.110178]  lock_acquire+0xf8/0x458
[    2.110200]  _raw_spin_lock_irqsave+0x60/0x80
[    2.110221]  uart_add_one_port+0x3ac/0x4e8
[    2.110242]  pl011_register_port+0x70/0xd8
[    2.110262]  pl011_probe+0x154/0x1a0
[    2.110283]  amba_probe+0xcc/0x170
[    2.110301]  really_probe+0x290/0x498
[    2.110319]  driver_probe_device+0x12c/0x148
[    2.110339]  __device_attach_driver+0xa4/0x120
[    2.110359]  bus_for_each_drv+0x78/0xd8
[    2.110378]  __device_attach+0xe8/0x170
[    2.110397]  device_initial_probe+0x24/0x30
[    2.110416]  bus_probe_device+0xa0/0xa8
[    2.110435]  deferred_probe_work_func+0x94/0xf0
[    2.110458]  process_one_work+0x2b0/0x770
[    2.110477]  worker_thread+0x48/0x4a0
[    2.110496]  kthread+0x158/0x168
[    2.110515]  ret_from_fork+0x10/0x18
[    4.158216] printk: console [ttyAMA3] enabled
[    4.165009] 5V_HUB: supplied by SYS_5V

Please refer full test log,
https://lkft.validation.linaro.org/scheduler/job/1496830#L3764

metadata:
git branch: linux-5.7.y
git repo: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
git commit: f2c964aa9a1ce76f00767fd3fdcebf8e0db2b99e
kernel-config:
http://snapshots.linaro.org/openembedded/lkft/lkft/sumo/hikey/lkft/linux-stable-rc-5.7/6/config

--
Linaro LKFT
https://lkft.linaro.org

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#3 lore raw
Quoted 62 lines · Andy Shevchenko
Quoted 54 lines · Naresh Kamboju
Quoted 53 lines · On Thu, 28 May 2020 at 12:49, <[email protected]> wrote:

This is a note to let you know that I've just added the patch titled

serial: imx: Initialize lock for non-registered console

to my tty git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git
in the tty-next branch.

The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.)

The patch will also be merged in the next major kernel release during the merge window.

If you have any questions about this process, please let me know.

From 8f065acec7573672dd15916e31d1e9b2e785566c Mon Sep 17 00:00:00 2001
From: Andy Shevchenko <[email protected]>
Date: Mon, 25 May 2020 13:59:52 +0300
Subject: serial: imx: Initialize lock for non-registered console

The commit a3cb39d258ef
("serial: core: Allow detach and attach serial device for console") changed a bit logic behind lock initialization since for most of the console driver it's supposed to have lock already initialized even if console is not enabled. However, it's not the case for Freescale IMX console.

Initialize lock explicitly in the ->probe().

Note, there is still an open question should or shouldn't not this driver register console properly.

Fixes a3cb39d258ef ("serial: core: Allow detach and attach serial device for console")
Cc stable <[email protected]>
---
 drivers/tty/serial/imx.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/tty/serial/imx.c +0 -0
index 986d902fb7fe..6b078e395931 100644
@@ -2404,6 +2404,9 @@ static int imx_uart_probe(struct platform_device *pdev)
                }
        }
 
Quoted 5 lines

drivers/tty/serial/imx.c static int imx_uart_probe(struct platform_device *pdev) · line 2408

Quoted 2 lines
drivers/tty/serial/imx.c +2 -0
+       /* We need to initialize lock even for non-registered console */
+       spin_lock_init(&sport->port.lock);

On arm64 Hikey devices running stable-rc 5.7 branch kernel reported following kernel INFO while booting.

Quoted 5 lines

Does backporting (applying)

8508f4cba308 ("serial: amba-pl011: Make sure we initialize the port.lock spinlock")

fix the issue?

Cherry-pick is successful in the stable-rc/linux-5.7.y branch and the reported problem seems to be fixed.
However,I will test with 100 loop iteration and will confirm again.
---

$ git cherry-pick  8508f4cba30
[stable-rc-linux-5.7.y 4133416ed382] serial: amba-pl011: Make sure we
initialize the port.lock spinlock
 Author: John Stultz <[email protected]>
 Date: Tue Apr 28 18:40:50 2020 +0000
 1 file changed, 1 insertion(+)

- Naresh

author maintainer
#4 lore raw
Quoted 74 lines · Naresh Kamboju
Quoted 62 lines · Andy Shevchenko
Quoted 54 lines · Naresh Kamboju
Quoted 53 lines · On Thu, 28 May 2020 at 12:49, <[email protected]> wrote:

This is a note to let you know that I've just added the patch titled

serial: imx: Initialize lock for non-registered console

to my tty git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git
in the tty-next branch.

The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.)

The patch will also be merged in the next major kernel release during the merge window.

If you have any questions about this process, please let me know.

From 8f065acec7573672dd15916e31d1e9b2e785566c Mon Sep 17 00:00:00 2001
From: Andy Shevchenko <[email protected]>
Date: Mon, 25 May 2020 13:59:52 +0300
Subject: serial: imx: Initialize lock for non-registered console

The commit a3cb39d258ef
("serial: core: Allow detach and attach serial device for console") changed a bit logic behind lock initialization since for most of the console driver it's supposed to have lock already initialized even if console is not enabled. However, it's not the case for Freescale IMX console.

Initialize lock explicitly in the ->probe().

Note, there is still an open question should or shouldn't not this driver register console properly.

Fixes a3cb39d258ef ("serial: core: Allow detach and attach serial device for console")
Cc stable <[email protected]>
---
 drivers/tty/serial/imx.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/tty/serial/imx.c +0 -0
index 986d902fb7fe..6b078e395931 100644
@@ -2404,6 +2404,9 @@ static int imx_uart_probe(struct platform_device *pdev)
                }
        }
 
Quoted 5 lines

drivers/tty/serial/imx.c static int imx_uart_probe(struct platform_device *pdev) · line 2408

Quoted 2 lines
drivers/tty/serial/imx.c +2 -0
+       /* We need to initialize lock even for non-registered console */
+       spin_lock_init(&sport->port.lock);

On arm64 Hikey devices running stable-rc 5.7 branch kernel reported following kernel INFO while booting.

Quoted 5 lines

Does backporting (applying)

8508f4cba308 ("serial: amba-pl011: Make sure we initialize the port.lock spinlock")

fix the issue?

Cherry-pick is successful in the stable-rc/linux-5.7.y branch and the reported problem seems to be fixed.
However,I will test with 100 loop iteration and will confirm again.
---

Quoted 6 lines
$ git cherry-pick  8508f4cba30
[stable-rc-linux-5.7.y 4133416ed382] serial: amba-pl011: Make sure we
initialize the port.lock spinlock
 Author: John Stultz <[email protected]>
 Date: Tue Apr 28 18:40:50 2020 +0000
 1 file changed, 1 insertion(+)

I've added this patch to the tree now, thanks.

greg k-h