From owner-freebsd-current@FreeBSD.ORG Fri Aug 10 14:39:10 2012 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 28383106566C for ; Fri, 10 Aug 2012 14:39:10 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe07.c2i.net [212.247.154.194]) by mx1.freebsd.org (Postfix) with ESMTP id A3C828FC16 for ; Fri, 10 Aug 2012 14:39:08 +0000 (UTC) X-T2-Spam-Status: No, hits=-0.2 required=5.0 tests=ALL_TRUSTED, BAYES_50 Received: from [176.74.212.201] (account mc467741@c2i.net HELO laptop015.hselasky.homeunix.org) by mailfe07.swip.net (CommuniGate Pro SMTP 5.4.4) with ESMTPA id 306293988; Fri, 10 Aug 2012 16:39:02 +0200 From: Hans Petter Selasky To: Ed Schouten Date: Fri, 10 Aug 2012 16:39:34 +0200 User-Agent: KMail/1.13.7 (FreeBSD/9.1-PRERELEASE; KDE/4.8.4; amd64; ; ) References: <20120801160323.GN2676@deviant.kiev.zoral.com.ua> <201208090851.56972.hselasky@c2i.net> In-Reply-To: X-Face: 'mmZ:T{)),Oru^0c+/}w'`gU1$ubmG?lp!=R4Wy\ELYo2)@'UZ24N@d2+AyewRX}mAm; Yp |U[@, _z/([?1bCfM{_"B<.J>mICJCHAzzGHI{y7{%JVz%R~yJHIji`y>Y}k1C4TfysrsUI -%GU9V5]iUZF&nRn9mJ'?&>O MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201208101639.34082.hselasky@c2i.net> Cc: Konstantin Belousov , freebsd-current@freebsd.org Subject: Re: ttydev_cdevsw has no d_purge X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Aug 2012 14:39:10 -0000 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 go in this > direction, we might as well do the following: > > - Simply call tty_alloc() -- not tty_alloc_mutex(). I'd rather get rid > of this functionality altogether, if possible. > - Use the TTY mutex to lock down the state of the ucom driver, e.g. > #define ucom_lock(sc) tty_lock(sc->sc_mtx). > > Any thoughts? Hi, Not possible :-( It will cause a hell inside ucom when multiple tty's are present having each their lock sharing the same USB device and possibly also an ethernet interface on the same softc. KISS: One lock per softc. No more no less. You're simply pushing a problem into ucom, that ucom has do do refcounting which should be generic for all TTY clients. BTW: I've changed by solutions a little bit to be more generic. I will commit it shortly. There are more problems like kldunload() and how you need to block kldunload() from completing when a softc is pending for tsw_free(). --HPS