<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/linux.git/include/linux/tty_driver.h, branch v3.2.45</title>
<subtitle>Linux Kernel
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v3.2.45</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v3.2.45'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/'/>
<updated>2011-08-23T17:10:38Z</updated>
<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: now phase out the ioctl file pointer for good</title>
<updated>2011-02-17T19:59:56Z</updated>
<author>
<name>Alan Cox</name>
<email>alan@linux.intel.com</email>
</author>
<published>2011-02-14T16:27:22Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=6caa76b7786891b42b66a0e61e2c2fff2c884620'/>
<id>urn:sha1:6caa76b7786891b42b66a0e61e2c2fff2c884620</id>
<content type='text'>
Only oddities here are a couple of drivers that bogusly called the ldisc
helpers instead of returning -ENOIOCTLCMD. Fix the bug and the rest goes
away.

Signed-off-by: Alan Cox &lt;alan@linux.intel.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;
</content>
</entry>
<entry>
<title>tiocmset: kill the file pointer argument</title>
<updated>2011-02-17T19:52:43Z</updated>
<author>
<name>Alan Cox</name>
<email>alan@linux.intel.com</email>
</author>
<published>2011-02-14T16:26:50Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=20b9d17715017ae4dd4ec87fabc36d33b9de708e'/>
<id>urn:sha1:20b9d17715017ae4dd4ec87fabc36d33b9de708e</id>
<content type='text'>
Doing tiocmget was such fun we should do tiocmset as well for the same
reasons

Signed-off-by: Alan Cox &lt;alan@linux.intel.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;
</content>
</entry>
<entry>
<title>tiocmget: kill off the passing of the struct file</title>
<updated>2011-02-17T19:47:33Z</updated>
<author>
<name>Alan Cox</name>
<email>alan@linux.intel.com</email>
</author>
<published>2011-02-14T16:26:14Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=60b33c133ca0b7c0b6072c87234b63fee6e80558'/>
<id>urn:sha1:60b33c133ca0b7c0b6072c87234b63fee6e80558</id>
<content type='text'>
We don't actually need this and it causes problems for internal use of
this functionality. Currently there is a single use of the FILE * pointer.
That is the serial core which uses it to check tty_hung_up_p. However if
that is true then IO_ERROR is also already set so the check may be removed.

Signed-off-by: Alan Cox &lt;alan@linux.intel.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;
</content>
</entry>
<entry>
<title>tty: fix typos/errors in tty_driver.h comments</title>
<updated>2010-12-16T21:14:32Z</updated>
<author>
<name>Timur Tabi</name>
<email>timur@freescale.com</email>
</author>
<published>2010-12-13T20:08:53Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=6ce5b1ce5f6922db32599e73bcb22f5cdcbf241f'/>
<id>urn:sha1:6ce5b1ce5f6922db32599e73bcb22f5cdcbf241f</id>
<content type='text'>
Fix various typos and other errors in comments of tty_driver.h.  The most
significant is the wrong name of a function for the description of
TTY_DRIVER_DYNAMIC_DEV.

Signed-off-by: Timur Tabi &lt;timur@freescale.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;
</content>
</entry>
<entry>
<title>TTY: include termios.h in tty_driver.h</title>
<updated>2010-11-16T20:50:17Z</updated>
<author>
<name>Jiri Slaby</name>
<email>jslaby@suse.cz</email>
</author>
<published>2010-11-04T15:20:23Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=3dfbd044d0d99cad2fe50e4f6c79845703fa0558'/>
<id>urn:sha1:3dfbd044d0d99cad2fe50e4f6c79845703fa0558</id>
<content type='text'>
We reference termios and termiox in tty_driver.h, but we do not include
linux/termios.h where these are defined. Add the #include properly.

Otherwise when we include tty_driver.h, we get compile errors.

Signed-off-by: Jiri Slaby &lt;jslaby@suse.cz&gt;
Cc: Alan Cox &lt;alan@lxorguk.ukuu.org.uk&gt;
Cc: Greg KH &lt;gregkh@suse.de&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;
</content>
</entry>
<entry>
<title>tty: Make tiocgicount a handler</title>
<updated>2010-10-22T17:20:04Z</updated>
<author>
<name>Alan Cox</name>
<email>alan@linux.intel.com</email>
</author>
<published>2010-09-16T17:21:24Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=d281da7ff6f70efca0553c288bb883e8605b3862'/>
<id>urn:sha1:d281da7ff6f70efca0553c288bb883e8605b3862</id>
<content type='text'>
Dan Rosenberg noted that various drivers return the struct with uncleared
fields. Instead of spending forever trying to stomp all the drivers that
get it wrong (and every new driver) do the job in one place.

This first patch adds the needed operations and hooks them up, including
the needed USB midlayer and serial core plumbing.

Signed-off-by: Alan Cox &lt;alan@linux.intel.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</content>
</entry>
<entry>
<title>tty: Fix regressions caused by commit b50989dc</title>
<updated>2009-09-27T20:35:16Z</updated>
<author>
<name>Dave Young</name>
<email>hidave.darkstar@gmail.com</email>
</author>
<published>2009-09-27T16:00:42Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=f278a2f7bbc2239f479eaf63d0b3ae573b1d746c'/>
<id>urn:sha1:f278a2f7bbc2239f479eaf63d0b3ae573b1d746c</id>
<content type='text'>
The following commit made console open fails while booting:

	commit b50989dc444599c8b21edc23536fc305f4e9b7d5
	Author: Alan Cox &lt;alan@linux.intel.com&gt;
	Date:   Sat Sep 19 13:13:22 2009 -0700

	tty: make the kref destructor occur asynchronously

Due to tty release routines run in a workqueue now, error like the
following will be reported while booting:

INIT open /dev/console Input/output error

It also causes hibernation regression to appear as reported at
http://bugzilla.kernel.org/show_bug.cgi?id=14229

The reason is that now there's latency issue with closing, but when
we open a "closing not finished" tty, -EIO will be returned.

Fix it as per the following Alan's suggestion:

  Fun but it's actually not a bug and the fix is wrong in itself as
  the port may be closing but not yet being destructed, in which case
  it seems to do the wrong thing.  Opening a tty that is closing (and
  could be closing for long periods) is supposed to return -EIO.

  I suspect a better way to deal with this and keep the old console
  timing is to split tty-&gt;shutdown into two functions.

  tty-&gt;shutdown() - called synchronously just before we dump the tty
  onto the waitqueue for destruction

  tty-&gt;cleanup() - called when the destructor runs.

  We would then do the shutdown part which can occur in IRQ context
  fine, before queueing the rest of the release (from tty-&gt;magic = 0
  ...  the end) to occur asynchronously

  The USB update in -next would then need a call like

       if (tty-&gt;cleanup)
               tty-&gt;cleanup(tty);

  at the top of the async function and the USB shutdown to be split
  between shutdown and cleanup as the USB resource cleanup and final
  tidy cannot occur synchronously as it needs to sleep.

  In other words the logic becomes

       final kref put
               make object unfindable

       async
               clean it up

Signed-off-by: Dave Young &lt;hidave.darkstar@gmail.com&gt;
[ rjw: Rebased on top of 2.6.31-git, reworked the changelog. ]
Signed-off-by: "Rafael J. Wysocki" &lt;rjw@sisk.pl&gt;
[ Changed serial naming to match new rules, dropped tty_shutdown as per
  comments from Alan Stern  - Linus ]
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>tty: throttling race fix</title>
<updated>2009-06-11T15:50:59Z</updated>
<author>
<name>Alan Cox</name>
<email>alan@linux.intel.com</email>
</author>
<published>2009-06-11T11:44:17Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=38db89799bdf11625a831c5af33938dcb11908b6'/>
<id>urn:sha1:38db89799bdf11625a831c5af33938dcb11908b6</id>
<content type='text'>
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-&gt;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: Alan Cox &lt;alan@lxorguk.ukuu.org.uk&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>tty: Correct inline types for tty_driver_kref_get()</title>
<updated>2009-04-07T15:44:04Z</updated>
<author>
<name>Adrian Bunk</name>
<email>bunk@kernel.org</email>
</author>
<published>2009-04-07T15:48:07Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=f786ddd285b4100909a013041d3eee1be9fac4db'/>
<id>urn:sha1:f786ddd285b4100909a013041d3eee1be9fac4db</id>
<content type='text'>
tty_driver_kref_get() should be static inline and not extern inline
(the latter even changed it's semantics in gcc &gt;= 4.3).

Signed-off-by: Adrian Bunk &lt;bunk@kernel.org&gt;
Signed-off-by: Alan Cox &lt;alan@lxorguk.ukuu.org.uk&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
</feed>
