Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp1179266rdb; Fri, 1 Dec 2023 08:56:16 -0800 (PST) X-Google-Smtp-Source: AGHT+IFLBSBCmthWIbL6FQl8M8Dzwh+Fxqx2Uc05vTpw1RI9wejSaoME6rw8hrgsqWv1uBHd5zht X-Received: by 2002:a17:902:ce88:b0:1d0:220b:f24d with SMTP id f8-20020a170902ce8800b001d0220bf24dmr10346455plg.31.1701449775806; Fri, 01 Dec 2023 08:56:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701449775; cv=none; d=google.com; s=arc-20160816; b=IM7eQUtKYFJvQRI/YY6mdDlo6hbn+CXyqNuCh8tPN0CxWGIIzmiDUFEN3e507SO3kQ SYJaz0T1x5ge4IjwffcajW+ZLY8Xya7kgEcJ5pFebVDuAY8F33AQHMmVHNFHFlRiwU7t eX79ZBcxrJflr/5JeEcr/9Ul1F6eyjsW+VJcCz8+vbzc1nj3HAhkndFO1Rky13CBBv8s b7bRJVIogSku6JimftnhX+Zb+EwoRUqbxb/KIgp1kjQayfql3CtKnz/V7VivbVSTi9RM ze8hvEutRrPh//Shy0cawI46fUEpVKo+nPmSjRytfODl5a0NNT6gN0MXymsDG4ODudKj w+RA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:ui-outboundreport:content-transfer-encoding :in-reply-to:from:content-language:references:to:subject:user-agent :mime-version:date:message-id:dkim-signature; bh=0jjOyskWrTtZzzIWvSKOAEYVWsKiIQdx9scG4AhdcjA=; fh=gAm2TbzCqPbb7Q2yojlx0K/+hV26ieq5DlHXoTA+4M0=; b=DyGRdB3pxijkgM9JNz3kNucxxz6PBTGyAWbMAeTythZhxTXChvgjhHc+8kKlWNm/OD DAzU9yL1GqCsA9S09bAAN6k6letdvjmxAwC3/FO3qDcNYWjGj5+owcYVfRjzH/pj5Vd8 oA87yXynnMMuQN+WORd5UZOK8KDbzg2mgeg9oSlcpQvAmxdMO45xFIJWjsQmBWgjYS6j aeIwnJTKI2QsoGxQ/aM65kKhe552XMiJhX9LceZoWraPz8KVAtXhIz15Vp9+wmAuNH5g nWQBU6eHdTGZ27BQdHE9gpzZKDI3nSa1ZST7D1jOR3msD76UZCB1hZlW4VZP9at2rCIM jVrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmx.de header.s=s31663417 header.b=WxlHU6yj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmx.de Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id t12-20020a170902a5cc00b001cfc4194c96si3292325plq.120.2023.12.01.08.56.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 08:56:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmx.de header.s=s31663417 header.b=WxlHU6yj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmx.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 7DF1F80A13BD; Fri, 1 Dec 2023 08:55:49 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229468AbjLAQzd (ORCPT + 99 others); Fri, 1 Dec 2023 11:55:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34376 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229454AbjLAQzd (ORCPT ); Fri, 1 Dec 2023 11:55:33 -0500 Received: from mout.gmx.net (mout.gmx.net [212.227.17.21]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81530103; Fri, 1 Dec 2023 08:55:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.de; s=s31663417; t=1701449719; x=1702054519; i=eberhard.stoll@gmx.de; bh=0jjOyskWrTtZzzIWvSKOAEYVWsKiIQdx9scG4AhdcjA=; h=X-UI-Sender-Class:Date:Subject:To:References:From:In-Reply-To; b=WxlHU6yj8bCkIrnscZiwLIW1vR3Y+bcbdAHrIvDPIci7G9ZUJ9Bke7uBpsFUQt4S BAC3GVFW0WOp33+4nU3sBegn1DNCohsGgnKd1y/cn9+C+5gDLZdAP1JGg2oIXr9b5 kS3/fvwAChOHf+V3FWakaM/53wxZNy4OaKR1NhLLNhrIdRnZBzQYZtRedBPoDONkp Vf0PI2O7rzGQbTZ9e6cSmWbacchmfYVJXDdYf0kEsbxPTwt9fOKytwi8O1p0R3WZj XYHXKsXqr5+o7epzIT9wCEWmMFO7crccFQiGmid5QexYUvjEflfl6N6/Bn/glV/s3 EQXTGhwUTbtOXfa8NQ== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from [192.168.2.126] ([87.122.194.157]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1M3DJl-1r8Gmg1wwX-003eZg; Fri, 01 Dec 2023 17:55:19 +0100 Message-ID: Date: Fri, 1 Dec 2023 17:55:18 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3] serial: imx: fix tx statemachine deadlock To: Rasmus Villemoes , Paul Geurts , gregkh@linuxfoundation.org, jirislaby@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, u.kleine-koenig@pengutronix.de, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, linux-arm-kernel@lists.infradead.org References: <2023112434-winter-embezzle-1b46@gregkh> Content-Language: en-US From: Eberhard Stoll In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:gHtwEHppOHKCoBAjke6fuy3AVIjVbK56gCiHgPy4cAt0kKKVbnp VNY9QNI/kfnD9Q5UHMlAM7KudUUHbomYJf4HvjFwsktyQHxJmZtierqwWmjY3DaVhdmhSU8 W2NhgO/Uri+AyOhfkgjbo33w7whMPwA9nZl7GgHbB6iM7LtSwMe3s2qEI7liOUKo2x5CW7Q wytgZufFBsauQufXvaYPQ== UI-OutboundReport: notjunk:1;M01:P0:+SJaVTKirck=;jNUiqEylytKupCSA+lzaE5loEAk NKARH8ziCRrbalw/h4pQUlPV8ifcBCQdseBSR2UcSiFXHl7UWUIFtoFVTl490lf/KiLcUE3JM kYHktpsjfKXYyyHA4LYx2hjNIlIvPIywG90Gfu8swm/yV9SUplzS8drpmDsgDbeV94GhwE+mN tSHLHRDqgOlvdoQxPK+Mbj/jQ6u0z43u76+ZsIafqqcYqOW6F+q60RlDXVigg1/WWA56pRE7U asRL6o7nJgK00OeJRZ4zPxHbzJFiLjT25rqe3VGUOwxSibDmT5miPJaxYQxgUOToDCKZ1DwQN 4ccTTfDRjhyGWJSkNXZs2iTpPHq03oXQzFegSjfhseId0XlO2ujewGE3FaL08Pf1GB7Bp+bni 6h9AxKZOTITIoUT92H98iWOddslzib/E2QB/XGqttiDFAp7D2d0OFZVmfK3qY4yu5uxk4BUOd UocfdSZ9zJmiBWdJBkIdye1PV+M1kQkvwJMkNYg+bX8aN35AMZdUsege6mLBVpmjGHdKA/73+ haVwVX80moM4voL5eKGEH1BmlskHD2CgLaYjsu3nVtSpBQrWloabeLEjPKPRjtUzbO5UIuxIL emUkoEf6I6Cp80DhOlfGKgd3PMzc/koo1o+tAp5MgOiPCWWhM3KLnl5MQMdBTc673CW/ye6ad ZVTIOnqlO//0XVS9GetE0A28llEIJpeSoWgPOQsvPXQZsJsIUplwr2NZSQOhoHFpSE+fsXu5M c0btEGtAuvY0Pqt0oimmXAAiAv4O96ZRogQS3+E9zXMBMYqECBfwKKXdDSif8Dn4+CKMmixQ0 nR7eAlL68RE06Eu9ok8E5w0dBWFYegltqcTsyDoYNvVITnqOjSoq1t10g6C2IiYed3OEojfyT lKH/r9PJOGikizeleyg1QI4byLPNa3ZYeXEn8yoOPfgl+5InGCyvTaC3zrdAZ1JCBkuJ+glL7 olBqgt1k+TQ4p355eGQkJC8AjMA= X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Fri, 01 Dec 2023 08:55:49 -0800 (PST) On 30.11.23 10:09, Rasmus Villemoes wrote: > On 24/11/2023 14.37, Rasmus Villemoes wrote: >> On 24/11/2023 14.11, Paul Geurts wrote: >>> When using the serial port as RS485 port, the tx statemachine is used = to >>> control the RTS pin to drive the RS485 transceiver TX_EN pin. When the >>> TTY port is closed in the middle of a transmission (for instance durin= g >>> userland application crash), imx_uart_shutdown disables the interface >>> and disables the Transmission Complete interrupt. afer that, >>> imx_uart_stop_tx bails on an incomplete transmission, to be retriggere= d >>> by the TC interrupt. This interrupt is disabled and therefore the tx >>> statemachine never transitions out of SEND. The statemachine is in >>> deadlock now, and the TX_EN remains low, making the interface useless. >>> >>> imx_uart_stop_tx now checks for incomplete transmission AND whether TC >>> interrupts are enabled before bailing to be retriggered. This makes su= re >>> the state machine handling is reached, and is properly set to >>> WAIT_AFTER_SEND. >>> >>> Fixes: cb1a60923609 ("serial: imx: implement rts delaying for rs485") >>> Signed-off-by: Paul Geurts >> >> Hi Paul >> >> Interestingly, both Eberhard (cc'ed) and I have hit similar problems in >> this driver recently. See the thread >> https://lore.kernel.org/lkml/20231120132256.136625-1-rasmus.villemoes@p= revas.dk/ >> . >> >> It is possible that this also fixes the problems I/we saw, but I can't >> get around to testing until sometime next week. > > This also seems to fix the problem I had when switching to rs232 and > back to rs485, and I agree that it seems to be a cleaner fix than mine. > > I also tried reproducing what Eberhard reported, and I think I managed > to do that, and at least my way of reproducing the tx lockup also seems > to be fixed by this patch. Eberhard, can you test this patch in your set= up? > > In any case, > > Tested-by: Rasmus Villemoes > > Rasmus > Yes, it also works for my test setup! Tested-by: Eberhard Stoll Best regards Eberhard