devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Richard Laing <richard.laing@alliedtelesis.co.nz>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	 Jiri Slaby <jirislaby@kernel.org>,
	robh+dt@kernel.org,  krzysztof.kozlowski+dt@linaro.org,
	conor+dt@kernel.org,
	 Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	 LKML <linux-kernel@vger.kernel.org>,
	 linux-serial <linux-serial@vger.kernel.org>,
	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.
Date: Mon, 16 Oct 2023 15:20:45 +0300 (EEST)	[thread overview]
Message-ID: <a7e2f6ee-ea44-5fed-1a-274863a5613@linux.intel.com> (raw)
In-Reply-To: <fb92ed83-478-4d71-2bd-ab3a37b1352@linux.intel.com>

[-- Attachment #1: Type: text/plain, Size: 1450 bytes --]

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.

  reply	other threads:[~2023-10-16 12:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-16  1:32 [PATCH] dt-bindings: serial: snps-dw-apb-uart: Add property to drain TX FIFO Richard Laing
2023-10-16  1:32 ` [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 Richard Laing
2023-10-16 12:13   ` Ilpo Järvinen
2023-10-16 12:20     ` Ilpo Järvinen [this message]
2023-10-16  1:32 ` [PATCH] dt-bindings: serial: snps-dw-apb-uart: Add property to drain TX FIFO Richard Laing
2023-10-16  2:19   ` Rob Herring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a7e2f6ee-ea44-5fed-1a-274863a5613@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jirislaby@kernel.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=richard.laing@alliedtelesis.co.nz \
    --cc=robh+dt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).