Skip to contentSkip to conversation

patch "serial: sh-sci: Initialize spinlock for uart console" added to tty-linus

PATCH [email protected] 3 participants 4 messages Jul 3, 2020

Subsystems (2)
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: sh-sci: Initialize spinlock for uart 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-linus 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 hopefully also be merged in Linus's tree for the next -rc kernel release.

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

From f38278e9b810b06aff2981d505267be984423ba3 Mon Sep 17 00:00:00 2001
From: Lad Prabhakar <[email protected]>
Date: Wed, 1 Jul 2020 16:41:40 +0100
Subject: serial: sh-sci: Initialize spinlock for uart console

serial core expects the spinlock to be initialized by the controller driver for serial console, this patch makes sure the spinlock is initialized, fixing the below issue:

[    0.865928] BUG: spinlock bad magic on CPU#0, swapper/0/1
[    0.865945]  lock: sci_ports+0x0/0x4c80, .magic: 00000000, .owner: <none>/-1, .owner_cpu: 0
[    0.865955] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.8.0-rc1+ #112
[    0.865961] Hardware name: HopeRun HiHope RZ/G2H with sub board (DT)
[    0.865968] Call trace:
[    0.865979]  dump_backtrace+0x0/0x1d8
[    0.865985]  show_stack+0x14/0x20
[    0.865996]  dump_stack+0xe8/0x130
[    0.866006]  spin_dump+0x6c/0x88
[    0.866012]  do_raw_spin_lock+0xb0/0xf8
[    0.866023]  _raw_spin_lock_irqsave+0x80/0xa0
[    0.866032]  uart_add_one_port+0x3a4/0x4e0
[    0.866039]  sci_probe+0x504/0x7c8
[    0.866048]  platform_drv_probe+0x50/0xa0
[    0.866059]  really_probe+0xdc/0x330
[    0.866066]  driver_probe_device+0x58/0xb8
[    0.866072]  device_driver_attach+0x6c/0x90
[    0.866078]  __driver_attach+0x88/0xd0
[    0.866085]  bus_for_each_dev+0x74/0xc8
[    0.866091]  driver_attach+0x20/0x28
[    0.866098]  bus_add_driver+0x14c/0x1f8
[    0.866104]  driver_register+0x60/0x110
[    0.866109]  __platform_driver_register+0x40/0x48
[    0.866119]  sci_init+0x2c/0x34
[    0.866127]  do_one_initcall+0x88/0x428
[    0.866137]  kernel_init_freeable+0x2c0/0x328
[    0.866143]  kernel_init+0x10/0x108
[    0.866150]  ret_from_fork+0x10/0x18
---
 drivers/tty/serial/sh-sci.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/tty/serial/sh-sci.c +3 -0
index e1179e74a2b8..204bb68ce3ca 100644
@@ -3301,6 +3301,9 @@ static int sci_probe_single(struct platform_device *dev,
 		sciport->port.flags |= UPF_HARD_FLOW;
 	}
 
+	if (sci_uart_driver.cons->index == sciport->port.line)
+		spin_lock_init(&sciport->port.lock);
+
 	ret = uart_add_one_port(&sci_uart_driver, &sciport->port);
 	if (ret) {
 		sci_cleanup_single(sciport);
Signature · 1 line
2.27.0
#1 lore raw

Hi Greg,

Quoted 16 lines

-----Original Message-----
From: [email protected] <[email protected]>
Sent: 03 July 2020 09:41
To: Prabhakar Mahadev Lad <[email protected]>; Biju Das <[email protected]>; [email protected]; [email protected]
Subject: patch "serial: sh-sci: Initialize spinlock for uart console" added to tty-linus

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

serial: sh-sci: Initialize spinlock for uart 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-linus branch.

Quoted 8 lines

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 hopefully also be merged in Linus's tree for the next -rc kernel release.

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

It looks like it's a regression in serial_core.c [1] as Geert pointed out [2]. Please drop this patch until we come to a conclusion.

[1] https://www.spinics.net/lists/linux-serial/msg37119.html
[2] https://patchwork.kernel.org/patch/11636731/

Cheers,
--Prabhakar

Quoted 64 lines

From f38278e9b810b06aff2981d505267be984423ba3 Mon Sep 17 00:00:00 2001
From: Lad Prabhakar <[email protected]>
Date: Wed, 1 Jul 2020 16:41:40 +0100
Subject: serial: sh-sci: Initialize spinlock for uart console

serial core expects the spinlock to be initialized by the controller driver for serial console, this patch makes sure the spinlock is initialized, fixing the below issue:

[    0.865928] BUG: spinlock bad magic on CPU#0, swapper/0/1
[    0.865945]  lock: sci_ports+0x0/0x4c80, .magic: 00000000, .owner: <none>/-1, .owner_cpu: 0
[    0.865955] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.8.0-rc1+ #112
[    0.865961] Hardware name: HopeRun HiHope RZ/G2H with sub board (DT)
[    0.865968] Call trace:
[    0.865979]  dump_backtrace+0x0/0x1d8
[    0.865985]  show_stack+0x14/0x20
[    0.865996]  dump_stack+0xe8/0x130
[    0.866006]  spin_dump+0x6c/0x88
[    0.866012]  do_raw_spin_lock+0xb0/0xf8
[    0.866023]  _raw_spin_lock_irqsave+0x80/0xa0
[    0.866032]  uart_add_one_port+0x3a4/0x4e0
[    0.866039]  sci_probe+0x504/0x7c8
[    0.866048]  platform_drv_probe+0x50/0xa0
[    0.866059]  really_probe+0xdc/0x330
[    0.866066]  driver_probe_device+0x58/0xb8
[    0.866072]  device_driver_attach+0x6c/0x90
[    0.866078]  __driver_attach+0x88/0xd0
[    0.866085]  bus_for_each_dev+0x74/0xc8
[    0.866091]  driver_attach+0x20/0x28
[    0.866098]  bus_add_driver+0x14c/0x1f8
[    0.866104]  driver_register+0x60/0x110
[    0.866109]  __platform_driver_register+0x40/0x48
[    0.866119]  sci_init+0x2c/0x34
[    0.866127]  do_one_initcall+0x88/0x428
[    0.866137]  kernel_init_freeable+0x2c0/0x328
[    0.866143]  kernel_init+0x10/0x108
[    0.866150]  ret_from_fork+0x10/0x18
---
 drivers/tty/serial/sh-sci.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/tty/serial/sh-sci.c +3 -1
index e1179e74a2b8..204bb68ce3ca 100644
@@ -3301,6 +3301,9 @@ static int sci_probe_single(struct platform_device *dev,
 sciport->port.flags |= UPF_HARD_FLOW;
 }
 
+if (sci_uart_driver.cons->index == sciport->port.line)
+spin_lock_init(&sciport->port.lock);
+
 ret = uart_add_one_port(&sci_uart_driver, &sciport->port);
 if (ret) {
 sci_cleanup_single(sciport);
--
Quoted 2 lines

2.27.0

Renesas Electronics Europe GmbH, Geschaeftsfuehrer/President: Carsten Jauch, Sitz der Gesellschaft/Registered office: Duesseldorf, Arcadiastrasse 10, 40472 Duesseldorf, Germany, Handelsregister/Commercial Register: Duesseldorf, HRB 3708 USt-IDNr./Tax identification no.: DE 119353406 WEEE-Reg.-Nr./WEEE reg. no.: DE 14978647

author maintainer
#2 lore raw
Quoted 24 lines · Prabhakar Mahadev Lad

Hi Greg,

Quoted 22 lines

-----Original Message-----
From: [email protected] <[email protected]>
Sent: 03 July 2020 09:41
To: Prabhakar Mahadev Lad <[email protected]>; Biju Das <[email protected]>; [email protected]; [email protected]
Subject: patch "serial: sh-sci: Initialize spinlock for uart console" added to tty-linus

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

serial: sh-sci: Initialize spinlock for uart 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-linus 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 hopefully also be merged in Linus's tree for the next -rc kernel release.

Quoted 6 lines
Quoted 2 lines

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

It looks like it's a regression in serial_core.c [1] as Geert pointed out [2]. Please drop this patch until we come to a conclusion.

[1] https://www.spinics.net/lists/linux-serial/msg37119.html
[2] https://patchwork.kernel.org/patch/11636731/

We have had MANY patches for individual drivers to fix up the issue with that serial_core patch. I think, and hope, they are all now caught. If not, please let us know, but for now, this patch is needed, so I'll keep it.

thanks,

greg k-h

#3 lore raw

Hi Greg,

Quoted 27 lines · On Fri, Jul 3, 2020 at 10:58 AM [email protected]…
Quoted 26 lines · Prabhakar Mahadev Lad
Quoted 16 lines

-----Original Message-----
From: [email protected] <[email protected]>
Sent: 03 July 2020 09:41
To: Prabhakar Mahadev Lad <[email protected]>; Biju Das <[email protected]>; [email protected]; [email protected]
Subject: patch "serial: sh-sci: Initialize spinlock for uart console" added to tty-linus

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

serial: sh-sci: Initialize spinlock for uart 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-linus branch.

Quoted 8 lines

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 hopefully also be merged in Linus's tree for the next -rc kernel release.

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

It looks like it's a regression in serial_core.c [1] as Geert pointed out [2]. Please drop this patch until we come to a conclusion.

Quoted 7 lines
Quoted 2 lines

[1] https://www.spinics.net/lists/linux-serial/msg37119.html
[2] https://patchwork.kernel.org/patch/11636731/

We have had MANY patches for individual drivers to fix up the issue with that serial_core patch. I think, and hope, they are all now caught. If not, please let us know, but for now, this patch is needed, so I'll keep it.

Yeah, let's fix all the fixes when the core issue is fixed ;-)

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds