Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp2457553rdg; Mon, 16 Oct 2023 05:21:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFkxGP650lPbQ5nOMdHYumi/hwE0QpLmrnf+VmKmiGqsQKVCdYl4a3XmIS7JC3X6WuDntnh X-Received: by 2002:a05:6a00:17a1:b0:6b5:a01f:f7fd with SMTP id s33-20020a056a0017a100b006b5a01ff7fdmr10029358pfg.0.1697458888725; Mon, 16 Oct 2023 05:21:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697458888; cv=none; d=google.com; s=arc-20160816; b=Pk7jPWnYoeazrfWrpl8u2IyBLRxdeb7f6JXGbzllHy2CQRgLkZn4YYPCa4YOl4griA zFFb7P1HPYGJH1mO71Ny9mSQQxb3AfsnAmlk0/24gLTRI7Y6DRk48s6LlRDW325LWX06 HQZGTo3TTnn886lCz0nWCjgHJ5hl8Ign95GAEBJSNXsrBuWJnsgrCDoto0bEclCMYKFg 2grkE9OBCjhZJ1hutfkx6Pkd4MZQVrqVfvMSM9Acn093wDnv41inhQitAw3AJrh8tXb4 ajWhoE+WB65w+2NUr2zVvVM9FIL7nl5svHhymGbPZP1wFwa4raVwf3fZJtzwwEsqLh8x /yZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:message-id:in-reply-to :subject:cc:to:from:date:dkim-signature; bh=BhbyzrnlrauTzg/jQHkJNvARpTm9FUpQqKA4zb/PvRk=; fh=f9nxaEkbhU4TeIXk4YBMDAl6l9ISBQa1tuvprVgsj2s=; b=KGH2tyWy6v7ojoxe/LLReAVhx7mEqqq3x/CoHPlC1I1NPLv4KLH6cpA8cuqshVOmTK q0uLfJ0yImEjMZNTFuuPNOHG1AdHo33sWFRCconvf+9HK+j2rNsCa3IMWYLahJlrE1Sz /tgBc+/+4IDY2cnOQ22lqcq8rV0y3DgcVi8iEuqqLzID31ZbPpejobgZGXJO8vE6nCfO Amc1pA1AdCxYnHRI1AdpzTvJe4i+wsFFs2RRcyqqSxXTXms3oHldINzEh4Owog02EgID Atghef3cdD5q7XJtonBelh+TGCY5D8MmnrOFZhcSG+WTB1kEyMtuy+Yx47ms29TD41+k QRkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=jQLFpGoH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id t22-20020a056a00139600b00690daa48517si24106324pfg.200.2023.10.16.05.21.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 05:21:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=jQLFpGoH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 6067C807C6EE; Mon, 16 Oct 2023 05:21:10 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229621AbjJPMUy (ORCPT + 99 others); Mon, 16 Oct 2023 08:20:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231508AbjJPMUx (ORCPT ); Mon, 16 Oct 2023 08:20:53 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC4F88E; Mon, 16 Oct 2023 05:20:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697458850; x=1728994850; h=date:from:to:cc:subject:in-reply-to:message-id: references:mime-version; bh=ju6GSa3Te5xfMivOhV89l8PydA1byI2D3QT5q1MaBTk=; b=jQLFpGoHrgvv22l5pYgV3OOGvaQ2DRHsZyoMQ5zJ8PSGPX/AZofYHRLg g5mtShEOtSdzx8gwfUMAHobKMhVl6w2o88oDZfyLTYTWPPpAMJ+IB0h04 FFvfJtx47+Go2LR85ldxwgtzAHREEtLzxtnSuSPs4qeNNslu8oHWwd1RH 4wbxrlgUk3HlFvvnoUq2+FeoDBJec1GRNDHzMZWi0lOfdA0lmfhlskqlO kAk6ZlyUw0LmMwuJddGd7MlGaaGaDMPSG6dt7rnn7mRiKje+hzfF1lCOD PcocEJ5dapJR+auw4wQjENsuybskJj9mJ2GjzsXHwkuppA4Zlij+osRty w==; X-IronPort-AV: E=McAfee;i="6600,9927,10863"; a="416582456" X-IronPort-AV: E=Sophos;i="6.03,229,1694761200"; d="scan'208";a="416582456" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Oct 2023 05:20:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10863"; a="879410152" X-IronPort-AV: E=Sophos;i="6.03,229,1694761200"; d="scan'208";a="879410152" Received: from rhaeussl-mobl.ger.corp.intel.com ([10.252.59.103]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Oct 2023 05:20:47 -0700 Date: Mon, 16 Oct 2023 15:20:45 +0300 (EEST) From: =?ISO-8859-15?Q?Ilpo_J=E4rvinen?= To: Richard Laing cc: Greg Kroah-Hartman , Jiri Slaby , robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, Andy Shevchenko , LKML , linux-serial , devicetree@vger.kernel.org Subject: Re: [PATCH] serial: 8250_dw: Allow TX FIFO to drain before writing to UART_LCR An issue has been observed on the Broadcom BCM56160 serial port which appears closely related to a similar issue on the Marvell Armada 38x serial port. In-Reply-To: Message-ID: References: <20231016013207.2249946-1-richard.laing@alliedtelesis.co.nz> <20231016013207.2249946-2-richard.laing@alliedtelesis.co.nz> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="8323329-344325805-1697458849=:1986" X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 16 Oct 2023 05:21:10 -0700 (PDT) This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323329-344325805-1697458849=:1986 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 8BIT On Mon, 16 Oct 2023, Ilpo J?rvinen wrote: > On Mon, 16 Oct 2023, Richard Laing wrote: > > Your subject line is way too long. If you refer to some other issue, > please link to it properly with commit id and/or with Link: tags. > > > Writes to UART_LCR can result in characters that are currently held in the > > TX FIFO being lost rather than sent, even if the userspace process has > > attempted to flush them. > > > > This is most visible when using the "resize" command (tested on Busybox), > > where we have observed the escape code for restoring cursor position > > becoming mangled. > > > > Since this appears to be a more common problem add a new driver option > > to flush the TX FIFO before writing to the UART_LCR. > > This looks like a problem we already have solution for, the userspace can > use TCSADRAIN/FLUSH to indicate what kind of flushing it wants for Tx > when it makes the tcsetattr() call. Thus, userspace can avoid the Tx side > corruption as long as its behavior is sane and doesn't e.g. try to race > writes with tcsetattr() call as mentioned in commit 094fb49a2d0d ("tty: > Prevent writing chars during tcsetattr TCSADRAIN/FLUSH"). I'm sorry, it was actually mentioned in commit 146a37e05d62 ("serial: 8250: Fix serial8250_tx_empty() race with DMA Tx") although that 094fb49a2d0d is also related to the draining. > Have you tried to use the userspace solution? Isn't it working for some > reason? -- i. --8323329-344325805-1697458849=:1986--