Linux Serial subsystem development
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: linux-serial@vger.kernel.org,
	Greg KH <gregkh@linuxfoundation.org>,
	Jiri Slaby <jirislaby@kernel.org>
Cc: linux-kernel@vger.kernel.org, "Johan Hovold" <johan@kernel.org>,
	"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
	"Miquel Raynal" <miquel.raynal@bootlin.com>,
	"Lukas Wunner" <lukas@wunner.de>,
	"Heikki Krogerus" <heikki.krogerus@linux.intel.com>,
	"Gilles Buloz" <gilles.buloz@kontron.com>,
	"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Subject: [PATCH 0/1] Fix 8250 XON/XOFF for DMA-capable devices
Date: Mon, 14 Mar 2022 11:14:31 +0200	[thread overview]
Message-ID: <20220314091432.4288-1-ilpo.jarvinen@linux.intel.com> (raw)

DMA-capable 8250 was not properly taking XON/XOFF into account
right since it was introduced in 2013. There was no attempt to
send x_char out at all which is fixed by this patch.

After making this fix, it was further reported by Gilles Buloz
that also rx side fails to work as expected if the receiving
side is not reading from tty. I took look into that issue and
and determined that XOFF char gets stuck in an intermediate
buffer until enough data can be processed in receive_buf().
So it's not very useful from flow control perspective :-). While
the problem is more likely to occur with DMA, the code does not
look robust and the problem can likely occur also w/o DMA.

I was thinking of fixing the rx side issue by adding lookahead.
The most natural place to call lookahead handler would seem
to be from flush_to_ldisc() in the case when receive_buf() does
not eat all characters that were passed to it. Does anybody have
other opinions on how it should be fixed?

Ilpo Järvinen (1):
  serial: 8250: fix XOFF/XON sending when DMA is used

 drivers/tty/serial/8250/8250_dma.c  | 11 ++++++++++-
 drivers/tty/serial/8250/8250_port.c |  4 +---
 drivers/tty/serial/serial_core.c    | 14 ++++++++++++++
 include/linux/serial_core.h         |  2 ++
 4 files changed, 27 insertions(+), 4 deletions(-)

-- 
2.30.2


             reply	other threads:[~2022-03-14  9:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-14  9:14 Ilpo Järvinen [this message]
2022-03-14  9:14 ` [PATCH 1/1] serial: 8250: fix XOFF/XON sending when DMA is used Ilpo Järvinen
2022-03-14 10:23   ` Andy Shevchenko

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=20220314091432.4288-1-ilpo.jarvinen@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=gilles.buloz@kontron.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=jirislaby@kernel.org \
    --cc=johan@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=lukas@wunner.de \
    --cc=miquel.raynal@bootlin.com \
    /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