Linux Serial subsystem development
 help / color / mirror / Atom feed
* [PATCH 0/1] Fix 8250 XON/XOFF for DMA-capable devices
@ 2022-03-14  9:14 Ilpo Järvinen
  2022-03-14  9:14 ` [PATCH 1/1] serial: 8250: fix XOFF/XON sending when DMA is used Ilpo Järvinen
  0 siblings, 1 reply; 3+ messages in thread
From: Ilpo Järvinen @ 2022-03-14  9:14 UTC (permalink / raw)
  To: linux-serial, Greg KH, Jiri Slaby
  Cc: linux-kernel, Johan Hovold, Andy Shevchenko, Miquel Raynal,
	Lukas Wunner, Heikki Krogerus, Gilles Buloz, Ilpo Järvinen

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-03-14 10:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-14  9:14 [PATCH 0/1] Fix 8250 XON/XOFF for DMA-capable devices Ilpo Järvinen
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox