From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 860CCC433EF for ; Wed, 20 Oct 2021 19:41:09 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 52B9A61057 for ; Wed, 20 Oct 2021 19:41:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 52B9A61057 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: In-Reply-To:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Reply-To:Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date :Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=n2rR61a0Mj7RvF0KtrqycsB5G/ufvtLp4x/5KqH2og4=; b=jiGb1gSZHdPDKReX2tfQQqi69t k2FEJkTY6H68Qsjv1GslUX3KjegOfUHKA+z2/Rr1x1iUvT4O5DKnFhYufAmovWUP+QXYt4g/vnfyI 34rVpeWuugJaC44mp+gs0PVI5HJKCo5kBSfA/WgbjFmDJkrakZazqEMv7IM/2EaFmy8+KFXSyqNkP fHkqVJ90qZo4AoJnKk0L8JTEQJOOH2sKBKMAteNiUqKgZ9lRsQjFA4d6znW4IFqLb42/eD6QsX2kC oHp0EuvV8lRw7WC6dVlCkqOLmBHQpmYXtJecGfygMZLwSMnpRFe/c1L+Ll5qO/P92motDUmMLu0Yk oRqb3/ew==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mdHRB-005gGG-IA; Wed, 20 Oct 2021 19:39:45 +0000 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mdHR7-005gFM-Hk for linux-arm-kernel@lists.infradead.org; Wed, 20 Oct 2021 19:39:43 +0000 Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mdHQq-0005D2-Bl; Wed, 20 Oct 2021 21:39:24 +0200 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1mdHQo-0006ar-E2; Wed, 20 Oct 2021 21:39:22 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1mdHQo-0005K5-Ci; Wed, 20 Oct 2021 21:39:22 +0200 Date: Wed, 20 Oct 2021 21:39:21 +0200 From: Uwe =?utf-8?Q?Kleine-K=C3=B6nig?= 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@vger.kernel.org, Stefan Agner , 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 Message-ID: <20211020193921.7fofxvnhgjjadt5u@pengutronix.de> References: <20211020192643.476895-1-francesco.dolcini@toradex.com> <20211020192643.476895-2-francesco.dolcini@toradex.com> MIME-Version: 1.0 In-Reply-To: <20211020192643.476895-2-francesco.dolcini@toradex.com> X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-arm-kernel@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211020_123941_799231_3270C90A X-CRM114-Status: GOOD ( 19.44 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: multipart/mixed; boundary="===============4071851153734062728==" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org --===============4071851153734062728== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="jgyp6rxza6t5nhtz" Content-Disposition: inline --jgyp6rxza6t5nhtz Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Oct 20, 2021 at 09:26:42PM +0200, Francesco Dolcini wrote: > From: Stefan Agner >=20 > 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. >=20 > For instance >=20 > # 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 >=20 > [ 73.166649] 8<--- cut here --- > [ 73.167005] Unable to handle kernel paging request at virtual address = c154d928 > [ 73.167601] pgd =3D 55433e84 > [ 73.167875] [c154d928] *pgd=3D8141941e(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-g396= 8ddcf05fb #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 : [] lr : [] 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 Segme= nt 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 =3D 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] [] (try_enable_new_console) from [] (r= egister_console+0x10c/0x2ec) > [ 73.174053] [] (register_console) from [] (console= _store+0x14c/0x168) > [ 73.174262] [] (console_store) from [] (kernfs_fop= _write_iter+0x110/0x1cc) > [ 73.174470] [] (kernfs_fop_write_iter) from [] (vf= s_write+0x31c/0x548) > [ 73.174679] [] (vfs_write) from [] (ksys_write+0x6= 0/0xec) > [ 73.174863] [] (ksys_write) from [] (ret_fast_sysc= all+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 ]--- >=20 > A similar issue could be triggered unbinding/binding the serial console > device [*]. >=20 > Drop __init so that imx_uart_setup_console() can be safely called at > runtime. >=20 > [*] https://lore.kernel.org/all/20181114174940.7865-3-stefan@agner.ch/ >=20 > Fixes: a3cb39d258ef ("serial: core: Allow detach and attach serial device= for console") > Signed-off-by: Stefan Agner > Signed-off-by: Francesco Dolcini Acked-by: Uwe Kleine-K=F6nig Thanks Uwe --=20 Pengutronix e.K. | Uwe Kleine-K=F6nig | Industrial Linux Solutions | https://www.pengutronix.de/ | --jgyp6rxza6t5nhtz Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEfnIqFpAYrP8+dKQLwfwUeK3K7AkFAmFwcGUACgkQwfwUeK3K 7AlzsAgAj71QeD7ML3yoaettATnFzeluFWpv4tvf7/BicZhCTovrl/PZZ1p1L22/ Rlh8UFOkE4TMm+geNnH/U27BDvp8C+rIJSRDWNyxqtEQfa07nA+YIS/MahjA+DgF PHpE1Y5vpZWnoojKCXn4RnTlhiCDiKP+9OUq/LGZGqnommjUgnxbM0wn6FeFOKiu wEDrSzUd+ySSKBaWP/z0T5Z8RwJFUZTFx2V+4aPuu1Bg1bwOt1tOEIz7mUC4I+ap 3Ah0c8qNKdVEeLU8+NzzKbi5GPeXys9ngbUtrAY2/mUI97m/XnyA8Bm8yO4s8izp 7kT0wYUkH09lbyVPz+176wsJhdaa7w== =zMJ1 -----END PGP SIGNATURE----- --jgyp6rxza6t5nhtz-- --===============4071851153734062728== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel --===============4071851153734062728==--