Skip to content

tty/serial flow control fixes

Peter Hurley linux-serial lkml netdev sparclinux 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest14 patches 1 replyIn review
  2. v126 patches 25 repliesSuperseded

Changes in v2 from the cover letter

1. Omits v1 patches 1-12 which you already applied
2. Depends on 'locking: Add WARN_ON_ONCE lock assertion',
which replaces v1 patch 13
3. Works around Alpha EV4/5 non-atomic byte/short storage
4. Works around gcc bug in versions < 4.7.2, where bitfield stores can corrupt adjacent storage on ia64, ppc64, sparc64 and 64-bit parisc arches
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52080

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/14serial: core: Document and assert lock requirements for irq helpersdrivers/tty/serial/serial_core.c+8 -00 replies
2/14serial: core: Privatize modem status enable flagsdrivers/tty/serial/mxs-auart.c drivers/tty/serial/serial_core.c include/linux/serial_core.h+30 -130 replies
3/14isdn: i4l: Remove ASYNC_CTS_FLOWdrivers/isdn/i4l/isdn_tty.c+0 -50 replies
4/14serial: core: Privatize tty->hw_stoppeddrivers/tty/serial/bfin_uart.c drivers/tty/serial/serial_core.c include/linux/serial_core.h+22 -230 replies
5/14usb: serial: Remove unused tty->hw_stoppeddrivers/usb/serial/digi_acceleport.c drivers/usb/serial/io_ti.c drivers/usb/serial/ti_usb_3410_5052.c+3 -181 reply
6/14serial: bfin-uart: Fix auto CTSdrivers/tty/serial/bfin_uart.c+2 -10 replies
7/14serial: core: Use spin_lock_irq() in uart_set_termios()drivers/tty/serial/serial_core.c+4 -50 replies
8/14tty: Convert tty_struct bitfield to intsinclude/linux/tty.h+4 -10 replies
9/14tty: Serialize tty flow control changes with flow_lockdrivers/tty/tty_io.c include/linux/tty.h include/linux/tty_driver.h+36 -120 replies
10/14tty: Move packet mode flow control notifications to pty driverdrivers/tty/pty.c drivers/tty/tty_io.c+45 -270 replies
11/14tty: Serialize tcflow() with other tty flow control changesdrivers/tty/tty_ioctl.c include/linux/tty.h+9 -40 replies
12/14tty: Move and rename send_prio_char() as tty_send_xchar()drivers/tty/tty_io.c drivers/tty/tty_ioctl.c include/linux/tty.h+34 -350 replies
13/14tty: Hold termios_rwsem for tcflow(TCIxxx)drivers/tty/tty_ioctl.c+7 -30 replies
14/14tty: Workaround Alpha non-atomic byte storage in tty_structinclude/linux/tty.h+3 -20 replies

Reviews trailers per patch

1 of 14 patches has a Reviewed-by or Acked-by.

PatchJohan Hovold
1/14
2/14
3/14
4/14
5/14A-b
6/14
7/14
8/14
9/14
10/14
11/14
12/14
13/14
14/14

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 00/14] tty/serial flow control fixes

Hi Greg,

Changes since v1:
1. Omits v1 patches 1-12 which you already applied
2. Depends on 'locking: Add WARN_ON_ONCE lock assertion',
which replaces v1 patch 13
3. Works around Alpha EV4/5 non-atomic byte/short storage
4. Works around gcc bug in versions < 4.7.2, where bitfield stores can corrupt adjacent storage on ia64, ppc64, sparc64 and 64-bit parisc arches
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52080

v1:

This patch series reworks the internals of tty and serial flow control to fix multiple races in both START/STOP flow control and RTS/CTS flow control.

The main changes in this series are:
Patch 2 (v1 patch 15)
Rename and move ASYNC_CTS_FLOW and ASYNC_CHECK_CD statuses into a private field for the serial core, and add helper functions to test those statuses for UART drivers.

This is a necessary step toward making tty port->flags SMP-safe, without introducing a new lock.

Patches 1, 4 and 8 (v1 patches 14, 17 and 21)
Make CTS flow control state SMP-safe, by moving hw_stopped into a private field of the serial core.

Patches 9-11 (v1 patches 22-24)
Make tty flow control changes mutually exclusive.

Protecting tty->stopped and tty->flow_stopped with a new spin lock (instead of the ->ctrl_lock) is required to fix multiple races with controlling terminal changes, coming in a follow-on patch series.

Patches 12 & 13 (v1 patches 25 & 26)
Cleanup tcflow(TCIxxx)

Regards,

Peter Hurley (14):
serial: core: Document and assert lock requirements for irq helpers
serial: core: Privatize modem status enable flags
isdn: i4l: Remove ASYNC_CTS_FLOW
serial: core: Privatize tty->hw_stopped
usb: serial: Remove unused tty->hw_stopped
serial: bfin-uart: Fix auto CTS
serial: core: Use spin_lock_irq() in uart_set_termios()
tty: Convert tty_struct bitfield to ints
tty: Serialize tty flow control changes with flow_lock
tty: Move packet mode flow control notifications to pty driver
tty: Serialize tcflow() with other tty flow control changes
tty: Move and rename send_prio_char() as tty_send_xchar()
tty: Hold termios_rwsem for tcflow(TCIxxx)
tty: Workaround Alpha non-atomic byte storage in tty_struct

 drivers/isdn/i4l/isdn_tty.c           |  5 --
 drivers/tty/pty.c                     | 41 +++++++++++++++
 drivers/tty/serial/bfin_uart.c        | 15 +++---
 drivers/tty/serial/mxs-auart.c        |  2 +-
 drivers/tty/serial/serial_core.c      | 70 +++++++++++++++-----------
 drivers/tty/tty_io.c                  | 93 ++++++++++++++++++++++-------------
 drivers/tty/tty_ioctl.c               | 47 +++++-------------
 drivers/usb/serial/digi_acceleport.c  |  7 +--
 drivers/usb/serial/io_ti.c            |  7 +--
 drivers/usb/serial/ti_usb_3410_5052.c |  7 +--
 include/linux/serial_core.h           | 15 +++++-
 include/linux/tty.h                   | 15 ++++--
 include/linux/tty_driver.h            |  4 ++
 13 files changed, 193 insertions(+), 135 deletions(-)
Signature · 1 line
2.1.0