<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/linux.git/include/linux/tty.h, branch v3.2.83</title>
<subtitle>Linux Kernel
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v3.2.83</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v3.2.83'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/'/>
<updated>2011-10-26T13:11:09Z</updated>
<entry>
<title>Merge branch 'tty-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty</title>
<updated>2011-10-26T13:11:09Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2011-10-26T13:11:09Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=efb8d21b2c6db3497655cc6a033ae8a9883e4063'/>
<id>urn:sha1:efb8d21b2c6db3497655cc6a033ae8a9883e4063</id>
<content type='text'>
* 'tty-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty: (79 commits)
  TTY: serial_core: Fix crash if DCD drop during suspend
  tty/serial: atmel_serial: bootconsole removed from auto-enumerates
  Revert "TTY: call tty_driver_lookup_tty unconditionally"
  tty/serial: atmel_serial: add device tree support
  tty/serial: atmel_serial: auto-enumerate ports
  tty/serial: atmel_serial: whitespace and braces modifications
  tty/serial: atmel_serial: change platform_data variable name
  tty/serial: RS485 bindings for device tree
  TTY: call tty_driver_lookup_tty unconditionally
  TTY: pty, release tty in all ptmx_open fail paths
  TTY: make tty_add_file non-failing
  TTY: drop driver reference in tty_open fail path
  8250_pci: Fix kernel panic when pch_uart is disabled
  h8300: drivers/serial/Kconfig was moved
  parport_pc: release IO region properly if unsupported ITE887x card is found
  tty: Support compat_ioctl get/set termios_locked
  hvc_console: display printk messages on console.
  TTY: snyclinkmp: forever loop in tx_load_dma_buffer()
  tty/n_gsm: avoid fifo overflow in gsm_dlci_data_output
  tty/n_gsm: fix a bug in gsm_dlci_data_output (adaption = 2 case)
  ...

Fix up Conflicts in:
 - drivers/tty/serial/8250_pci.c
	Trivial conflict with removed duplicate device ID
 - drivers/tty/serial/atmel_serial.c
	Annoying silly conflict between "specify the port num via
	platform_data" and other changes to atmel_console_init
</content>
</entry>
<entry>
<title>TTY: make tty_add_file non-failing</title>
<updated>2011-10-18T21:22:37Z</updated>
<author>
<name>Jiri Slaby</name>
<email>jslaby@suse.cz</email>
</author>
<published>2011-10-12T09:32:43Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=fa90e1c935472281de314e6d7c9a37db9cbc2e4e'/>
<id>urn:sha1:fa90e1c935472281de314e6d7c9a37db9cbc2e4e</id>
<content type='text'>
If tty_add_file fails at the point it is now, we have to revert all
the changes we did to the tty. It means either decrease all refcounts
if this was a tty reopen or delete the tty if it was newly allocated.

There was a try to fix this in v3.0-rc2 using tty_release in 0259894c7
(TTY: fix fail path in tty_open). But instead it introduced a NULL
dereference. It's because tty_release dereferences
filp-&gt;private_data, but that one is set even in our tty_add_file. And
when tty_add_file fails, it's still NULL/garbage. Hence tty_release
cannot be called there.

To circumvent the original leak (and the current NULL deref) we split
tty_add_file into two functions, making the latter non-failing. In
that case we may do the former early in open, where handling failures
is easy. The latter stays as it is now. So there is no change in
functionality.

The original bug (leak) was introduced by f573bd176 (tty: Remove
__GFP_NOFAIL from tty_add_file()). Thanks Dan for reporting this.

Later, we may split tty_release into more functions and call only some
of them in this fail path instead. (If at all possible.)

Introduced-in: v2.6.37-rc2
Signed-off-by: Jiri Slaby &lt;jslaby@suse.cz&gt;
Reported-by: Dan Carpenter &lt;dan.carpenter@oracle.com&gt;
Cc: stable &lt;stable@vger.kernel.org&gt;
Cc: Alan Cox &lt;alan@lxorguk.ukuu.org.uk&gt;
Cc: Pekka Enberg &lt;penberg@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;
</content>
</entry>
<entry>
<title>tty: Support compat_ioctl get/set termios_locked</title>
<updated>2011-10-18T21:17:11Z</updated>
<author>
<name>Thomas Meyer</name>
<email>thomas@m3y3r.de</email>
</author>
<published>2011-10-05T21:13:13Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=8193c4290620d9b2a6ac116719f11aa99053a90d'/>
<id>urn:sha1:8193c4290620d9b2a6ac116719f11aa99053a90d</id>
<content type='text'>
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: Thomas Meyer &lt;thomas@m3y3r.de&gt;
Cc: Arnd Bergmann &lt;arnd@arndb.de&gt;
Cc: Alan Cox &lt;alan@lxorguk.ukuu.org.uk&gt;
Signed-off-by: Andrew Morton &lt;akpm@google.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;
</content>
</entry>
<entry>
<title>TTY: define tty_wait_until_sent_from_close</title>
<updated>2011-08-25T16:00:40Z</updated>
<author>
<name>Jiri Slaby</name>
<email>jslaby@suse.cz</email>
</author>
<published>2011-08-25T13:12:06Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=a57a7bf3fc7eff00f07eb9c805774d911a3f2472'/>
<id>urn:sha1:a57a7bf3fc7eff00f07eb9c805774d911a3f2472</id>
<content type='text'>
We need this helper to fix system stalls. The issue is that the rest
of the system TTYs wait for us to finish waiting. This wasn't an issue
with BKL. BKL used to unlock implicitly.

This is based on the Arnd suggestion.

Signed-off-by: Jiri Slaby &lt;jslaby@suse.cz&gt;
Acked-by: Arnd Bergmann &lt;arnd@arndb.de&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;
</content>
</entry>
<entry>
<title>TTY: remove tty_locked</title>
<updated>2011-08-23T17:34:07Z</updated>
<author>
<name>Jiri Slaby</name>
<email>jslaby@suse.cz</email>
</author>
<published>2011-07-14T12:35:14Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=906cbe1364d94da7cbf74c1d05e3e78b2883f661'/>
<id>urn:sha1:906cbe1364d94da7cbf74c1d05e3e78b2883f661</id>
<content type='text'>
We used it really only serial and ami_serial. The rest of the
callsites were BUG/WARN_ONs to check if BTM is held. Now that we
pruned tty_locked from both of the real users, we can get rid of
tty_lock along with __big_tty_mutex_owner.

Signed-off-by: Jiri Slaby &lt;jslaby@suse.cz&gt;
Acked-by: Arnd Bergmann &lt;arnd@arndb.de&gt;
Cc: Alan Cox &lt;alan@linux.intel.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;
</content>
</entry>
<entry>
<title>TTY: pty, fix pty counting</title>
<updated>2011-08-23T17:10:38Z</updated>
<author>
<name>Jiri Slaby</name>
<email>jslaby@suse.cz</email>
</author>
<published>2011-08-10T12:59:28Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=24d406a6bf736f7aebdc8fa0f0ec86e0890c6d24'/>
<id>urn:sha1:24d406a6bf736f7aebdc8fa0f0ec86e0890c6d24</id>
<content type='text'>
tty_operations-&gt;remove is normally called like:
queue_release_one_tty
 -&gt;tty_shutdown
   -&gt;tty_driver_remove_tty
     -&gt;tty_operations-&gt;remove

However tty_shutdown() is called from queue_release_one_tty() only if
tty_operations-&gt;shutdown is NULL. But for pty, it is not.
pty_unix98_shutdown() is used there as -&gt;shutdown.

So tty_operations-&gt;remove of pty (i.e. pty_unix98_remove()) is never
called. This results in invalid pty_count. I.e. what can be seen in
/proc/sys/kernel/pty/nr.

I see this was already reported at:
  https://lkml.org/lkml/2009/11/5/370
But it was not fixed since then.

This patch is kind of a hackish way. The problem lies in -&gt;install. We
allocate there another tty (so-called tty-&gt;link). So -&gt;install is
called once, but -&gt;remove twice, for both tty and tty-&gt;link. The fix
here is to count both tty and tty-&gt;link and divide the count by 2 for
user.

And to have -&gt;remove called, let's make tty_driver_remove_tty() global
and call that from pty_unix98_shutdown() (tty_operations-&gt;shutdown).

While at it, let's document that when -&gt;shutdown is defined,
tty_shutdown() is not called.

Signed-off-by: Jiri Slaby &lt;jslaby@suse.cz&gt;
Cc: Alan Cox &lt;alan@linux.intel.com&gt;
Cc: "H. Peter Anvin" &lt;hpa@zytor.com&gt;
Cc: stable &lt;stable@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;
</content>
</entry>
<entry>
<title>TTY: export NR_LDISC and N_* line discipline numbers to user-space</title>
<updated>2011-06-07T16:37:01Z</updated>
<author>
<name>Florian Fainelli</name>
<email>ffainelli@freebox.fr</email>
</author>
<published>2011-05-24T08:43:03Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=ae92c1f5e7b6708371365d262625ac19e67c1e79'/>
<id>urn:sha1:ae92c1f5e7b6708371365d262625ac19e67c1e79</id>
<content type='text'>
Since commit (4564f9e5: consolidate line discipline number definitions)
the patch moved all line discipline number from a per-architecture termios.h
to a shared one: tty.h. However, prior to this consolidation work, the
line discipline numbers were outside of an ifdef __KERNEL__/endif block
so these numbers used to be exported to user-space.

Since such numbers are kernel ABI anyway, and tty.h is already included
for user- space header processing, just move these relevant defines
outside of the ifdef __KERNEL__/endif block in include/linux/tty.h.

CC: Maxime Bizon &lt;mbizon@freebox.fr&gt;
Signed-off-by: Florian Fainelli &lt;ffainelli@freebox.fr&gt;
Acked-by: Tilman Schmidt &lt;tilman@imap.cc&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;
</content>
</entry>
<entry>
<title>n_tracerouter and n_tracesink ldisc additions.</title>
<updated>2011-05-13T23:31:00Z</updated>
<author>
<name>J Freyensee</name>
<email>james_p_freyensee@linux.intel.com</email>
</author>
<published>2011-05-06T23:56:50Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=ee4f6b4b89665b92ead67deaa2e5d2ffa1af2b5f'/>
<id>urn:sha1:ee4f6b4b89665b92ead67deaa2e5d2ffa1af2b5f</id>
<content type='text'>
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: J Freyensee &lt;james_p_freyensee@linux.intel.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;
</content>
</entry>
<entry>
<title>TTY: introduce deinit helpers for proper ldisc shutdown</title>
<updated>2011-04-19T21:43:01Z</updated>
<author>
<name>Jiri Slaby</name>
<email>jslaby@suse.cz</email>
</author>
<published>2011-03-23T09:48:35Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=6716671d8c1c07a8072098764d1b7cbfef7412ad'/>
<id>urn:sha1:6716671d8c1c07a8072098764d1b7cbfef7412ad</id>
<content type='text'>
Introduce deinitialize_tty_struct which should be called after
initialize_tty_struct and before successfull tty_ldisc_setup.

It calls tty_ldisc_deinit which is opposite of tty_ldisc_init. It only
puts a reference to ldisc and assigns NULL to tty-&gt;ldisc.

It will be used to shut down ldisc when tty_release cannot be called
yet.

Signed-off-by: Jiri Slaby &lt;jslaby@suse.cz&gt;
Cc: Alan Cox &lt;alan@lxorguk.ukuu.org.uk&gt;
Cc: Julian Anastasov &lt;ja@ssi.bg&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;
</content>
</entry>
<entry>
<title>tty: stop using "delayed_work" in the tty layer</title>
<updated>2011-03-22T23:17:32Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2011-03-22T23:17:32Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=f23eb2b2b28547fc70df82dd5049eb39bec5ba12'/>
<id>urn:sha1:f23eb2b2b28547fc70df82dd5049eb39bec5ba12</id>
<content type='text'>
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: Jef Driesen &lt;jefdriesen@telenet.be&gt;
Acked-by: Greg KH &lt;gregkh@suse.de&gt;
Acked-by: Alan Cox &lt;alan@lxorguk.ukuu.org.uk&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
</feed>
