ldisc patchset
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v5 Latest44 patches 18 repliesIn review
- v432 patches 13 repliesSuperseded
- v323 patches 20 repliesSuperseded
Patches in v5 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/44 | tty: Add diagnostic for halted line disciplinedrivers/ drivers/ include/ | +15 | 0 replies | |
| 2/44 | n_tty: Factor packet mode status change for reusedrivers/ | +14 | 0 replies | |
| 3/44 | n_tty: Don't flush buffer when closing ldiscdrivers/ | +3 | 0 replies | |
| 4/44 | tty: Refactor wait for ldisc refs out of tty_ldisc_hangup()drivers/ | +36 | 0 replies | |
| 5/44 | tty: Remove unnecessary re-test of ldisc ref countdrivers/ | +19 | 0 replies | |
| 6/44 | tty: Fix ldisc halt sequence on hangupdrivers/ | +19 | 0 replies | |
| 7/44 | tty: Relocate tty_ldisc_halt() to avoid forward declarationdrivers/ | +23 | 0 replies | |
| 8/44 | tty: Strengthen no-subsequent-use guarantee of tty_ldisc_halt()drivers/ | +24 | 0 replies | |
| 9/44 | tty: Halt both ldiscs concurrentlydrivers/ | +25 | 0 replies | |
| 10/44 | tty: Wait for SAK work before waiting for hangup workdrivers/ | +1 | 0 replies | |
| 11/44 | n_tty: Correct unthrottle-with-buffer-flush commentsdrivers/ | +5 | 0 replies | |
| 12/44 | n_tty: Fully initialize ldisc before restarting buffer workdrivers/ | +8 | 0 replies | |
| 13/44 | tty: Don't reenable already enabled ldiscdrivers/ drivers/ include/ | +1 | 0 replies | |
| 14/44 | tty: Complete ownership transfer of flip buffersdrivers/ drivers/ drivers/ | +14 | 0 replies | |
| 15/44 | tty: Make core responsible for synchronizing its workdrivers/ drivers/ | +21 | 0 replies | |
| 16/44 | tty: Fix 'deferred reopen' ldisc commentdrivers/ | +5 | 0 replies | |
| 17/44 | tty: Bracket ldisc release with TTY_DEBUG_HANGUP messagesdrivers/ | +4 | 0 replies | |
| 18/44 | tty: Add ldisc hangup debug messagesdrivers/ | +19 | 0 replies | |
| 19/44 | tty: Don't protect atomic operation with mutexdrivers/ | +0 | 0 replies | |
| 20/44 | tty: Separate release semantics of ldisc referencedrivers/ | +35 | 0 replies | |
| 21/44 | tty: Document unsafe ldisc reference acquiredrivers/ | +5 | 0 replies | |
| 22/44 | tty: Fold one-line assign function into callersdrivers/ | +6 | 0 replies | |
| 23/44 | tty: Locate get/put ldisc functions togetherdrivers/ | +23 | 0 replies | |
| 24/44 | tty: Remove redundant tty_wait_until_sent()drivers/ | +0 | 0 replies | |
| 25/44 | tty: Fix recursive deadlock in tty_perform_flush()drivers/ drivers/ drivers/ | +21 | 1 reply | |
| 26/44 | tty: Add read-recursive, writer-prioritized rw semaphoredrivers/ drivers/ include/ | +555 | 5 replies | |
| 27/44 | tty: Drop lock contention stat from ldsem trylocksdrivers/ | +0 | 0 replies | |
| 28/44 | tty: Remove ldsem recursion supportdrivers/ include/ | +8 | 4 replies | |
| 29/44 | tty: Add lock/unlock ldisc pair functionsdrivers/ | +87 | 0 replies | |
| 30/44 | tty: Replace ldisc locking with ldisc_semdrivers/ drivers/ drivers/ +2 more | +48 | 0 replies | |
| 31/44 | tty: Clarify ldisc variabledrivers/ | +7 | 0 replies | |
| 32/44 | tty: Fix hangup race with TIOCSETD ioctldrivers/ | +2 | 0 replies | |
| 33/44 | tty: Clarify multiple-references comment in TIOCSETD ioctldrivers/ | +6 | 0 replies | |
| 34/44 | tty: Fix tty_ldisc_lock name collisiondrivers/ | +12 | 0 replies | |
| 35/44 | tty: Drop "tty is NULL" flip buffer diagnosticdrivers/ | +1 | 0 replies | |
| 36/44 | tty: Inline ldsem down_failed() into down_{read,write}_failed()drivers/ | +57 | 0 replies | |
| 37/44 | tty: Drop ldsem wait typedrivers/ | +2 | 0 replies | |
| 38/44 | tty: Drop wake type optimizationdrivers/ include/ | +21 | 0 replies | |
| 39/44 | tty: Factor ldsem writer trylockdrivers/ | +15 | 0 replies | |
| 40/44 | tty: Simplify lock taking for waiting writersdrivers/ | +16 | 0 replies | |
| 41/44 | tty: Implement ldsem fast path write lock stealingdrivers/ | +11 | 0 replies | |
| 42/44 | tty: Reduce and simplify ldsem atomic opsdrivers/ | +23 | 0 replies | |
| 43/44 | tty: Early-out ldsem write lock stealingdrivers/ | +15 | 0 replies | |
| 44/44 | tty: Early-out tardy ldsem readersdrivers/ | +21 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v5 yet.
Cover letter [PATCH v5 00/44] ldisc patchset
Greg,
This patchset includes
'tty: Drop lock contention stat from ldsem trylocks'
so no need to apply that on this series. Also, I noticed you kept the 'tty is NULL' removal on a different branch so I left my patch in this series that removes it.
This series applies cleanly to tty-next.
v5 changes:
After completing an audit of the recursive use of ldisc references, I discovered the _blocking_ recursive acquisition of ldisc references was limited to line disciplines misusing the tty_perform_flush() function.
With that now resolved in,
'tty: Fix recursive deadlock in tty_perform_flush()'
the recursion design in ldsem has been removed.
The recursion removal is in its own patch,
'tty: Remove ldsem recursion support'
to ease review for those that have already reviewed the ldsem implementation.
In addition, this patchset implements lock stealing derived from the work of Michel Lespinasse <[email protected]> on writer lock stealing in rwsem.
Although the rwsem write lock stealing changes are motivated by performance criteria, these changes are motivated by reduced code line count and simplicity of design.
*** Edited below to remove recursion discussion ***
Back in early December I realized that a classic read/write semaphore with writer priority was the ideal mechanism for handling the line discipline referencing.
Line discipline references act as "readers"; closing or changing the line discipline is prevented while these references are outstanding. Conversely, line discipline references should not be granted while the line discipline is closing or changing; these are the "writers".
Unfortunately, the existing rwsem uses a FIFO priority for waiting threads and does not support timeouts.
So this implements just that: a writer-priority
read/write semaphore with timed waits.
Initially, it was my intention to have this in 2 patchsets but since the v2 and v3 patchsets were pushed back, this ends up being an all-in-one :)
Other changes in v4 from v3:
- From Jiri's review of v3:
'tty: Add diagnostic for halted line discipline' was split:
the function relocation is now in a separate patch, 'tty: Relocate tty_ldisc_halt() to avoid forward declaration'
'n_tty: Factor packet mode status change for reuse':
packet_mode_flush() was renamed n_tty_packet_mode_flush()
'tty: Refactor wait for ldisc refs out of tty_ldisc_hangup()':
the parentheses were removed in the return value conversion.
'tty: Strengthen no-subsequent-use guarantee of tty_ldisc_halt()':
although addressed in the follow-on patch, the timeout values are now identical so as to avoid confusion in reviewing.
'tty: Kick waiters _after_ the ldisc is locked' was dropped:
although my logic is solid, this change made the conversion to a r/w semaphore awkward-looking. I think it makes sense to fix this separately in n_tty anyway.
'tty: Remove unnecessary buffer work flush' was merged with
new patch 'tty: Complete ownership transfer of flip buffers'
Patches 19-31 implement the switch to ldsem.
Patch 32 removes the 'tty is NULL' diagnostic. The logic supporting this change is in the commit message but I'll repeat it here:
Now that the driver i/o path is separate from tty lifetimes (implemented in Jiri's last patch series, soon to be in 3.9-rc1), a driver may unknowingly submit i/o to a tty that no longer exists. There is little sense in WARNing about an expected outcome.
Patch 14/32 'tty: Complete ownership transfer of flip buffers' ensures that no bad will come of the superfluous work -- other than that work for no-good-reason was submitted in the first place -- by waiting for work that may have retrieved what will soon be a stale tty value and by cancelling outstanding work before the port is destroyed (the work is owned by the port and contained within its structure).
As before, this series passes the stress tests that Ilya wrote plus some new ones that I have written.
Peter Hurley (44):
tty: Add diagnostic for halted line discipline
n_tty: Factor packet mode status change for reuse
n_tty: Don't flush buffer when closing ldisc
tty: Refactor wait for ldisc refs out of tty_ldisc_hangup()
tty: Remove unnecessary re-test of ldisc ref count
tty: Fix ldisc halt sequence on hangup
tty: Relocate tty_ldisc_halt() to avoid forward declaration
tty: Strengthen no-subsequent-use guarantee of tty_ldisc_halt()
tty: Halt both ldiscs concurrently
tty: Wait for SAK work before waiting for hangup work
n_tty: Correct unthrottle-with-buffer-flush comments
n_tty: Fully initialize ldisc before restarting buffer work
tty: Don't reenable already enabled ldisc
tty: Complete ownership transfer of flip buffers
tty: Make core responsible for synchronizing its work
tty: Fix 'deferred reopen' ldisc comment
tty: Bracket ldisc release with TTY_DEBUG_HANGUP messages
tty: Add ldisc hangup debug messages
tty: Don't protect atomic operation with mutex
tty: Separate release semantics of ldisc reference
tty: Document unsafe ldisc reference acquire
tty: Fold one-line assign function into callers
tty: Locate get/put ldisc functions together
tty: Remove redundant tty_wait_until_sent()
tty: Fix recursive deadlock in tty_perform_flush()
tty: Add read-recursive, writer-prioritized rw semaphore
tty: Drop lock contention stat from ldsem trylocks
tty: Remove ldsem recursion support
tty: Add lock/unlock ldisc pair functions
tty: Replace ldisc locking with ldisc_sem
tty: Clarify ldisc variable
tty: Fix hangup race with TIOCSETD ioctl
tty: Clarify multiple-references comment in TIOCSETD ioctl
tty: Fix tty_ldisc_lock name collision
tty: Drop "tty is NULL" flip buffer diagnostic
tty: Inline ldsem down_failed() into down_{read,write}_failed()
tty: Drop ldsem wait type
tty: Drop wake type optimization
tty: Factor ldsem writer trylock
tty: Simplify lock taking for waiting writers
tty: Implement ldsem fast path write lock stealing
tty: Reduce and simplify ldsem atomic ops
tty: Early-out ldsem write lock stealing
tty: Early-out tardy ldsem readers
drivers/net/ppp/ppp_async.c | 2 +- drivers/net/ppp/ppp_synctty.c | 2 +- drivers/tty/Makefile | 2 +- drivers/tty/n_tty.c | 62 +++-- drivers/tty/tty_buffer.c | 4 +- drivers/tty/tty_io.c | 33 ++- drivers/tty/tty_ioctl.c | 28 ++- drivers/tty/tty_ldisc.c | 551 +++++++++++++++--------------------------- drivers/tty/tty_ldsem.c | 450 ++++++++++++++++++++++++++++++++++ drivers/tty/tty_port.c | 1 + include/linux/tty.h | 7 +- include/linux/tty_ldisc.h | 49 +++- 12 files changed, 779 insertions(+), 412 deletions(-) create mode 100644 drivers/tty/tty_ldsem.c
Signature · 1 line
1.8.1.2