* [PATCH v2 0/2] serial: imx: fix unregister/register console
@ 2021-10-20 19:26 ` Francesco Dolcini
0 siblings, 0 replies; 14+ messages in thread
From: Francesco Dolcini @ 2021-10-20 19:26 UTC (permalink / raw)
To: Greg Kroah-Hartman, Jiri Slaby, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
Andy Shevchenko
Cc: Francesco Dolcini, linux-serial, linux-arm-kernel, linux-kernel,
u.kleine-koenig, Stefan Agner
Hi,
here a couple of fixes to properly handle imx serial console
unregister/register at runtime.
The patch from Stefan was already posted years ago but never merged [1],
however is still valid and it's pretty easy to trigger the problem. We have
this patch in our kernel tree since 3 years, but for some reason we never
managed to upstream it.
As correctly wrote by Uwe [2] this issue affects multiple drivers, I could
provide a patch for those, but I will not have any way to test it.
The second patch is required to have a balanced clock enable/disable
when doing console register/unregister.
The issue is present at least since
a3cb39d258ef ("serial: core: Allow detach and attach serial device for console")
[1] https://marc.info/?l=linux-serial&m=154221779312036&w=2
[2] https://lore.kernel.org/all/20211014081028.xafpuzrxk3jvv5qn@pengutronix.de/
Changes in v2:
Improved commit message and added fixes tag.
---
Francesco Dolcini (1):
serial: imx: disable console clocks on unregister
Stefan Agner (1):
serial: imx: fix detach/attach of serial console
drivers/tty/serial/imx.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
--
2.25.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH v2 1/2] serial: imx: fix detach/attach of serial console
2021-10-20 19:26 ` Francesco Dolcini
@ 2021-10-20 19:26 ` Francesco Dolcini
-1 siblings, 0 replies; 14+ messages in thread
From: Francesco Dolcini @ 2021-10-20 19:26 UTC (permalink / raw)
To: Greg Kroah-Hartman, Jiri Slaby, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
Andy Shevchenko
Cc: Stefan Agner, linux-serial, linux-arm-kernel, linux-kernel,
u.kleine-koenig, Francesco Dolcini
From: Stefan Agner <stefan@agner.ch>
If the device used as a serial console gets detached/attached at runtime,
register_console() will try to call imx_uart_setup_console(), but this
is not possible since it is marked as __init.
For instance
# cat /sys/devices/virtual/tty/console/active
tty1 ttymxc0
# echo -n N > /sys/devices/virtual/tty/console/subsystem/ttymxc0/console
# echo -n Y > /sys/devices/virtual/tty/console/subsystem/ttymxc0/console
[ 73.166649] 8<--- cut here ---
[ 73.167005] Unable to handle kernel paging request at virtual address c154d928
[ 73.167601] pgd = 55433e84
[ 73.167875] [c154d928] *pgd=8141941e(bad)
[ 73.168304] Internal error: Oops: 8000000d [#1] SMP ARM
[ 73.168429] Modules linked in:
[ 73.168522] CPU: 0 PID: 536 Comm: sh Not tainted 5.15.0-rc6-00056-g3968ddcf05fb #3
[ 73.168675] Hardware name: Freescale i.MX6 Ultralite (Device Tree)
[ 73.168791] PC is at imx_uart_console_setup+0x0/0x238
[ 73.168927] LR is at try_enable_new_console+0x98/0x124
[ 73.169056] pc : [<c154d928>] lr : [<c0196f44>] psr: a0000013
[ 73.169178] sp : c2ef5e70 ip : 00000000 fp : 00000000
[ 73.169281] r10: 00000000 r9 : c02cf970 r8 : 00000000
[ 73.169389] r7 : 00000001 r6 : 00000001 r5 : c1760164 r4 : c1e0fb08
[ 73.169512] r3 : c154d928 r2 : 00000000 r1 : efffcbd1 r0 : c1760164
[ 73.169641] Flags: NzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment none
[ 73.169782] Control: 10c5387d Table: 8345406a DAC: 00000051
[ 73.169895] Register r0 information: non-slab/vmalloc memory
[ 73.170032] Register r1 information: non-slab/vmalloc memory
[ 73.170158] Register r2 information: NULL pointer
[ 73.170273] Register r3 information: non-slab/vmalloc memory
[ 73.170397] Register r4 information: non-slab/vmalloc memory
[ 73.170521] Register r5 information: non-slab/vmalloc memory
[ 73.170647] Register r6 information: non-paged memory
[ 73.170771] Register r7 information: non-paged memory
[ 73.170892] Register r8 information: NULL pointer
[ 73.171009] Register r9 information: non-slab/vmalloc memory
[ 73.171142] Register r10 information: NULL pointer
[ 73.171259] Register r11 information: NULL pointer
[ 73.171375] Register r12 information: NULL pointer
[ 73.171494] Process sh (pid: 536, stack limit = 0xcd1ba82f)
[ 73.171621] Stack: (0xc2ef5e70 to 0xc2ef6000)
[ 73.171731] 5e60: ???????? ???????? ???????? ????????
[ 73.171899] 5e80: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
[ 73.172059] 5ea0: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
[ 73.172217] 5ec0: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
[ 73.172377] 5ee0: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
[ 73.172537] 5f00: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
[ 73.172698] 5f20: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
[ 73.172856] 5f40: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
[ 73.173016] 5f60: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
[ 73.173177] 5f80: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
[ 73.173336] 5fa0: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
[ 73.173496] 5fc0: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
[ 73.173654] 5fe0: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
[ 73.173826] [<c0196f44>] (try_enable_new_console) from [<c01984a8>] (register_console+0x10c/0x2ec)
[ 73.174053] [<c01984a8>] (register_console) from [<c06e2c90>] (console_store+0x14c/0x168)
[ 73.174262] [<c06e2c90>] (console_store) from [<c0383718>] (kernfs_fop_write_iter+0x110/0x1cc)
[ 73.174470] [<c0383718>] (kernfs_fop_write_iter) from [<c02cf5f4>] (vfs_write+0x31c/0x548)
[ 73.174679] [<c02cf5f4>] (vfs_write) from [<c02cf970>] (ksys_write+0x60/0xec)
[ 73.174863] [<c02cf970>] (ksys_write) from [<c0100080>] (ret_fast_syscall+0x0/0x1c)
[ 73.175052] Exception stack(0xc2ef5fa8 to 0xc2ef5ff0)
[ 73.175167] 5fa0: ???????? ???????? ???????? ???????? ???????? ????????
[ 73.175327] 5fc0: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
[ 73.175486] 5fe0: ???????? ???????? ???????? ????????
[ 73.175608] Code: 00000000 00000000 00000000 00000000 (00000000)
[ 73.175744] ---[ end trace 9b75121265109bf1 ]---
A similar issue could be triggered unbinding/binding the serial console
device [*].
Drop __init so that imx_uart_setup_console() can be safely called at
runtime.
[*] https://lore.kernel.org/all/20181114174940.7865-3-stefan@agner.ch/
Fixes: a3cb39d258ef ("serial: core: Allow detach and attach serial device for console")
Signed-off-by: Stefan Agner <stefan@agner.ch>
Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
---
drivers/tty/serial/imx.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 8b121cd869e9..51a9f9423b1a 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -2017,7 +2017,7 @@ imx_uart_console_write(struct console *co, const char *s, unsigned int count)
* If the port was already initialised (eg, by a boot loader),
* try to determine the current setup.
*/
-static void __init
+static void
imx_uart_console_get_options(struct imx_port *sport, int *baud,
int *parity, int *bits)
{
@@ -2076,7 +2076,7 @@ imx_uart_console_get_options(struct imx_port *sport, int *baud,
}
}
-static int __init
+static int
imx_uart_console_setup(struct console *co, char *options)
{
struct imx_port *sport;
--
2.25.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v2 1/2] serial: imx: fix detach/attach of serial console
@ 2021-10-20 19:26 ` Francesco Dolcini
0 siblings, 0 replies; 14+ messages in thread
From: Francesco Dolcini @ 2021-10-20 19:26 UTC (permalink / raw)
To: Greg Kroah-Hartman, Jiri Slaby, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
Andy Shevchenko
Cc: Stefan Agner, linux-serial, linux-arm-kernel, linux-kernel,
u.kleine-koenig, Francesco Dolcini
From: Stefan Agner <stefan@agner.ch>
If the device used as a serial console gets detached/attached at runtime,
register_console() will try to call imx_uart_setup_console(), but this
is not possible since it is marked as __init.
For instance
# cat /sys/devices/virtual/tty/console/active
tty1 ttymxc0
# echo -n N > /sys/devices/virtual/tty/console/subsystem/ttymxc0/console
# echo -n Y > /sys/devices/virtual/tty/console/subsystem/ttymxc0/console
[ 73.166649] 8<--- cut here ---
[ 73.167005] Unable to handle kernel paging request at virtual address c154d928
[ 73.167601] pgd = 55433e84
[ 73.167875] [c154d928] *pgd=8141941e(bad)
[ 73.168304] Internal error: Oops: 8000000d [#1] SMP ARM
[ 73.168429] Modules linked in:
[ 73.168522] CPU: 0 PID: 536 Comm: sh Not tainted 5.15.0-rc6-00056-g3968ddcf05fb #3
[ 73.168675] Hardware name: Freescale i.MX6 Ultralite (Device Tree)
[ 73.168791] PC is at imx_uart_console_setup+0x0/0x238
[ 73.168927] LR is at try_enable_new_console+0x98/0x124
[ 73.169056] pc : [<c154d928>] lr : [<c0196f44>] psr: a0000013
[ 73.169178] sp : c2ef5e70 ip : 00000000 fp : 00000000
[ 73.169281] r10: 00000000 r9 : c02cf970 r8 : 00000000
[ 73.169389] r7 : 00000001 r6 : 00000001 r5 : c1760164 r4 : c1e0fb08
[ 73.169512] r3 : c154d928 r2 : 00000000 r1 : efffcbd1 r0 : c1760164
[ 73.169641] Flags: NzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment none
[ 73.169782] Control: 10c5387d Table: 8345406a DAC: 00000051
[ 73.169895] Register r0 information: non-slab/vmalloc memory
[ 73.170032] Register r1 information: non-slab/vmalloc memory
[ 73.170158] Register r2 information: NULL pointer
[ 73.170273] Register r3 information: non-slab/vmalloc memory
[ 73.170397] Register r4 information: non-slab/vmalloc memory
[ 73.170521] Register r5 information: non-slab/vmalloc memory
[ 73.170647] Register r6 information: non-paged memory
[ 73.170771] Register r7 information: non-paged memory
[ 73.170892] Register r8 information: NULL pointer
[ 73.171009] Register r9 information: non-slab/vmalloc memory
[ 73.171142] Register r10 information: NULL pointer
[ 73.171259] Register r11 information: NULL pointer
[ 73.171375] Register r12 information: NULL pointer
[ 73.171494] Process sh (pid: 536, stack limit = 0xcd1ba82f)
[ 73.171621] Stack: (0xc2ef5e70 to 0xc2ef6000)
[ 73.171731] 5e60: ???????? ???????? ???????? ????????
[ 73.171899] 5e80: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
[ 73.172059] 5ea0: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
[ 73.172217] 5ec0: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
[ 73.172377] 5ee0: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
[ 73.172537] 5f00: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
[ 73.172698] 5f20: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
[ 73.172856] 5f40: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
[ 73.173016] 5f60: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
[ 73.173177] 5f80: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
[ 73.173336] 5fa0: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
[ 73.173496] 5fc0: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
[ 73.173654] 5fe0: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
[ 73.173826] [<c0196f44>] (try_enable_new_console) from [<c01984a8>] (register_console+0x10c/0x2ec)
[ 73.174053] [<c01984a8>] (register_console) from [<c06e2c90>] (console_store+0x14c/0x168)
[ 73.174262] [<c06e2c90>] (console_store) from [<c0383718>] (kernfs_fop_write_iter+0x110/0x1cc)
[ 73.174470] [<c0383718>] (kernfs_fop_write_iter) from [<c02cf5f4>] (vfs_write+0x31c/0x548)
[ 73.174679] [<c02cf5f4>] (vfs_write) from [<c02cf970>] (ksys_write+0x60/0xec)
[ 73.174863] [<c02cf970>] (ksys_write) from [<c0100080>] (ret_fast_syscall+0x0/0x1c)
[ 73.175052] Exception stack(0xc2ef5fa8 to 0xc2ef5ff0)
[ 73.175167] 5fa0: ???????? ???????? ???????? ???????? ???????? ????????
[ 73.175327] 5fc0: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
[ 73.175486] 5fe0: ???????? ???????? ???????? ????????
[ 73.175608] Code: 00000000 00000000 00000000 00000000 (00000000)
[ 73.175744] ---[ end trace 9b75121265109bf1 ]---
A similar issue could be triggered unbinding/binding the serial console
device [*].
Drop __init so that imx_uart_setup_console() can be safely called at
runtime.
[*] https://lore.kernel.org/all/20181114174940.7865-3-stefan@agner.ch/
Fixes: a3cb39d258ef ("serial: core: Allow detach and attach serial device for console")
Signed-off-by: Stefan Agner <stefan@agner.ch>
Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
---
drivers/tty/serial/imx.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 8b121cd869e9..51a9f9423b1a 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -2017,7 +2017,7 @@ imx_uart_console_write(struct console *co, const char *s, unsigned int count)
* If the port was already initialised (eg, by a boot loader),
* try to determine the current setup.
*/
-static void __init
+static void
imx_uart_console_get_options(struct imx_port *sport, int *baud,
int *parity, int *bits)
{
@@ -2076,7 +2076,7 @@ imx_uart_console_get_options(struct imx_port *sport, int *baud,
}
}
-static int __init
+static int
imx_uart_console_setup(struct console *co, char *options)
{
struct imx_port *sport;
--
2.25.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH v2 1/2] serial: imx: fix detach/attach of serial console
2021-10-20 19:26 ` Francesco Dolcini
@ 2021-10-20 19:39 ` Uwe Kleine-König
-1 siblings, 0 replies; 14+ messages in thread
From: Uwe Kleine-König @ 2021-10-20 19:39 UTC (permalink / raw)
To: Francesco Dolcini
Cc: Greg Kroah-Hartman, Jiri Slaby, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
Andy Shevchenko, linux-kernel, Stefan Agner, linux-serial,
linux-arm-kernel
[-- Attachment #1: Type: text/plain, Size: 5543 bytes --]
On Wed, Oct 20, 2021 at 09:26:42PM +0200, Francesco Dolcini wrote:
> From: Stefan Agner <stefan@agner.ch>
>
> If the device used as a serial console gets detached/attached at runtime,
> register_console() will try to call imx_uart_setup_console(), but this
> is not possible since it is marked as __init.
>
> For instance
>
> # cat /sys/devices/virtual/tty/console/active
> tty1 ttymxc0
> # echo -n N > /sys/devices/virtual/tty/console/subsystem/ttymxc0/console
> # echo -n Y > /sys/devices/virtual/tty/console/subsystem/ttymxc0/console
>
> [ 73.166649] 8<--- cut here ---
> [ 73.167005] Unable to handle kernel paging request at virtual address c154d928
> [ 73.167601] pgd = 55433e84
> [ 73.167875] [c154d928] *pgd=8141941e(bad)
> [ 73.168304] Internal error: Oops: 8000000d [#1] SMP ARM
> [ 73.168429] Modules linked in:
> [ 73.168522] CPU: 0 PID: 536 Comm: sh Not tainted 5.15.0-rc6-00056-g3968ddcf05fb #3
> [ 73.168675] Hardware name: Freescale i.MX6 Ultralite (Device Tree)
> [ 73.168791] PC is at imx_uart_console_setup+0x0/0x238
> [ 73.168927] LR is at try_enable_new_console+0x98/0x124
> [ 73.169056] pc : [<c154d928>] lr : [<c0196f44>] psr: a0000013
> [ 73.169178] sp : c2ef5e70 ip : 00000000 fp : 00000000
> [ 73.169281] r10: 00000000 r9 : c02cf970 r8 : 00000000
> [ 73.169389] r7 : 00000001 r6 : 00000001 r5 : c1760164 r4 : c1e0fb08
> [ 73.169512] r3 : c154d928 r2 : 00000000 r1 : efffcbd1 r0 : c1760164
> [ 73.169641] Flags: NzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment none
> [ 73.169782] Control: 10c5387d Table: 8345406a DAC: 00000051
> [ 73.169895] Register r0 information: non-slab/vmalloc memory
> [ 73.170032] Register r1 information: non-slab/vmalloc memory
> [ 73.170158] Register r2 information: NULL pointer
> [ 73.170273] Register r3 information: non-slab/vmalloc memory
> [ 73.170397] Register r4 information: non-slab/vmalloc memory
> [ 73.170521] Register r5 information: non-slab/vmalloc memory
> [ 73.170647] Register r6 information: non-paged memory
> [ 73.170771] Register r7 information: non-paged memory
> [ 73.170892] Register r8 information: NULL pointer
> [ 73.171009] Register r9 information: non-slab/vmalloc memory
> [ 73.171142] Register r10 information: NULL pointer
> [ 73.171259] Register r11 information: NULL pointer
> [ 73.171375] Register r12 information: NULL pointer
> [ 73.171494] Process sh (pid: 536, stack limit = 0xcd1ba82f)
> [ 73.171621] Stack: (0xc2ef5e70 to 0xc2ef6000)
> [ 73.171731] 5e60: ???????? ???????? ???????? ????????
> [ 73.171899] 5e80: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
> [ 73.172059] 5ea0: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
> [ 73.172217] 5ec0: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
> [ 73.172377] 5ee0: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
> [ 73.172537] 5f00: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
> [ 73.172698] 5f20: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
> [ 73.172856] 5f40: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
> [ 73.173016] 5f60: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
> [ 73.173177] 5f80: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
> [ 73.173336] 5fa0: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
> [ 73.173496] 5fc0: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
> [ 73.173654] 5fe0: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
> [ 73.173826] [<c0196f44>] (try_enable_new_console) from [<c01984a8>] (register_console+0x10c/0x2ec)
> [ 73.174053] [<c01984a8>] (register_console) from [<c06e2c90>] (console_store+0x14c/0x168)
> [ 73.174262] [<c06e2c90>] (console_store) from [<c0383718>] (kernfs_fop_write_iter+0x110/0x1cc)
> [ 73.174470] [<c0383718>] (kernfs_fop_write_iter) from [<c02cf5f4>] (vfs_write+0x31c/0x548)
> [ 73.174679] [<c02cf5f4>] (vfs_write) from [<c02cf970>] (ksys_write+0x60/0xec)
> [ 73.174863] [<c02cf970>] (ksys_write) from [<c0100080>] (ret_fast_syscall+0x0/0x1c)
> [ 73.175052] Exception stack(0xc2ef5fa8 to 0xc2ef5ff0)
> [ 73.175167] 5fa0: ???????? ???????? ???????? ???????? ???????? ????????
> [ 73.175327] 5fc0: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
> [ 73.175486] 5fe0: ???????? ???????? ???????? ????????
> [ 73.175608] Code: 00000000 00000000 00000000 00000000 (00000000)
> [ 73.175744] ---[ end trace 9b75121265109bf1 ]---
>
> A similar issue could be triggered unbinding/binding the serial console
> device [*].
>
> Drop __init so that imx_uart_setup_console() can be safely called at
> runtime.
>
> [*] https://lore.kernel.org/all/20181114174940.7865-3-stefan@agner.ch/
>
> Fixes: a3cb39d258ef ("serial: core: Allow detach and attach serial device for console")
> Signed-off-by: Stefan Agner <stefan@agner.ch>
> Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Thanks
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | https://www.pengutronix.de/ |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v2 1/2] serial: imx: fix detach/attach of serial console
@ 2021-10-20 19:39 ` Uwe Kleine-König
0 siblings, 0 replies; 14+ messages in thread
From: Uwe Kleine-König @ 2021-10-20 19:39 UTC (permalink / raw)
To: Francesco Dolcini
Cc: Greg Kroah-Hartman, Jiri Slaby, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
Andy Shevchenko, linux-kernel, Stefan Agner, linux-serial,
linux-arm-kernel
[-- Attachment #1.1: Type: text/plain, Size: 5543 bytes --]
On Wed, Oct 20, 2021 at 09:26:42PM +0200, Francesco Dolcini wrote:
> From: Stefan Agner <stefan@agner.ch>
>
> If the device used as a serial console gets detached/attached at runtime,
> register_console() will try to call imx_uart_setup_console(), but this
> is not possible since it is marked as __init.
>
> For instance
>
> # cat /sys/devices/virtual/tty/console/active
> tty1 ttymxc0
> # echo -n N > /sys/devices/virtual/tty/console/subsystem/ttymxc0/console
> # echo -n Y > /sys/devices/virtual/tty/console/subsystem/ttymxc0/console
>
> [ 73.166649] 8<--- cut here ---
> [ 73.167005] Unable to handle kernel paging request at virtual address c154d928
> [ 73.167601] pgd = 55433e84
> [ 73.167875] [c154d928] *pgd=8141941e(bad)
> [ 73.168304] Internal error: Oops: 8000000d [#1] SMP ARM
> [ 73.168429] Modules linked in:
> [ 73.168522] CPU: 0 PID: 536 Comm: sh Not tainted 5.15.0-rc6-00056-g3968ddcf05fb #3
> [ 73.168675] Hardware name: Freescale i.MX6 Ultralite (Device Tree)
> [ 73.168791] PC is at imx_uart_console_setup+0x0/0x238
> [ 73.168927] LR is at try_enable_new_console+0x98/0x124
> [ 73.169056] pc : [<c154d928>] lr : [<c0196f44>] psr: a0000013
> [ 73.169178] sp : c2ef5e70 ip : 00000000 fp : 00000000
> [ 73.169281] r10: 00000000 r9 : c02cf970 r8 : 00000000
> [ 73.169389] r7 : 00000001 r6 : 00000001 r5 : c1760164 r4 : c1e0fb08
> [ 73.169512] r3 : c154d928 r2 : 00000000 r1 : efffcbd1 r0 : c1760164
> [ 73.169641] Flags: NzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment none
> [ 73.169782] Control: 10c5387d Table: 8345406a DAC: 00000051
> [ 73.169895] Register r0 information: non-slab/vmalloc memory
> [ 73.170032] Register r1 information: non-slab/vmalloc memory
> [ 73.170158] Register r2 information: NULL pointer
> [ 73.170273] Register r3 information: non-slab/vmalloc memory
> [ 73.170397] Register r4 information: non-slab/vmalloc memory
> [ 73.170521] Register r5 information: non-slab/vmalloc memory
> [ 73.170647] Register r6 information: non-paged memory
> [ 73.170771] Register r7 information: non-paged memory
> [ 73.170892] Register r8 information: NULL pointer
> [ 73.171009] Register r9 information: non-slab/vmalloc memory
> [ 73.171142] Register r10 information: NULL pointer
> [ 73.171259] Register r11 information: NULL pointer
> [ 73.171375] Register r12 information: NULL pointer
> [ 73.171494] Process sh (pid: 536, stack limit = 0xcd1ba82f)
> [ 73.171621] Stack: (0xc2ef5e70 to 0xc2ef6000)
> [ 73.171731] 5e60: ???????? ???????? ???????? ????????
> [ 73.171899] 5e80: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
> [ 73.172059] 5ea0: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
> [ 73.172217] 5ec0: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
> [ 73.172377] 5ee0: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
> [ 73.172537] 5f00: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
> [ 73.172698] 5f20: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
> [ 73.172856] 5f40: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
> [ 73.173016] 5f60: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
> [ 73.173177] 5f80: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
> [ 73.173336] 5fa0: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
> [ 73.173496] 5fc0: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
> [ 73.173654] 5fe0: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
> [ 73.173826] [<c0196f44>] (try_enable_new_console) from [<c01984a8>] (register_console+0x10c/0x2ec)
> [ 73.174053] [<c01984a8>] (register_console) from [<c06e2c90>] (console_store+0x14c/0x168)
> [ 73.174262] [<c06e2c90>] (console_store) from [<c0383718>] (kernfs_fop_write_iter+0x110/0x1cc)
> [ 73.174470] [<c0383718>] (kernfs_fop_write_iter) from [<c02cf5f4>] (vfs_write+0x31c/0x548)
> [ 73.174679] [<c02cf5f4>] (vfs_write) from [<c02cf970>] (ksys_write+0x60/0xec)
> [ 73.174863] [<c02cf970>] (ksys_write) from [<c0100080>] (ret_fast_syscall+0x0/0x1c)
> [ 73.175052] Exception stack(0xc2ef5fa8 to 0xc2ef5ff0)
> [ 73.175167] 5fa0: ???????? ???????? ???????? ???????? ???????? ????????
> [ 73.175327] 5fc0: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
> [ 73.175486] 5fe0: ???????? ???????? ???????? ????????
> [ 73.175608] Code: 00000000 00000000 00000000 00000000 (00000000)
> [ 73.175744] ---[ end trace 9b75121265109bf1 ]---
>
> A similar issue could be triggered unbinding/binding the serial console
> device [*].
>
> Drop __init so that imx_uart_setup_console() can be safely called at
> runtime.
>
> [*] https://lore.kernel.org/all/20181114174940.7865-3-stefan@agner.ch/
>
> Fixes: a3cb39d258ef ("serial: core: Allow detach and attach serial device for console")
> Signed-off-by: Stefan Agner <stefan@agner.ch>
> Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Thanks
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | https://www.pengutronix.de/ |
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
[-- Attachment #2: Type: text/plain, Size: 176 bytes --]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v2 1/2] serial: imx: fix detach/attach of serial console
2021-10-20 19:26 ` Francesco Dolcini
@ 2021-10-20 19:54 ` Andy Shevchenko
-1 siblings, 0 replies; 14+ messages in thread
From: Andy Shevchenko @ 2021-10-20 19:54 UTC (permalink / raw)
To: Francesco Dolcini
Cc: Greg Kroah-Hartman, Jiri Slaby, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
Andy Shevchenko, Stefan Agner, open list:SERIAL DRIVERS,
linux-arm Mailing List, Linux Kernel Mailing List,
Uwe Kleine-König
On Wed, Oct 20, 2021 at 10:27 PM Francesco Dolcini
<francesco.dolcini@toradex.com> wrote:
>
> From: Stefan Agner <stefan@agner.ch>
>
> If the device used as a serial console gets detached/attached at runtime,
> register_console() will try to call imx_uart_setup_console(), but this
> is not possible since it is marked as __init.
Thank you for fixing this!
> For instance
>
> # cat /sys/devices/virtual/tty/console/active
> tty1 ttymxc0
> # echo -n N > /sys/devices/virtual/tty/console/subsystem/ttymxc0/console
> # echo -n Y > /sys/devices/virtual/tty/console/subsystem/ttymxc0/console
Can we leave only something like below in the commit message?
> [ 73.167005] Unable to handle kernel paging request at virtual address c154d928
> [ 73.168304] Internal error: Oops: 8000000d [#1] SMP ARM
> [ 73.168522] CPU: 0 PID: 536 Comm: sh Not tainted 5.15.0-rc6-00056-g3968ddcf05fb #3
...
> [ 73.168791] PC is at imx_uart_console_setup+0x0/0x238
> [ 73.168927] LR is at try_enable_new_console+0x98/0x124
...
> [ 73.173826] [<c0196f44>] (try_enable_new_console) from [<c01984a8>] (register_console+0x10c/0x2ec)
> [ 73.174053] [<c01984a8>] (register_console) from [<c06e2c90>] (console_store+0x14c/0x168)
> [ 73.174262] [<c06e2c90>] (console_store) from [<c0383718>] (kernfs_fop_write_iter+0x110/0x1cc)
> A similar issue could be triggered unbinding/binding the serial console
on unbinding/binding
> device [*].
>
> Drop __init so that imx_uart_setup_console() can be safely called at
> runtime.
>
> [*] https://lore.kernel.org/all/20181114174940.7865-3-stefan@agner.ch/
Make it Link: tag?
> Fixes: a3cb39d258ef ("serial: core: Allow detach and attach serial device for console")
> Signed-off-by: Stefan Agner <stefan@agner.ch>
> Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
With above nit-picks addressed, FWIW,
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v2 1/2] serial: imx: fix detach/attach of serial console
@ 2021-10-20 19:54 ` Andy Shevchenko
0 siblings, 0 replies; 14+ messages in thread
From: Andy Shevchenko @ 2021-10-20 19:54 UTC (permalink / raw)
To: Francesco Dolcini
Cc: Greg Kroah-Hartman, Jiri Slaby, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
Andy Shevchenko, Stefan Agner, open list:SERIAL DRIVERS,
linux-arm Mailing List, Linux Kernel Mailing List,
Uwe Kleine-König
On Wed, Oct 20, 2021 at 10:27 PM Francesco Dolcini
<francesco.dolcini@toradex.com> wrote:
>
> From: Stefan Agner <stefan@agner.ch>
>
> If the device used as a serial console gets detached/attached at runtime,
> register_console() will try to call imx_uart_setup_console(), but this
> is not possible since it is marked as __init.
Thank you for fixing this!
> For instance
>
> # cat /sys/devices/virtual/tty/console/active
> tty1 ttymxc0
> # echo -n N > /sys/devices/virtual/tty/console/subsystem/ttymxc0/console
> # echo -n Y > /sys/devices/virtual/tty/console/subsystem/ttymxc0/console
Can we leave only something like below in the commit message?
> [ 73.167005] Unable to handle kernel paging request at virtual address c154d928
> [ 73.168304] Internal error: Oops: 8000000d [#1] SMP ARM
> [ 73.168522] CPU: 0 PID: 536 Comm: sh Not tainted 5.15.0-rc6-00056-g3968ddcf05fb #3
...
> [ 73.168791] PC is at imx_uart_console_setup+0x0/0x238
> [ 73.168927] LR is at try_enable_new_console+0x98/0x124
...
> [ 73.173826] [<c0196f44>] (try_enable_new_console) from [<c01984a8>] (register_console+0x10c/0x2ec)
> [ 73.174053] [<c01984a8>] (register_console) from [<c06e2c90>] (console_store+0x14c/0x168)
> [ 73.174262] [<c06e2c90>] (console_store) from [<c0383718>] (kernfs_fop_write_iter+0x110/0x1cc)
> A similar issue could be triggered unbinding/binding the serial console
on unbinding/binding
> device [*].
>
> Drop __init so that imx_uart_setup_console() can be safely called at
> runtime.
>
> [*] https://lore.kernel.org/all/20181114174940.7865-3-stefan@agner.ch/
Make it Link: tag?
> Fixes: a3cb39d258ef ("serial: core: Allow detach and attach serial device for console")
> Signed-off-by: Stefan Agner <stefan@agner.ch>
> Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
With above nit-picks addressed, FWIW,
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
--
With Best Regards,
Andy Shevchenko
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v2 1/2] serial: imx: fix detach/attach of serial console
2021-10-20 19:54 ` Andy Shevchenko
@ 2021-10-21 8:28 ` Greg Kroah-Hartman
-1 siblings, 0 replies; 14+ messages in thread
From: Greg Kroah-Hartman @ 2021-10-21 8:28 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Francesco Dolcini, Jiri Slaby, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
Andy Shevchenko, Stefan Agner, open list:SERIAL DRIVERS,
linux-arm Mailing List, Linux Kernel Mailing List,
Uwe Kleine-König
On Wed, Oct 20, 2021 at 10:54:26PM +0300, Andy Shevchenko wrote:
> On Wed, Oct 20, 2021 at 10:27 PM Francesco Dolcini
> <francesco.dolcini@toradex.com> wrote:
> >
> > From: Stefan Agner <stefan@agner.ch>
> >
> > If the device used as a serial console gets detached/attached at runtime,
> > register_console() will try to call imx_uart_setup_console(), but this
> > is not possible since it is marked as __init.
>
> Thank you for fixing this!
>
> > For instance
> >
> > # cat /sys/devices/virtual/tty/console/active
> > tty1 ttymxc0
> > # echo -n N > /sys/devices/virtual/tty/console/subsystem/ttymxc0/console
> > # echo -n Y > /sys/devices/virtual/tty/console/subsystem/ttymxc0/console
>
> Can we leave only something like below in the commit message?
>
> > [ 73.167005] Unable to handle kernel paging request at virtual address c154d928
> > [ 73.168304] Internal error: Oops: 8000000d [#1] SMP ARM
> > [ 73.168522] CPU: 0 PID: 536 Comm: sh Not tainted 5.15.0-rc6-00056-g3968ddcf05fb #3
> ...
> > [ 73.168791] PC is at imx_uart_console_setup+0x0/0x238
> > [ 73.168927] LR is at try_enable_new_console+0x98/0x124
> ...
> > [ 73.173826] [<c0196f44>] (try_enable_new_console) from [<c01984a8>] (register_console+0x10c/0x2ec)
> > [ 73.174053] [<c01984a8>] (register_console) from [<c06e2c90>] (console_store+0x14c/0x168)
> > [ 73.174262] [<c06e2c90>] (console_store) from [<c0383718>] (kernfs_fop_write_iter+0x110/0x1cc)
>
> > A similar issue could be triggered unbinding/binding the serial console
>
> on unbinding/binding
>
> > device [*].
> >
> > Drop __init so that imx_uart_setup_console() can be safely called at
> > runtime.
> >
> > [*] https://lore.kernel.org/all/20181114174940.7865-3-stefan@agner.ch/
>
> Make it Link: tag?
>
> > Fixes: a3cb39d258ef ("serial: core: Allow detach and attach serial device for console")
> > Signed-off-by: Stefan Agner <stefan@agner.ch>
> > Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
>
> With above nit-picks addressed, FWIW,
Those are not a big deal, I'll edit the changelog text...
thanks,
greg k-h
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v2 1/2] serial: imx: fix detach/attach of serial console
@ 2021-10-21 8:28 ` Greg Kroah-Hartman
0 siblings, 0 replies; 14+ messages in thread
From: Greg Kroah-Hartman @ 2021-10-21 8:28 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Francesco Dolcini, Jiri Slaby, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
Andy Shevchenko, Stefan Agner, open list:SERIAL DRIVERS,
linux-arm Mailing List, Linux Kernel Mailing List,
Uwe Kleine-König
On Wed, Oct 20, 2021 at 10:54:26PM +0300, Andy Shevchenko wrote:
> On Wed, Oct 20, 2021 at 10:27 PM Francesco Dolcini
> <francesco.dolcini@toradex.com> wrote:
> >
> > From: Stefan Agner <stefan@agner.ch>
> >
> > If the device used as a serial console gets detached/attached at runtime,
> > register_console() will try to call imx_uart_setup_console(), but this
> > is not possible since it is marked as __init.
>
> Thank you for fixing this!
>
> > For instance
> >
> > # cat /sys/devices/virtual/tty/console/active
> > tty1 ttymxc0
> > # echo -n N > /sys/devices/virtual/tty/console/subsystem/ttymxc0/console
> > # echo -n Y > /sys/devices/virtual/tty/console/subsystem/ttymxc0/console
>
> Can we leave only something like below in the commit message?
>
> > [ 73.167005] Unable to handle kernel paging request at virtual address c154d928
> > [ 73.168304] Internal error: Oops: 8000000d [#1] SMP ARM
> > [ 73.168522] CPU: 0 PID: 536 Comm: sh Not tainted 5.15.0-rc6-00056-g3968ddcf05fb #3
> ...
> > [ 73.168791] PC is at imx_uart_console_setup+0x0/0x238
> > [ 73.168927] LR is at try_enable_new_console+0x98/0x124
> ...
> > [ 73.173826] [<c0196f44>] (try_enable_new_console) from [<c01984a8>] (register_console+0x10c/0x2ec)
> > [ 73.174053] [<c01984a8>] (register_console) from [<c06e2c90>] (console_store+0x14c/0x168)
> > [ 73.174262] [<c06e2c90>] (console_store) from [<c0383718>] (kernfs_fop_write_iter+0x110/0x1cc)
>
> > A similar issue could be triggered unbinding/binding the serial console
>
> on unbinding/binding
>
> > device [*].
> >
> > Drop __init so that imx_uart_setup_console() can be safely called at
> > runtime.
> >
> > [*] https://lore.kernel.org/all/20181114174940.7865-3-stefan@agner.ch/
>
> Make it Link: tag?
>
> > Fixes: a3cb39d258ef ("serial: core: Allow detach and attach serial device for console")
> > Signed-off-by: Stefan Agner <stefan@agner.ch>
> > Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
>
> With above nit-picks addressed, FWIW,
Those are not a big deal, I'll edit the changelog text...
thanks,
greg k-h
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH v2 2/2] serial: imx: disable console clocks on unregister
2021-10-20 19:26 ` Francesco Dolcini
@ 2021-10-20 19:26 ` Francesco Dolcini
-1 siblings, 0 replies; 14+ messages in thread
From: Francesco Dolcini @ 2021-10-20 19:26 UTC (permalink / raw)
To: Greg Kroah-Hartman, Jiri Slaby, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team
Cc: Francesco Dolcini, linux-serial, linux-arm-kernel, linux-kernel
During console setup imx_uart_console_setup() enables clocks, but they
are never disabled when the console is unregistered, this leads to
clk_prepare_enable() being called multiple times without a matching
clk_disable_unprepare() in case of console unregister.
Ensure that clock enable/disable are balanced adding
clk_disable_unprepare() in the console exit callback.
Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
---
drivers/tty/serial/imx.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 51a9f9423b1a..90f82e6c54e4 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -2124,12 +2124,24 @@ imx_uart_console_setup(struct console *co, char *options)
return retval;
}
+static int
+imx_uart_console_exit(struct console *co)
+{
+ struct imx_port *sport = imx_uart_ports[co->index];
+
+ clk_disable_unprepare(sport->clk_per);
+ clk_disable_unprepare(sport->clk_ipg);
+
+ return 0;
+}
+
static struct uart_driver imx_uart_uart_driver;
static struct console imx_uart_console = {
.name = DEV_NAME,
.write = imx_uart_console_write,
.device = uart_console_device,
.setup = imx_uart_console_setup,
+ .exit = imx_uart_console_exit,
.flags = CON_PRINTBUFFER,
.index = -1,
.data = &imx_uart_uart_driver,
--
2.25.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v2 2/2] serial: imx: disable console clocks on unregister
@ 2021-10-20 19:26 ` Francesco Dolcini
0 siblings, 0 replies; 14+ messages in thread
From: Francesco Dolcini @ 2021-10-20 19:26 UTC (permalink / raw)
To: Greg Kroah-Hartman, Jiri Slaby, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team
Cc: Francesco Dolcini, linux-serial, linux-arm-kernel, linux-kernel
During console setup imx_uart_console_setup() enables clocks, but they
are never disabled when the console is unregistered, this leads to
clk_prepare_enable() being called multiple times without a matching
clk_disable_unprepare() in case of console unregister.
Ensure that clock enable/disable are balanced adding
clk_disable_unprepare() in the console exit callback.
Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
---
drivers/tty/serial/imx.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 51a9f9423b1a..90f82e6c54e4 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -2124,12 +2124,24 @@ imx_uart_console_setup(struct console *co, char *options)
return retval;
}
+static int
+imx_uart_console_exit(struct console *co)
+{
+ struct imx_port *sport = imx_uart_ports[co->index];
+
+ clk_disable_unprepare(sport->clk_per);
+ clk_disable_unprepare(sport->clk_ipg);
+
+ return 0;
+}
+
static struct uart_driver imx_uart_uart_driver;
static struct console imx_uart_console = {
.name = DEV_NAME,
.write = imx_uart_console_write,
.device = uart_console_device,
.setup = imx_uart_console_setup,
+ .exit = imx_uart_console_exit,
.flags = CON_PRINTBUFFER,
.index = -1,
.data = &imx_uart_uart_driver,
--
2.25.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH v2 2/2] serial: imx: disable console clocks on unregister
2021-10-20 19:26 ` Francesco Dolcini
@ 2021-10-21 8:39 ` Uwe Kleine-König
-1 siblings, 0 replies; 14+ messages in thread
From: Uwe Kleine-König @ 2021-10-21 8:39 UTC (permalink / raw)
To: Francesco Dolcini
Cc: Greg Kroah-Hartman, Jiri Slaby, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
linux-arm-kernel, linux-serial, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 765 bytes --]
On Wed, Oct 20, 2021 at 09:26:43PM +0200, Francesco Dolcini wrote:
> During console setup imx_uart_console_setup() enables clocks, but they
> are never disabled when the console is unregistered, this leads to
> clk_prepare_enable() being called multiple times without a matching
> clk_disable_unprepare() in case of console unregister.
>
> Ensure that clock enable/disable are balanced adding
> clk_disable_unprepare() in the console exit callback.
>
> Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Thanks
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | https://www.pengutronix.de/ |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v2 2/2] serial: imx: disable console clocks on unregister
@ 2021-10-21 8:39 ` Uwe Kleine-König
0 siblings, 0 replies; 14+ messages in thread
From: Uwe Kleine-König @ 2021-10-21 8:39 UTC (permalink / raw)
To: Francesco Dolcini
Cc: Greg Kroah-Hartman, Jiri Slaby, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
linux-arm-kernel, linux-serial, linux-kernel
[-- Attachment #1.1: Type: text/plain, Size: 765 bytes --]
On Wed, Oct 20, 2021 at 09:26:43PM +0200, Francesco Dolcini wrote:
> During console setup imx_uart_console_setup() enables clocks, but they
> are never disabled when the console is unregistered, this leads to
> clk_prepare_enable() being called multiple times without a matching
> clk_disable_unprepare() in case of console unregister.
>
> Ensure that clock enable/disable are balanced adding
> clk_disable_unprepare() in the console exit callback.
>
> Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Thanks
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | https://www.pengutronix.de/ |
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
[-- Attachment #2: Type: text/plain, Size: 176 bytes --]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 14+ messages in thread