1. 23 10月, 2012 9 次提交
    • J
      TTY: n_tty, remove bogus checks · 3383427a
      Jiri Slaby 提交于
      * BUG_ON(!tty) in n_tty_set_termios -- it cannot be called with tty ==
        NULL. It is called from two call sites. First, from n_tty_open where
        we have a valid tty. Second, as ld->ops->set_termios from
        tty_set_termios. But there we have a valid tty too.
      * if (!tty) in n_tty_open -- why would the TTY layer call ldisc's
        open with an invalid TTY? No it indeed does not. All call sites have
        a tty and dereference that.
      * BUG_ON(!tty->read_buf) in n_tty_read -- this used to be a valid
        check. The ldisc handling was broken some time ago when I added the
        check to ensure everything is OK. It still can catch the case, but
        no later than we move the buffer to ldisc data. Then there will be
        no read_buf in tty_struct, i.e. nothing to check for.
      * if (!tty->read_buf) in n_tty_receive_buf -- this should never
        happen. All callers of ldisc->ops->receive_ops should hold a
        reference to an ldisc and close (which frees read_buf) cannot be
        called until the reference is dropped.
      * if (WARN_ON(!tty->read_buf)) in n_tty_read -- the same as in the
        previous case.
      Signed-off-by: NJiri Slaby <jslaby@suse.cz>
      Acked-by: NAlan Cox <alan@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3383427a
    • J
      TTY: n_tty, simplify read_buf+echo_buf allocation · b91939f5
      Jiri Slaby 提交于
      ldisc->open and close are called only once and cannot cross. So the
      tests in open and close are superfluous. Remove them. (But leave sets
      to NULL to ensure there is not a bug somewhere.)
      
      And when the tests are gone, handle properly failures in open. We
      leaked read_buf if allocation of echo_buf failed before. Now this is
      not the case anymore.
      Signed-off-by: NJiri Slaby <jslaby@suse.cz>
      Acked-by: NAlan Cox <alan@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b91939f5
    • J
      TTY: ldisc, wait for idle ldisc in release · 31e12128
      Jiri Slaby 提交于
      We reintroduced tty_ldisc_wait_idle in 100eeae2 (TTY: restore
      tty_ldisc_wait_idle) and used in set_ldisc. Then we added it also to
      the hangup path in 92f6fa09 (TTY: ldisc, do not close until there
      are readers). And we noted that there is one more path:
      ~   Before 65b77046 tty_ldisc_wait_idle was called also from
      ~   tty_ldisc_release. It is called from tty_release, so I don't think
      ~   we need to restore that one.
      
      Well, I was wrong. There might still be holders of an ldisc
      reference. Not from userspace, but drivers. If they take a reference
      and a user closes the device immediately after that, we have a
      problem. ldisc is halted and closed by TTY, but the driver still may
      call some ldisc's operation and cause a crash.
      
      So restore the tty_ldisc_wait_idle call also to the third location
      where it was before 65b77046 (tty-ldisc: turn ldisc user count
      into a proper refcount). Now we should be safe with respect to the
      ldisc reference counting as all* tty_ldisc_close paths are safely
      called with reference count of one.
      
      * Not the one in tty_ldisc_setup's fail path. But that is called
        before the first open finishes. So userspace does not see it yet.
        Even thought the driver is given the TTY already via ->install, it
        should not take a reference to the ldisc yet. If some driver is to
        do this, we should put one tty_ldisc_wait_idle also in the setup.
      Signed-off-by: NJiri Slaby <jslaby@suse.cz>
      Acked-by: NAlan Cox <alan@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      31e12128
    • J
      TTY: vt, fix paste_selection ldisc handling · 7ee00fdb
      Jiri Slaby 提交于
      There used to be a single tty_ldisc_ref_wait. But then, when a
      big-tty-mutex (BTM) was introduced, it has to be tty_ldisc_ref +
      tty_unlock + tty_ldisc_ref_wait + tty_lock. Later, BTM was removed
      from that path and tty_ldisc_ref + tty_ldisc_ref_wait remained there.
      But it makes no sense now. So leave there only tty_ldisc_ref_wait.
      
      And when we have a reference to an ldisc, actually use it in the loop.
      Otherwise it may be racy.
      Signed-off-by: NJiri Slaby <jslaby@suse.cz>
      Acked-by: NAlan Cox <alan@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7ee00fdb
    • J
      TTY: move devpts kill to pty · fa2ecfc5
      Jiri Slaby 提交于
      Now that we have control over tty->driver_data in pty, we can just
      kill the /dev/pts/ in pty code too. Namely, in ->shutdown hook of
      tty. For pty, this is called only once, for whichever end is closed
      last. But we don't care, both driver_data are the inode as it used to
      be till now.
      Signed-off-by: NJiri Slaby <jslaby@suse.cz>
      Acked-by: NAlan Cox <alan@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      fa2ecfc5
    • J
      TTY: devpts, do not set driver_data · f11afb61
      Jiri Slaby 提交于
      The goal is to stop setting and using tty->driver_data in devpts code.
      It should be used solely by the driver's code, pty in this case.
      
      Now driver_data are managed only in the pty driver. devpts_pty_new is
      switched to accept what we used to dig out of tty_struct, i.e. device
      node number and index.
      
      This also removes a note about driver_data being set outside of the
      driver.
      Signed-off-by: NJiri Slaby <jslaby@suse.cz>
      Acked-by: NAlan Cox <alan@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f11afb61
    • J
      TTY: devpts, return created inode from devpts_pty_new · 162b97cf
      Jiri Slaby 提交于
      The goal is to stop setting and using tty->driver_data in devpts code.
      It should be used solely by the driver's code, pty in this case.
      
      For the cleanup of layering, we will need the inode created in
      devpts_pty_new to be stored into slave's driver_data. So we convert
      devpts_pty_new to return the inode or an ERR_PTR-encoded error in case
      of failure.
      
      The move of 'inode = new_inode(sb);' from declarators to the code is
      only cosmetical, but it makes the code easier to read.
      Signed-off-by: NJiri Slaby <jslaby@suse.cz>
      Acked-by: NAlan Cox <alan@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      162b97cf
    • J
      TTY: devpts, don't care about TTY in devpts_get_tty · 8fcbaa2b
      Jiri Slaby 提交于
      The goal is to stop setting and using tty->driver_data in devpts code.
      It should be used solely by the driver's code, pty in this case.
      
      First, here we remove TTY from devpts_get_tty and rename it to
      devpts_get_priv. Note we do not remove type safety, we just shift the
      [implicit] (void *) cast one layer up.
      
      index was unused in devpts_get_tty, so remove that from the prototype
      too.
      Signed-off-by: NJiri Slaby <jslaby@suse.cz>
      Acked-by: NAlan Cox <alan@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8fcbaa2b
    • I
      tty: prevent unnecessary work queue lock checking on flip buffer copy · cee4ad1e
      Ivo Sieben 提交于
      When low_latency flag is set the TTY receive flip buffer is copied to the
      line discipline directly instead of using a work queue in the background.
      Therefor only in case a workqueue is actually used for copying data to the
      line discipline we'll have to flush the workqueue.
      
      This prevents unnecessary spin lock/unlock on the workqueue spin lock that
      can cause additional scheduling overhead on a PREEMPT_RT system. On a 200
      MHz AT91SAM9261 processor setup this fixes about 100us of scheduling
      overhead on the TTY read call.
      Signed-off-by: NIvo Sieben <meltedpianoman@gmail.com>
      Acked-by: NAlan Cox <alan@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      cee4ad1e
  2. 17 10月, 2012 1 次提交
  3. 16 10月, 2012 1 次提交
  4. 15 10月, 2012 1 次提交
  5. 12 10月, 2012 2 次提交
    • J
      kdb,vt_console: Fix missed data due to pager overruns · 17b572e8
      Jason Wessel 提交于
      It is possible to miss data when using the kdb pager.  The kdb pager
      does not pay attention to the maximum column constraint of the screen
      or serial terminal.  This result is not incrementing the shown lines
      correctly and the pager will print more lines that fit on the screen.
      Obviously that is less than useful when using a VGA console where you
      cannot scroll back.
      
      The pager will now look at the kdb_buffer string to see how many
      characters are printed.  It might not be perfect considering you can
      output ASCII that might move the cursor position, but it is a
      substantially better approximation for viewing dmesg and trace logs.
      
      This also means that the vt screen needs to set the kdb COLUMNS
      variable.
      
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NJason Wessel <jason.wessel@windriver.com>
      17b572e8
    • J
      kgdboc: Accept either kbd or kdb to activate the vga + keyboard kdb shell · 24b8592e
      Jason Wessel 提交于
      It is a common enough mistake for people to specify "kdb" when they
      meant to type "kbd" that the kgdboc can just accept both since they
      both mean the same thing anyway.  Specifically it is for the case
      where you want kdb to be active on your graphics console + keyboard
      (where kbd was the original abbreviation for keyboard).
      
      With this change kgdboc will now accept either to mean the same thing:
         kgdboc=kbd
         kgdboc=kdb
      Signed-off-by: NJason Wessel <jason.wessel@windriver.com>
      24b8592e
  6. 06 10月, 2012 2 次提交
  7. 04 10月, 2012 1 次提交
  8. 27 9月, 2012 19 次提交
  9. 22 9月, 2012 4 次提交