All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Francesco Dolcini <francesco.dolcini@toradex.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jiri Slaby <jirislaby@kernel.org>,
	Shawn Guo <shawnguo@kernel.org>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Pengutronix Kernel Team <kernel@pengutronix.de>,
	Fabio Estevam <festevam@gmail.com>,
	NXP Linux Team <linux-imx@nxp.com>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	linux-kernel@vger.kernel.org, Stefan Agner <stefan@agner.ch>,
	linux-serial@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2 1/2] serial: imx: fix detach/attach of serial console
Date: Wed, 20 Oct 2021 21:39:21 +0200	[thread overview]
Message-ID: <20211020193921.7fofxvnhgjjadt5u@pengutronix.de> (raw)
In-Reply-To: <20211020192643.476895-2-francesco.dolcini@toradex.com>

[-- 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 --]

WARNING: multiple messages have this Message-ID (diff)
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Francesco Dolcini <francesco.dolcini@toradex.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jiri Slaby <jirislaby@kernel.org>,
	Shawn Guo <shawnguo@kernel.org>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Pengutronix Kernel Team <kernel@pengutronix.de>,
	Fabio Estevam <festevam@gmail.com>,
	NXP Linux Team <linux-imx@nxp.com>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	linux-kernel@vger.kernel.org, Stefan Agner <stefan@agner.ch>,
	linux-serial@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2 1/2] serial: imx: fix detach/attach of serial console
Date: Wed, 20 Oct 2021 21:39:21 +0200	[thread overview]
Message-ID: <20211020193921.7fofxvnhgjjadt5u@pengutronix.de> (raw)
In-Reply-To: <20211020192643.476895-2-francesco.dolcini@toradex.com>


[-- 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

  reply	other threads:[~2021-10-20 19:39 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-20 19:26 [PATCH v2 0/2] serial: imx: fix unregister/register console Francesco Dolcini
2021-10-20 19:26 ` Francesco Dolcini
2021-10-20 19:26 ` [PATCH v2 1/2] serial: imx: fix detach/attach of serial console Francesco Dolcini
2021-10-20 19:26   ` Francesco Dolcini
2021-10-20 19:39   ` Uwe Kleine-König [this message]
2021-10-20 19:39     ` Uwe Kleine-König
2021-10-20 19:54   ` Andy Shevchenko
2021-10-20 19:54     ` Andy Shevchenko
2021-10-21  8:28     ` Greg Kroah-Hartman
2021-10-21  8:28       ` Greg Kroah-Hartman
2021-10-20 19:26 ` [PATCH v2 2/2] serial: imx: disable console clocks on unregister Francesco Dolcini
2021-10-20 19:26   ` Francesco Dolcini
2021-10-21  8:39   ` Uwe Kleine-König
2021-10-21  8:39     ` Uwe Kleine-König

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211020193921.7fofxvnhgjjadt5u@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=festevam@gmail.com \
    --cc=francesco.dolcini@toradex.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jirislaby@kernel.org \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@kernel.org \
    --cc=stefan@agner.ch \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.