[PATCH v2 1/2] serial: imx: fix detach/attach of serial console
Andy Shevchenko
andy.shevchenko at gmail.com
Wed Oct 20 12:54:26 PDT 2021
On Wed, Oct 20, 2021 at 10:27 PM Francesco Dolcini
<francesco.dolcini at toradex.com> wrote:
>
> From: Stefan Agner <stefan at 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 at agner.ch>
> Signed-off-by: Francesco Dolcini <francesco.dolcini at toradex.com>
With above nit-picks addressed, FWIW,
Reviewed-by: Andy Shevchenko <andy.shevchenko at gmail.com>
--
With Best Regards,
Andy Shevchenko
More information about the linux-arm-kernel
mailing list