Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp427405rwi; Mon, 10 Oct 2022 02:23:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7Ti78MtH92hWJS1vzg8KaoLzWoWs2rhN4IVk2tcqJTfTpRErTEYqZMSSJ6IKZOVNpfTTlc X-Received: by 2002:a17:906:7956:b0:782:a340:5738 with SMTP id l22-20020a170906795600b00782a3405738mr14130057ejo.444.1665393800797; Mon, 10 Oct 2022 02:23:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665393800; cv=none; d=google.com; s=arc-20160816; b=v6QAgKcXI/UYcKOqn5RyVehtuJoRx9ybfrox90Xs7IAVSPR4dkRQLgL9FPbaV1dImj z+lu9yfAOgIYasXPx7hikTjDmPb2jjKhIMh/Kfidi9mDy/B6qXrJRtizNEyHe2EcNHui rDEU+Q+lzEDY+c+5P5rd8cd0Mmru+cwAfegMxhr/8oylKwLONGw5TsToDfipgDL6A+Wb BYeK9bR0qZEzAE0FXGCY+XM5Vq2KLIUs4NRz4EK3CEGLSKtZ/EJpgoCdpDMqbXBAznCt RzTiMNSKLRI8T2Jm1OtPPF8CSvDcxMyzsMnwMVBQtN2JjgPqVfB7CVvwbYRHymz+5Yk4 hbfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=JwzcjQtyN9DKpl62czFS33UV4P56Cqf+u9ncfST1prE=; b=oXNYdg/uJ2fE9ztRoti/pTlxZV586Mk9FUWyDu7vmyKA9by0sDmwzRZ/zpJZ5l4o20 vX0ZqroAQhSQ+IDUNvao4Ww6dpZDmbj5zPug1S7IhZByqLLxfwZWbS/hEpSnIhDx9BKp 8QHSeCewJ9q9hwV3S5ecfYJwQnJ7qKCIf6dylYRWBO6XcjHtuz/13XyQsZFiryyZpbxj Y6F0yT0DNUQfT7QTJpLWmkFoxZqS83WxoPyLTBROpmg7M4zo1p9pGpg67BrGceOmsqQx ekSG4HBPN/rra9vEiwOHpCIVw001V0iq9HxzrzOptdI+dJ0Z7XaTHFS3mT1ZSjMzg422 V4ug== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cw17-20020a170906479100b0072b0f6f1456si11469684ejc.612.2022.10.10.02.22.55; Mon, 10 Oct 2022 02:23:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231665AbiJJJJj (ORCPT + 99 others); Mon, 10 Oct 2022 05:09:39 -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) X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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