1. 19 3月, 2013 1 次提交
    • P
      tty: Add safe tty throttle/unthrottle functions · 70bc1264
      Peter Hurley 提交于
      The tty driver can become stuck throttled due to race conditions
      between throttle and unthrottle, when the decision to throttle
      or unthrottle is conditional. The following example helps to
      illustrate the race:
      
        CPU 0                        |  CPU 1
                                     |
      if (condition A)               |
                                     | <processing such that A not true>
                                     | if (!condition A)
                                     |     unthrottle()
          throttle()                 |
                                     |
      
      Note the converse is also possible; ie.,
      
        CPU 0                        |  CPU 1
                                     |
                                     | if (!condition A)
      <processing such that A true>  |
      if (condition A)               |
          throttle()                 |
                                     |     unthrottle()
                                     |
      
      Add new throttle/unthrottle functions based on the familiar model
      of task state and schedule/wake. For example,
      
          while (1) {
              tty_set_flow_change(tty, TTY_THROTTLE_SAFE);
              if (!condition)
                  break;
              if (!tty_throttle_safe(tty))
                  break;
          }
          __tty_set_flow_change(tty, 0);
      
      In this example, if an unthrottle occurs after the condition is
      evaluated but before tty_throttle_safe(), then tty_throttle_safe()
      will return non-zero, looping and forcing the re-evaluation of
      condition.
      Reported-by: NVincent Pillet <vincentx.pillet@intel.com>
      Signed-off-by: NPeter Hurley <peter@hurleysoftware.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      70bc1264
  2. 05 2月, 2013 1 次提交
  3. 19 1月, 2013 1 次提交
    • I
      tty: Add driver unthrottle in ioctl(...,TCFLSH,..). · a1bf9584
      Ilya Zykov 提交于
      Regression 'tty: fix "IRQ45: nobody cared"'
      Regression commit 7b292b4b
      
        Function reset_buffer_flags() also invoked during the ioctl(...,TCFLSH,..).
      At the time of request we can have full buffers and throttled driver too.
      If we don't unthrottle driver, we can get forever throttled driver, because,
      after request, we will have empty buffers and throttled driver and
      there is no place to unthrottle driver.
      It simple reproduce with "pty" pair then one side sleep on tty->write_wait,
      and other side do ioctl(...,TCFLSH,..). Then there is no place to do writers wake up.
      Signed-off-by: NIlya Zykov <ilya@ilyx.ru>
      Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a1bf9584
  4. 26 10月, 2012 1 次提交
  5. 18 7月, 2012 1 次提交
  6. 17 7月, 2012 1 次提交
  7. 29 3月, 2012 1 次提交
  8. 19 10月, 2011 1 次提交
    • T
      tty: Support compat_ioctl get/set termios_locked · 8193c429
      Thomas Meyer 提交于
      When running a Fedora 15 (x86) on an x86_64 kernel, in the boot process
      plymouthd complains about those two missing ioctls:
      [    2.581783] ioctl32(plymouthd:186): Unknown cmd fd(10) cmd(00005457){t:'T';sz:0} arg(ffb6a5d0) on /dev/tty1
      [    2.581803] ioctl32(plymouthd:186): Unknown cmd fd(10) cmd(00005456){t:'T';sz:0} arg(ffb6a680) on /dev/tty1
      
      both ioctl functions work on the 'struct termios' resp. 'struct termios2',
      which has the same size (36 bytes resp. 44 bytes) on x86 and x86_64,
      so it's just a matter of converting the pointer from userland.
      Signed-off-by: NThomas Meyer <thomas@m3y3r.de>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
      Signed-off-by: NAndrew Morton <akpm@google.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      8193c429
  9. 20 4月, 2011 1 次提交
  10. 12 4月, 2011 1 次提交
  11. 31 3月, 2011 1 次提交
  12. 18 2月, 2011 1 次提交
  13. 05 11月, 2010 1 次提交
  14. 11 8月, 2010 1 次提交
    • H
      tty: Add EXTPROC support for LINEMODE · 26df6d13
      hyc@symas.com 提交于
      This patch is against the 2.6.34 source.
      
      Paraphrased from the 1989 BSD patch by David Borman @ cray.com:
      
           These are the changes needed for the kernel to support
           LINEMODE in the server.
      
           There is a new bit in the termios local flag word, EXTPROC.
           When this bit is set, several aspects of the terminal driver
           are disabled.  Input line editing, character echo, and mapping
           of signals are all disabled.  This allows the telnetd to turn
           off these functions when in linemode, but still keep track of
           what state the user wants the terminal to be in.
      
           New ioctl:
               TIOCSIG         Generate a signal to processes in the
                               current process group of the pty.
      
           There is a new mode for packet driver, the TIOCPKT_IOCTL bit.
           When packet mode is turned on in the pty, and the EXTPROC bit
           is set, then whenever the state of the pty is changed, the
           next read on the master side of the pty will have the TIOCPKT_IOCTL
           bit set.  This allows the process on the server side of the pty
           to know when the state of the terminal has changed; it can then
           issue the appropriate ioctl to retrieve the new state.
      
      Since the original BSD patches accompanied the source code for telnet
      I've left that reference here, but obviously the feature is useful for
      any remote terminal protocol, including ssh.
      
      The corresponding feature has existed in the BSD tty driver since 1989.
      For historical reference, a good copy of the relevant files can be found
      here:
      
      http://anonsvn.mit.edu/viewvc/krb5/trunk/src/appl/telnet/?pathrev=17741Signed-off-by: NHoward Chu <hyc@symas.com>
      Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      
      26df6d13
  15. 09 11月, 2009 1 次提交
  16. 20 9月, 2009 1 次提交
  17. 13 7月, 2009 1 次提交
  18. 17 6月, 2009 1 次提交
  19. 11 6月, 2009 2 次提交
    • A
      tty: Untangle termios and mm mutex dependencies · 26a2e20f
      Alan Cox 提交于
      Although this doesn't cause any problems it could potentially do so for
      future mmap using devices. No real work is needed to sort it out so untangle
      it before it causes problems
      Signed-off-by: NAlan Cox <alan@linux.intel.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      26a2e20f
    • A
      tty: throttling race fix · 38db8979
      Alan Cox 提交于
      The tty throttling code can race due to the lock drops. It takes very high
      loads but this has been observed and verified by Rob Duncan.
      
      The basic problem is that on an SMP box we can go
      
      	CPU #1				CPU #2
      	need to throttle ?
      	suppose we should		buffer space cleared
      					are we throttled
      					yes ? - unthrottle
      	call throttle method
      
      This changeet take the termios lock to protect against this. The termios
      lock isn't the initial obvious candidate but many implementations of throttle
      methods already need to poke around their own termios structures (and nobody
      really locks them against a racing change of flow control).
      
      This does mean that anyone who is setting tty->low_latency = 1 and then
      calling tty_flip_buffer_push from their unthrottle method is going to end up
      collapsing in a pile of locks. However we've removed all the known bogus
      users of low_latency = 1 and such use isn't safe anyway for other reasons so
      catching it would be an improvement.
      Signed-off-by: NAlan Cox <alan@lxorguk.ukuu.org.uk>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      38db8979
  20. 16 1月, 2009 1 次提交
  21. 14 10月, 2008 4 次提交
  22. 28 8月, 2008 1 次提交
  23. 21 7月, 2008 1 次提交
    • A
      tty: Ldisc revamp · a352def2
      Alan Cox 提交于
      Move the line disciplines towards a conventional ->ops arrangement.  For
      the moment the actual 'tty_ldisc' struct in the tty is kept as part of
      the tty struct but this can then be changed if it turns out that when it
      all settles down we want to refcount ldiscs separately to the tty.
      
      Pull the ldisc code out of /proc and put it with our ldisc code.
      Signed-off-by: NAlan Cox <alan@redhat.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      a352def2
  24. 24 6月, 2008 1 次提交
  25. 30 4月, 2008 6 次提交
  26. 09 2月, 2008 1 次提交
  27. 09 1月, 2008 1 次提交
  28. 24 12月, 2007 1 次提交
    • C
      tty: fix logic change introduced by wait_event_interruptible_timeout() · db99247a
      Cory T. Tusar 提交于
      Commit 5a52bd4a introduced a subtle logic
      change in tty_wait_until_sent().  The original version would only error out
      of the 'do { ...  } while (timeout)' loop if signal_pending() evaluated to
      true; a timeout or break due to an empty buffer would fall out of the loop
      and into the tty->driver->wait_until_sent handling.  The current
      implementation will error out on either a pending signal or an empty
      buffer, falling through to the tty->driver->wait_until_sent handling only
      on a timeout.
      
      The ->wait_until_sent() will not be reached if the buffer empties before
      timeout jiffies have elapsed.  This behavior differs from that prior to commit
      5a52bd4a.
      
      I turned this up while using a little serial download utility to bootstrap an
      ARM-based eval board.  The util worked fine on 2.6.22.x, but consistently
      failed on 2.6.23.x.  Once I'd determined that, I narrowed things down with git
      bisect, and found the above difference in logic in tty_wait_until_sent() by
      inspection.
      
      This change reverts the logic flow in tty_wait_until_sent() to match that
      prior to the aforementioned commit.
      Signed-off-by: NCory T. Tusar <ctusar@videon-central.com>
      Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
      Acked-by: NJiri Slaby <jirislaby@gmail.com>
      Cc: <stable@kernel.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      db99247a
  29. 07 11月, 2007 1 次提交
    • A
      [TTY]: Fix network driver interactions with TCGET/SET calls. · 0fc00e24
      Alan Cox 提交于
      Dave Miller noted various cases where line disciplines for things like
      ppp go poking around in termios themselves in ways that broke with the
      new termios code. Rather than have them all learning about termios
      internals provide proper methods for this
      
      - tty_mode_ioctl()
      
      	This handles all the terminal mode handling for speed/carrier
      etc and none of the methods are ldisc dependant so they can be called
      by any user
      
      - tty_perform_flush()
      
      	This extracts the flush functionality and enables pppd the ppp
      layer to share it cleanly.
      
      The existing n_tty_ioctl code is refactored in this patch to provide
      the new functions and to call them itself appropriately. This patch
      has no (intended) behaviour changes and simply prepares for the other
      fixes.
      Signed-off-by: NAlan Cox <alan@redhat.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      0fc00e24
  30. 20 10月, 2007 1 次提交
  31. 19 10月, 2007 1 次提交