1. 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
  2. 26 8月, 2011 1 次提交
  3. 24 8月, 2011 1 次提交
  4. 08 6月, 2011 1 次提交
  5. 14 5月, 2011 1 次提交
    • J
      n_tracerouter and n_tracesink ldisc additions. · ee4f6b4b
      J Freyensee 提交于
      The n_tracerouter and n_tracesink line discpline drivers use the
      Linux tty line discpline framework to route trace data coming
      from a tty port (say UART for example) to the trace sink line
      discipline driver and to another tty port(say USB).  Those
      these two line discipline drivers can be used together,
      independently from pti.c, they are part of the original
      implementation solution of the MIPI P1149.7, compact JTAG, PTI
      solution for Intel mobile platforms starting with the
      Medfield platform.
      Signed-off-by: NJ Freyensee <james_p_freyensee@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      ee4f6b4b
  6. 20 4月, 2011 1 次提交
  7. 23 3月, 2011 1 次提交
    • L
      tty: stop using "delayed_work" in the tty layer · f23eb2b2
      Linus Torvalds 提交于
      Using delayed-work for tty flip buffers ends up causing us to wait for
      the next tick to complete some actions.  That's usually not all that
      noticeable, but for certain latency-critical workloads it ends up being
      totally unacceptable.
      
      As an extreme case of this, passing a token back-and-forth over a pty
      will take two ticks per iteration, so even just a thousand iterations
      will take 8 seconds assuming a common 250Hz configuration.
      
      Avoiding the whole delayed work issue brings that ping-pong test-case
      down to 0.009s on my machine.
      
      In more practical terms, this latency has been a performance problem for
      things like dive computer simulators (simulating the serial interface
      using the ptys) and for other environments (Alan mentions a CP/M emulator).
      Reported-by: NJef Driesen <jefdriesen@telenet.be>
      Acked-by: NGreg KH <gregkh@suse.de>
      Acked-by: NAlan Cox <alan@lxorguk.ukuu.org.uk>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      f23eb2b2
  8. 18 2月, 2011 3 次提交
  9. 30 11月, 2010 1 次提交
    • J
      TTY: open/hangup race fixup · acfa747b
      Jiri Slaby 提交于
      Like in the "TTY: don't allow reopen when ldisc is changing" patch,
      this one fixes a TTY WARNING as described in the option 1) there:
      1) __tty_hangup from tty_ldisc_hangup to tty_ldisc_enable. During this
      section tty_lock is held. However tty_lock is temporarily dropped in
      the middle of the function by tty_ldisc_hangup.
      
      The fix is to introduce a new flag which we set during the unlocked
      window and check it in tty_reopen too. The flag is TTY_HUPPING and is
      cleared after TTY_HUPPED is set.
      
      While at it, remove duplicate TTY_HUPPED set_bit. The one after
      calling ops->hangup seems to be more correct. But anyway, we hold
      tty_lock, so there should be no difference.
      
      Also document the function it does that kind of crap.
      
      Nicely reproducible with two forked children:
      static void do_work(const char *tty)
      {
      	if (signal(SIGHUP, SIG_IGN) == SIG_ERR) exit(1);
      	setsid();
      	while (1) {
      		int fd = open(tty, O_RDWR|O_NOCTTY);
      		if (fd < 0) continue;
      		if (ioctl(fd, TIOCSCTTY)) continue;
      		if (vhangup()) continue;
      		close(fd);
      	}
      	exit(0);
      }
      Signed-off-by: NJiri Slaby <jslaby@suse.cz>
      Reported-by: <Valdis.Kletnieks@vt.edu>
      Reported-by: NKyle McMartin <kyle@mcmartin.ca>
      Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
      Cc: stable <stable@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      acfa747b
  10. 18 11月, 2010 1 次提交
  11. 10 11月, 2010 1 次提交
  12. 30 10月, 2010 1 次提交
    • T
      audit: Call tty_audit_push_task() outside preempt disabled · 3c80fe4a
      Thomas Gleixner 提交于
      While auditing all tasklist_lock read_lock sites I stumbled over the
      following call chain:
      
      audit_prepare_user_tty()
        read_lock(&tasklist_lock);
        tty_audit_push_task();
           mutex_lock(&buf->mutex);
      
           --> buf->mutex is locked with preemption disabled.
      
      Solve this by acquiring a reference to the task struct under
      rcu_read_lock and call tty_audit_push_task outside of the preempt
      disabled region.
      
      Move all code which needs to be protected by sighand lock into
      tty_audit_push_task() and use lock/unlock_sighand as we do not hold
      tasklist_lock.
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Eric Paris <eparis@redhat.com>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      3c80fe4a
  13. 23 10月, 2010 2 次提交
  14. 06 10月, 2010 1 次提交
    • P
      tty.h: new ldisc for TI WiLink ST · 40fb29a7
      Pavan Savoy 提交于
      Texas Instrument's WiLink7 connectivity devices pack wireless connectivity
      technologies like Bluetooth, FM Radio Receiver and Transmitter, GPS and WLAN
      into a single die.
      The BT, FM and GPS core on the chip are interfaced to application
      processors via a single UART.
      
      This line discipline driver allows such different technologies to be used
      simultaneous and independent of each other.
      Signed-off-by: NPavan Savoy <pavan_savoy@ti.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      40fb29a7
  15. 18 8月, 2010 2 次提交
    • N
      tty: fix fu_list abuse · d996b62a
      Nick Piggin 提交于
      tty: fix fu_list abuse
      
      tty code abuses fu_list, which causes a bug in remount,ro handling.
      
      If a tty device node is opened on a filesystem, then the last link to the inode
      removed, the filesystem will be allowed to be remounted readonly. This is
      because fs_may_remount_ro does not find the 0 link tty inode on the file sb
      list (because the tty code incorrectly removed it to use for its own purpose).
      This can result in a filesystem with errors after it is marked "clean".
      
      Taking idea from Christoph's initial patch, allocate a tty private struct
      at file->private_data and put our required list fields in there, linking
      file and tty. This makes tty nodes behave the same way as other device nodes
      and avoid meddling with the vfs, and avoids this bug.
      
      The error handling is not trivial in the tty code, so for this bugfix, I take
      the simple approach of using __GFP_NOFAIL and don't worry about memory errors.
      This is not a problem because our allocator doesn't fail small allocs as a rule
      anyway. So proper error handling is left as an exercise for tty hackers.
      
      [ Arguably filesystem's device inode would ideally be divorced from the
      driver's pseudo inode when it is opened, but in practice it's not clear whether
      that will ever be worth implementing. ]
      
      Cc: linux-kernel@vger.kernel.org
      Cc: Christoph Hellwig <hch@infradead.org>
      Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
      Cc: Greg Kroah-Hartman <gregkh@suse.de>
      Signed-off-by: NNick Piggin <npiggin@kernel.dk>
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      d996b62a
    • N
      fs: cleanup files_lock locking · ee2ffa0d
      Nick Piggin 提交于
      fs: cleanup files_lock locking
      
      Lock tty_files with a new spinlock, tty_files_lock; provide helpers to
      manipulate the per-sb files list; unexport the files_lock spinlock.
      
      Cc: linux-kernel@vger.kernel.org
      Cc: Christoph Hellwig <hch@infradead.org>
      Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
      Acked-by: NAndi Kleen <ak@linux.intel.com>
      Acked-by: NGreg Kroah-Hartman <gregkh@suse.de>
      Signed-off-by: NNick Piggin <npiggin@kernel.dk>
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      ee2ffa0d
  16. 11 8月, 2010 5 次提交
    • A
      tty: implement BTM as mutex instead of BKL · b07471fa
      Arnd Bergmann 提交于
      The tty locking now follows the rules for mutexes, so
      we can replace the BKL usage with a new subsystem
      wide mutex.
      
      Using a regular mutex here will change the behaviour
      when blocked on the BTM from spinning to sleeping,
      but that should not be visible to the user.
      
      Using the mutex also means that all the BTM is now
      covered by lockdep.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      b07471fa
    • A
      tty: remove tty_lock_nested · ddcd9fb6
      Arnd Bergmann 提交于
      This changes all remaining users of tty_lock_nested
      to be non-recursive, which lets us kill this function.
      As a consequence, we won't need to keep the lock count
      any more, which allows more simplifications later.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      ddcd9fb6
    • A
      tty: introduce wait_event_interruptible_tty · be1bc288
      Arnd Bergmann 提交于
      Calling wait_event_interruptible implicitly
      releases the BKL when it sleeps, but we need
      to do this explcitly when we have converted
      it to a mutex.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      be1bc288
    • A
      tty: replace BKL with a new tty_lock · ec79d605
      Arnd Bergmann 提交于
      As a preparation for replacing the big kernel lock
      in the TTY layer, wrap all the callers in new
      macros tty_lock, tty_lock_nested and tty_unlock.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      ec79d605
    • 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
  17. 07 8月, 2010 1 次提交
    • D
      Fix init ordering of /dev/console vs callers of modprobe · 31d1d48e
      David Howells 提交于
      Make /dev/console get initialised before any initialisation routine that
      invokes modprobe because if modprobe fails, it's going to want to open
      /dev/console, presumably to write an error message to.
      
      The problem with that is that if the /dev/console driver is not yet
      initialised, the chardev handler will call request_module() to invoke
      modprobe, which will fail, because we never compile /dev/console as a
      module.
      
      This will lead to a modprobe loop, showing the following in the kernel
      log:
      
      	request_module: runaway loop modprobe char-major-5-1
      	request_module: runaway loop modprobe char-major-5-1
      	request_module: runaway loop modprobe char-major-5-1
      	request_module: runaway loop modprobe char-major-5-1
      	request_module: runaway loop modprobe char-major-5-1
      
      This can happen, for example, when the built in md5 module can't find
      the built in cryptomgr module (because the latter fails to initialise).
      The md5 module comes before the call to tty_init(), presumably because
      'crypto' comes before 'drivers' alphabetically.
      
      Fix this by calling tty_init() from chrdev_init().
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      31d1d48e
  18. 22 5月, 2010 2 次提交
  19. 31 3月, 2010 1 次提交
  20. 19 3月, 2010 2 次提交
    • J
      tty_port,usb-console: Fix usb serial console open/close regression · 336cee42
      Jason Wessel 提交于
      Commit e1108a63 ("usb_serial: Use the
      shutdown() operation") breaks the ability to use a usb console
      starting in 2.6.33.  This was observed when using
      console=ttyUSB0,115200 as a boot argument with an FTDI device.  The
      error is:
      
      ftdi_sio ttyUSB0: ftdi_submit_read_urb - failed submitting read urb, error -22
      
      The handling of the ASYNCB_INITIALIZED changed in 2.6.32 such that in
      tty_port_shutdown() it always clears the flag if it is set.  The fix
      is to add a variable to the tty_port struct to indicate when the tty
      port is a console.
      
      CC: Alan Cox <alan@linux.intel.com>
      CC: Alan Stern <stern@rowland.harvard.edu>
      CC: Oliver Neukum <oliver@neukum.org>
      CC: Andrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NJason Wessel <jason.wessel@windriver.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      336cee42
    • M
      tty: Take a 256 byte padding into account when buffering below sub-page units · 352fa6ad
      Mel Gorman 提交于
      The TTY layer takes some care to ensure that only sub-page allocations
      are made with interrupts disabled. It does this by setting a goal of
      "TTY_BUFFER_PAGE" to allocate. Unfortunately, while TTY_BUFFER_PAGE takes the
      size of tty_buffer into account, it fails to account that tty_buffer_find()
      rounds the buffer size out to the next 256 byte boundary before adding on
      the size of the tty_buffer.
      
      This patch adjusts the TTY_BUFFER_PAGE calculation to take into account the
      size of the tty_buffer and the padding. Once applied, tty_buffer_alloc()
      should not require high-order allocations.
      Signed-off-by: NMel Gorman <mel@csn.ul.ie>
      Cc: stable <stable@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      352fa6ad
  21. 13 3月, 2010 1 次提交
  22. 03 3月, 2010 1 次提交
  23. 17 1月, 2010 1 次提交
  24. 16 12月, 2009 1 次提交
    • B
      vt: introduce and use vt_kmsg_redirect() function · 5ada918b
      Bernhard Walle 提交于
      The kernel offers with TIOCL_GETKMSGREDIRECT ioctl() the possibility to
      redirect the kernel messages to a specific console.
      
      However, since it's not possible to switch to the kernel message console
      after a panic(), it would be nice if the kernel would print the panic
      message on the current console.
      
      This patch series adds a new interface to access the global kmsg_redirect
      variable by a function to be able to use it in code where
      CONFIG_VT_CONSOLE is not set (kernel/panic.c).
      
      This patch:
      
      Instead of using and exporting a global value kmsg_redirect, introduce a
      function vt_kmsg_redirect() that both can set and return the console where
      messages are printed.
      
      Change all users of kmsg_redirect (the VT code itself and kernel/power.c)
      to the new interface.
      
      The main advantage is that vt_kmsg_redirect() can also be used when
      CONFIG_VT_CONSOLE is not set.
      Signed-off-by: NBernhard Walle <bernhard@bwalle.de>
      Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
      Cc: Ingo Molnar <mingo@elte.hu>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      5ada918b
  25. 12 12月, 2009 4 次提交
  26. 20 9月, 2009 2 次提交