Re: ttydev_cdevsw has no d_purge

2012-08-10 Thread Hans Petter Selasky
Hi, Please see the following patches for a solution of the problem given by the subject of this thread: http://svn.freebsd.org/changeset/base/239178 http://svn.freebsd.org/changeset/base/239179 http://svn.freebsd.org/changeset/base/239180 --HPS ___ fr

Re: ttydev_cdevsw has no d_purge

2012-08-10 Thread Hans Petter Selasky
On Friday 10 August 2012 15:39:16 Ed Schouten wrote: > Hi Hans, > > 2012/8/9 Hans Petter Selasky : > > 1) Use unrhdr. Suggested by ed. > > Thanks! > > > 2) Implement tty_set_softc() and use that when dereffing ucom unit > > numbers. > > We're getting there. Now that I think of it, if we want to

Re: ttydev_cdevsw has no d_purge

2012-08-10 Thread Ed Schouten
Hi Hans, 2012/8/9 Hans Petter Selasky : > 1) Use unrhdr. Suggested by ed. Thanks! > 2) Implement tty_set_softc() and use that when dereffing ucom unit numbers. We're getting there. Now that I think of it, if we want to go in this direction, we might as well do the following: - Simply call tty_

Re: ttydev_cdevsw has no d_purge

2012-08-09 Thread Warner Losh
On Aug 8, 2012, at 11:41 AM, Hans Petter Selasky wrote: > On Wednesday 08 August 2012 19:24:18 Ed Schouten wrote: >>> Ed: I would really like to see a custom argument for the tsw_free(), >>> because it only needs to know the unit number, and the xsc for UCOM is >>> freed when this is called and c

Re: ttydev_cdevsw has no d_purge

2012-08-08 Thread Hans Petter Selasky
Hi, I've updated the ucom patch. 1) Use unrhdr. Suggested by ed. 2) Implement tty_set_softc() and use that when dereffing ucom unit numbers. Please test and report back. --HPS === sys/tty.h == --- sys/tty.h (revision 239054) +++ sy

Re: ttydev_cdevsw has no d_purge

2012-08-08 Thread Hans Petter Selasky
On Wednesday 08 August 2012 22:46:28 Ed Schouten wrote: > Hi Hans, > > 2012/8/8 Hans Petter Selasky : > > Are you sure that the new softc won't be used in any callbacks when > > tty_rel_gone() is called, except for tsw_free() ? > > Yes. Otherwise you would have already seen a kernel panic. See >

Re: ttydev_cdevsw has no d_purge

2012-08-08 Thread Hans Petter Selasky
On Wednesday 08 August 2012 23:51:55 Konstantin Belousov wrote: > On Wed, Aug 08, 2012 at 07:42:24PM +0200, Hans Petter Selasky wrote: > > On Wednesday 08 August 2012 19:24:18 Ed Schouten wrote: > > > 2012/8/8 Hans Petter Selasky : > > > >> I have a question regarding the changed fragment of code.

Re: ttydev_cdevsw has no d_purge

2012-08-08 Thread Konstantin Belousov
On Wed, Aug 08, 2012 at 07:42:24PM +0200, Hans Petter Selasky wrote: > On Wednesday 08 August 2012 19:24:18 Ed Schouten wrote: > > 2012/8/8 Hans Petter Selasky : > > >> I have a question regarding the changed fragment of code. Why don't you > > >> use unr(9) KPI to manage unit numbers ? > > > > >

Re: ttydev_cdevsw has no d_purge

2012-08-08 Thread Ed Schouten
Hi Hans, 2012/8/8 Hans Petter Selasky : > Are you sure that the new softc won't be used in any callbacks when > tty_rel_gone() is called, except for tsw_free() ? Yes. Otherwise you would have already seen a kernel panic. See /sys/sys/ttydevsw.h; it has assertions on the locking. > It is like a d

Re: ttydev_cdevsw has no d_purge

2012-08-08 Thread Hans Petter Selasky
On Wednesday 08 August 2012 19:24:18 Ed Schouten wrote: > 2012/8/8 Hans Petter Selasky : > >> I have a question regarding the changed fragment of code. Why don't you > >> use unr(9) KPI to manage unit numbers ? > > > > Probably I could, but right now the unr interface doesn't support pending > > u

Re: ttydev_cdevsw has no d_purge

2012-08-08 Thread Hans Petter Selasky
On Wednesday 08 August 2012 19:24:18 Ed Schouten wrote: > > Ed: I would really like to see a custom argument for the tsw_free(), > > because it only needs to know the unit number, and the xsc for UCOM is > > freed when this is called and cannot be referred. Is it possible to have > > a separate "vo

Re: ttydev_cdevsw has no d_purge

2012-08-08 Thread Ed Schouten
2012/8/8 Hans Petter Selasky : >> I have a question regarding the changed fragment of code. Why don't you use >> unr(9) KPI to manage unit numbers ? > > Probably I could, but right now the unr interface doesn't support pending unit > free which I need for other reasons, see below. What does `pendi

Re: ttydev_cdevsw has no d_purge

2012-08-08 Thread Hans Petter Selasky
On Wednesday 08 August 2012 13:31:33 Konstantin Belousov wrote: > On Tue, Aug 07, 2012 at 05:03:13PM +0200, Hans Petter Selasky wrote: > > On Sunday 05 August 2012 10:33:13 Hans Petter Selasky wrote: > > > On Friday 03 August 2012 10:32:47 Ed Schouten wrote: > > > > 2012/8/1 Hans Petter Selasky : >

Re: ttydev_cdevsw has no d_purge

2012-08-08 Thread Konstantin Belousov
On Tue, Aug 07, 2012 at 05:03:13PM +0200, Hans Petter Selasky wrote: > On Sunday 05 August 2012 10:33:13 Hans Petter Selasky wrote: > > On Friday 03 August 2012 10:32:47 Ed Schouten wrote: > > > 2012/8/1 Hans Petter Selasky : > > > > I think the problem is like this, that in order to re-use the uni

Re: ttydev_cdevsw has no d_purge

2012-08-07 Thread Hans Petter Selasky
On Sunday 05 August 2012 10:33:13 Hans Petter Selasky wrote: > On Friday 03 August 2012 10:32:47 Ed Schouten wrote: > > 2012/8/1 Hans Petter Selasky : > > > I think the problem is like this, that in order to re-use the unit > > > numbers for USB serial tty devices, the USB stack needs to wait until

Re: ttydev_cdevsw has no d_purge

2012-08-06 Thread Ed Schouten
Hi Hans, 2012/8/5 Hans Petter Selasky : > When can the previous unit number be re-used? Is there a callback for this? The unit number can be reused after .tsw_free() has been called. > When can the USB serial code assume that it will not be called again and that > all callbacks are drained? The

Re: ttydev_cdevsw has no d_purge

2012-08-05 Thread Hans Petter Selasky
On Friday 03 August 2012 10:32:47 Ed Schouten wrote: > 2012/8/1 Hans Petter Selasky : > > I think the problem is like this, that in order to re-use the unit > > numbers for USB serial tty devices, the USB stack needs to wait until a > > TTY is actually freed, right? Else you will have a panic on cr

Re: ttydev_cdevsw has no d_purge

2012-08-03 Thread Ed Schouten
2012/8/1 Hans Petter Selasky : > I think the problem is like this, that in order to re-use the unit numbers for > USB serial tty devices, the USB stack needs to wait until a TTY is actually > freed, right? Else you will have a panic on creating devfs entries having the > same name. Indeed. So the

Re: ttydev_cdevsw has no d_purge

2012-08-03 Thread Ed Schouten
2012/8/3 Julian Elischer : > they would only do that if they were refering to the node BY NAME. Which is exactly what a lot of software does when interacting with TTYs. -- Ed Schouten ___ freebsd-current@freebsd.org mailing list http://lists.freebsd.o

Re: ttydev_cdevsw has no d_purge

2012-08-02 Thread Julian Elischer
On 8/2/12 4:23 AM, Ed Schouten wrote: 2012/8/2 Julian Elischer : I think that the /dev/entries can (and SHOULD) go away when the hardware goes away and even be re-used. But here's the point. TTYs are used in a different way than other device nodes. Regular device nodes are simply opened by a se

Re: ttydev_cdevsw has no d_purge

2012-08-02 Thread Poul-Henning Kamp
In message , Ed Schouten writes: >2012/8/2 Julian Elischer : TTYs are used *two* ways: As terminals and as comms to the real world. If a terminal-tty disappears, it should be handled like a HUP would be, analytically it is the exact same situation as a carrier drop on a modem. The implementati

Re: ttydev_cdevsw has no d_purge

2012-08-02 Thread Ed Schouten
2012/8/2 Julian Elischer : > I think that the /dev/entries can (and SHOULD) go away when the hardware > goes away and even be re-used. But here's the point. TTYs are used in a different way than other device nodes. Regular device nodes are simply opened by a set of independent process (e.g. dd if=

Re: ttydev_cdevsw has no d_purge

2012-08-01 Thread Julian Elischer
On 8/1/12 2:41 PM, Hans Petter Selasky wrote: On Wednesday 01 August 2012 22:46:58 Ed Schouten wrote: Hi Kostik, 2012/8/1 Konstantin Belousov : I would blame tty subsystem rather then USB subsystem. The d_purge method of the ttydev_cdevsw is not implemented, but it is the only measure that ca

Re: ttydev_cdevsw has no d_purge

2012-08-01 Thread Hans Petter Selasky
On Wednesday 01 August 2012 22:46:58 Ed Schouten wrote: > Hi Kostik, > > 2012/8/1 Konstantin Belousov : > > I would blame tty subsystem rather then USB subsystem. The d_purge > > method of the ttydev_cdevsw is not implemented, but it is the only > > measure that can break the deadlocks like the o

Re: ttydev_cdevsw has no d_purge

2012-08-01 Thread Poul-Henning Kamp
In message <20120801210210.gu2...@deviant.kiev.zoral.com.ua>, Konstantin Belous ov writes: >> I guess d_purge was added quite recently, right? > >No, it was there at least in 2006. In fact, it seems to be added in 2004, >see r135843. Ahh yes, I remember that one :-) It was added so that when PCM

Re: ttydev_cdevsw has no d_purge

2012-08-01 Thread Konstantin Belousov
On Wed, Aug 01, 2012 at 10:46:58PM +0200, Ed Schouten wrote: > Hi Kostik, > > 2012/8/1 Konstantin Belousov : > > I would blame tty subsystem rather then USB subsystem. The d_purge > > method of the ttydev_cdevsw is not implemented, but it is the only > > measure that can break the deadlocks like

Re: ttydev_cdevsw has no d_purge

2012-08-01 Thread Ed Schouten
Hi Kostik, 2012/8/1 Konstantin Belousov : > I would blame tty subsystem rather then USB subsystem. The d_purge > method of the ttydev_cdevsw is not implemented, but it is the only > measure that can break the deadlocks like the one I described. The > d_purge shall wake up threads sleeping inside

ttydev_cdevsw has no d_purge

2012-08-01 Thread Konstantin Belousov
[Long story, the summary is in last two paragraphs] I use several APC UPS some of which are connected by the USB<->serial dongle. Said USBs very much like to drop from the USB bus on a smallest power glitch. Today I noted that a machine dropped UPS serial USB device, and did not reattached it.