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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id C6B76FA373B for ; Fri, 13 Sep 2024 10:04:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: Message-ID:Date:References:In-Reply-To:Subject:Cc:To:From: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=rlPvbEnZ5WQngyesq81myBzkHs5Lcelfd34b25m5ANQ=; b=1MKGrgl98d+97KHVKa8SoIRp0E Fm1l8rW2T/PCqJmVvCsKOMFJpltVSlU/UNMpUUgV2p7umkxw2vo9Tp9yXJOojmtlZl4PWhQE/gfUD 37brwV6DicWbBBxnkQ4L8dYETsqt3svvEDuAe5XL3MF6f0zycc1KCEqCcRs1m3U1u+EzpXGHKsPF7 rUjF8WLYf3R+1Dq8+BKtm+r+vqEKYMBwNBHMkTDiZAiGY8xj3oQest3O6Zky0haE3Mw8bDvTXQn+r NOoAQ4fKQCzlvNrey4wcTBo64gfwg4MZvDvNfFhnWpdlk96AVXV7igsjAJHEXJg9a2x2ZDwIg0lDz MHdmQ3cw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sp39t-0000000FYfQ-3nCi; Fri, 13 Sep 2024 10:04:09 +0000 Received: from www530.your-server.de ([188.40.30.78]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sp38o-0000000FYPc-1Zwa for linux-arm-kernel@lists.infradead.org; Fri, 13 Sep 2024 10:03:04 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=geanix.com; s=default2211; h=Content-Type:MIME-Version:Message-ID:Date:References: In-Reply-To:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID; bh=rlPvbEnZ5WQngyesq81myBzkHs5Lcelfd34b25m5ANQ=; b=0IryVpN4MTLdCo88llTCADA7Vx RY2gmXVOOIupVG6SYex0ZlRMeQjiZkJxTu0WzU2/zcf0zWvVB88FY8MUJiAHN9nTFWHwgJl65EWvg JZDD/tFkt8f6SgQ10z1FnwMP+c/v5tMLt6ZGakcSxQjllNzfFKLVv/spzS3rywxp5C/ZT+KVYgLIU 6jCTPsx/nUM0bAj+6HXmOkyJ9652ShqGf1FAuNHlTd8jQZaTkQ9VmEOqB7v+K0mfGxlepXw/I4GJ+ UBUpfiZmgkT7l16YnDq55gK0764gmm95gmLqZFgfbv1tcidEd2+NL7JIDo3dc6U9zo1x0E+OE5FV2 ZlGz7F8Q==; Received: from sslproxy03.your-server.de ([88.198.220.132]) by www530.your-server.de with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sp38l-0001ta-BP; Fri, 13 Sep 2024 12:02:59 +0200 Received: from [80.62.117.18] (helo=localhost) by sslproxy03.your-server.de with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1sp38k-0009i8-05; Fri, 13 Sep 2024 12:02:58 +0200 From: Esben Haabendal To: Alexander Stein Cc: Greg Kroah-Hartman , Jiri Slaby , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , John Ogness , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, imx@lists.linux.dev Subject: Re: [PATCH 2/2] serial: imx: Add more comments on port lock status In-Reply-To: <2200890.irdbgypaU6@steina-w> (Alexander Stein's message of "Fri, 13 Sep 2024 11:17:04 +0200") References: <20240913-serial-imx-lockfix-v1-0-4d102746c89d@geanix.com> <20240913-serial-imx-lockfix-v1-2-4d102746c89d@geanix.com> <2200890.irdbgypaU6@steina-w> Date: Fri, 13 Sep 2024 12:02:57 +0200 Message-ID: <87v7yz50ry.fsf@geanix.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Authenticated-Sender: esben@geanix.com X-Virus-Scanned: Clear (ClamAV 0.103.10/27397/Fri Sep 13 10:48:01 2024) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240913_030302_775603_17038871 X-CRM114-Status: GOOD ( 16.06 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Alexander Stein writes: > Hi, > > Am Freitag, 13. September 2024, 10:39:50 CEST schrieb Esben Haabendal: >> Comments regarding status of port.lock on internal functions is useful when >> reviewing correct handling of registers that must be protected by this >> lock. >> >> Signed-off-by: Esben Haabendal >> --- >> drivers/tty/serial/imx.c | 10 ++++++++++ >> 1 file changed, 10 insertions(+) >> >> diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c >> index efa3eb3a2c57..bea4510743ef 100644 >> --- a/drivers/tty/serial/imx.c >> +++ b/drivers/tty/serial/imx.c >> @@ -370,6 +370,7 @@ static void imx_uart_soft_reset(struct imx_port *sport) >> sport->idle_counter = 0; >> } >> >> +/* called with port.lock taken and irqs off */ >> static void imx_uart_disable_loopback_rs485(struct imx_port *sport) >> { >> unsigned int uts; > > I think you are referring to sport.lock. Yes. > On the other hand, instead of just adding comments, wouldn't it be > better to make it explicit? > Adding >> lockdep_assert_held(&sport->port->lock); > and/or sparse annoations >> __must_hold(&sport->port->lock) > > seems more reasonable to me than adding non-enforcing comments. I fear that due to the way that legacy console works, assertations might trigger in special situations, such as printk during panic. Converting comments to assertations could definitely be a good idea, but I think it might be better to wait with that until the driver has been converted to NBCON (in progress, see https://lore.kernel.org/all/20240913-serial-imx-nbcon-v3-1-4c627302335b@geanix.com/), as that will change the code paths this code will be used in. /Esben