Skip to content

tty: streamline per-char receiving

Peter Hurley linux-serial lkml 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest20 patches 5 repliesIn review
  2. v120 patches 0 repliesSuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/20n_tty: Fix EOF push handlingdrivers/tty/n_tty.c drivers/tty/tty_io.c include/linux/tty.h+17 -190 replies
2/20n_tty: Remove alias ptrs in __receive_buf()drivers/tty/n_tty.c+6 -70 replies
3/20n_tty: Move buffers into n_tty_datadrivers/tty/n_tty.c+9 -160 replies
4/20n_tty: Rename process_char_map to char_mapdrivers/tty/n_tty.c+20 -230 replies
5/20n_tty: Simplify __receive_buf loop countdrivers/tty/n_tty.c+3 -50 replies
6/20n_tty: Factor 'real raw' receive_buf into standalone fndrivers/tty/n_tty.c+30 -210 replies
7/20n_tty: Factor signal char handling into separate fndrivers/tty/n_tty.c+28 -240 replies
8/20n_tty: Factor flagged char handling into separate fndrivers/tty/n_tty.c+29 -210 replies
9/20n_tty: Factor raw mode receive_buf() into separate fndrivers/tty/n_tty.c+19 -50 replies
10/20n_tty: Special case EXTPROC receive_buf() as raw modedrivers/tty/n_tty.c+2 -10 replies
11/20n_tty: Factor tty->closing receive_buf() into separate fndrivers/tty/n_tty.c+39 -110 replies
12/20n_tty: Factor standard per-char i/o into separate fndrivers/tty/n_tty.c+18 -1011 replies
13/20n_tty: Eliminate char tests from IXANY restart testdrivers/tty/n_tty.c+12 -70 replies
14/20n_tty: Split n_tty_receive_char()drivers/tty/n_tty.c+56 -470 replies
15/20n_tty: Factor ISTRIP and IUCLC receive_buf into separate fndrivers/tty/n_tty.c+31 -130 replies
16/20n_tty: Factor PARMRK from normal per-char i/odrivers/tty/n_tty.c+43 -20 replies
17/20n_tty: Remove overflow tests from receive_buf() pathdrivers/tty/n_tty.c+37 -480 replies
18/20n_tty: Un-inline single-use functionsdrivers/tty/n_tty.c+5 -60 replies
19/20n_tty: Factor LNEXT processing from per-char i/o pathdrivers/tty/n_tty.c+95 -720 replies
20/20tty: Remove extra wakeup from pty write() pathdrivers/tty/pty.c+1 -33 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 00/20] tty: streamline per-char receiving

** v2 changes **
- Rebase on v2 of 'mostly lockless tty echo'

This 4th of 4 patchsets implements efficient per-char receiving in the N_TTY line discipline. As mentioned in the initial patchset, 'lockless n_tty receive path', casual performance measurements show a 9~15x speedup in end-to-end copying.

Most of this patchset factors out modal conditions from the per-char i/o path. For example, regardless of if ISTRIP is set or not, the modal condition, I_ISTRIP(tty), was tested on every char received, despite that ISTRIP can only be set by termios changes.

The modes handled by separate code paths are:
1) 'real raw' mode (which was already handled separately)
2) raw mode
3) EXTPROC when ISTRIP and IUCLC are not selected
4) tty closing mode
5) LNEXT mode
6) ISTRIP or IUCLC or IPARMRK set
7) everything else

The code duplication is kept to a minimum by carefully factoring out shared slow paths (such as specially handled chars in canonical mode or receiving PARITY or OVERRUN flags); only the per-char loops themselves are duplicated.

Peter Hurley (20):
n_tty: Fix EOF push handling
n_tty: Remove alias ptrs in __receive_buf()
n_tty: Move buffers into n_tty_data
n_tty: Rename process_char_map to char_map
n_tty: Simplify __receive_buf loop count
n_tty: Factor 'real raw' receive_buf into standalone fn
n_tty: Factor signal char handling into separate fn
n_tty: Factor flagged char handling into separate fn
n_tty: Factor raw mode receive_buf() into separate fn
n_tty: Special case EXTPROC receive_buf() as raw mode
n_tty: Factor tty->closing receive_buf() into separate fn
n_tty: Factor standard per-char i/o into separate fn
n_tty: Eliminate char tests from IXANY restart test
n_tty: Split n_tty_receive_char()
n_tty: Factor ISTRIP and IUCLC receive_buf into separate fn
n_tty: Factor PARMRK from normal per-char i/o
n_tty: Remove overflow tests from receive_buf() path
n_tty: Un-inline single-use functions
n_tty: Factor LNEXT processing from per-char i/o path
tty: Remove extra wakeup from pty write() path

 drivers/tty/n_tty.c  | 617 +++++++++++++++++++++++++++++++--------------------
 drivers/tty/pty.c    |   4 +-
 drivers/tty/tty_io.c |   1 -
 include/linux/tty.h  |   1 -
 4 files changed, 381 insertions(+), 242 deletions(-)
Signature · 1 line
1.8.1.2