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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 02462C433F5 for ; Mon, 10 Oct 2022 09:09:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231671AbiJJJJk (ORCPT ); Mon, 10 Oct 2022 05:09:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231637AbiJJJJe (ORCPT ); Mon, 10 Oct 2022 05:09:34 -0400 Received: from bmailout3.hostsharing.net (bmailout3.hostsharing.net [IPv6:2a01:4f8:150:2161:1:b009:f23e:0]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2211C543F2; Mon, 10 Oct 2022 02:09:34 -0700 (PDT) Received: from h08.hostsharing.net (h08.hostsharing.net [83.223.95.28]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "*.hostsharing.net", Issuer "RapidSSL TLS DV RSA Mixed SHA256 2020 CA-1" (verified OK)) by bmailout3.hostsharing.net (Postfix) with ESMTPS id F26D3100E5F31; Mon, 10 Oct 2022 11:09:30 +0200 (CEST) Received: by h08.hostsharing.net (Postfix, from userid 100393) id CB85D60DC1; Mon, 10 Oct 2022 11:09:30 +0200 (CEST) Date: Mon, 10 Oct 2022 11:09:30 +0200 From: Lukas Wunner To: Sherry Sun Cc: Ilpo =?iso-8859-1?Q?J=E4rvinen?= , Greg Kroah-Hartman , Jiri Slaby , linux-serial , LKML , dl-linux-imx Subject: Re: [PATCH] Revert "serial: fsl_lpuart: Reset prior to registration" Message-ID: <20221010090930.GA23968@wunner.de> References: <20220929085318.5268-1-sherry.sun@nxp.com> <1265873d-28f9-d39c-5cce-858dbed1e8e8@linux.intel.com> <39c68295-947-2353-d9b-3bd654c38c7@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Oct 09, 2022 at 10:23:13AM +0000, Sherry Sun wrote: > I am not familiar with 8250 serial, but at least for imx uart driver > and lpuart driver, the following behavior is same. > For the "real" consoles (everything which is not a bootconsole), > the (port)->cons and (port)->cons->index are initialized through > uart_add_one_port()->uart_configure_port()->register_console()-> > try_enable_new_console(), here the console index is assigned by > the console cmdline parameters. Hm, uart_add_one_port() does the following *before* calling uart_configure_port(): /* * If this port is in use as a console then the spinlock is already * initialised. */ if (!uart_console_enabled(uport)) uart_port_spin_lock_init(uport); It sounds like in the case of fsl_lpuart.c, the spin lock is *always* initialized, even though a concurrent lpuart_console_write() may be holding it. That's not solved by moving lpuart_global_reset() around. The problem with performing lpuart_global_reset() after UART registration is that as soon as uart_add_one_port() returns, the port is available for user space to use. So resetting it is a no-go. Thanks, Lukas