From owner-freebsd-current@FreeBSD.ORG Thu Nov 27 18:37:09 2014 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id F02CCF59; Thu, 27 Nov 2014 18:37:08 +0000 (UTC) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.freebsd.org (Postfix) with ESMTP id D0198C6E; Thu, 27 Nov 2014 18:37:08 +0000 (UTC) Received: from [10.0.1.20] (c-76-21-10-192.hsd1.ca.comcast.net [76.21.10.192]) by elvis.mu.org (Postfix) with ESMTPSA id E4F6D341F84F; Thu, 27 Nov 2014 10:37:01 -0800 (PST) Subject: Re: RFC: Remove pty(4) Mime-Version: 1.0 (Apple Message framework v1283) Content-Type: text/plain; charset=us-ascii From: Alfred Perlstein In-Reply-To: <20141127095229.GO17068@kib.kiev.ua> Date: Thu, 27 Nov 2014 10:37:00 -0800 Content-Transfer-Encoding: quoted-printable Message-Id: <58F613B8-1F1E-4A38-8955-F35EB31A703A@mu.org> References: <1471750.VzNR6ldJSe@ralph.baldwin.cx> <20141127095229.GO17068@kib.kiev.ua> To: Konstantin Belousov X-Mailer: Apple Mail (2.1283) Cc: Davide Italiano , Ed Schouten , freebsd-current X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.18-1 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: Thu, 27 Nov 2014 18:37:09 -0000 On Nov 27, 2014, at 1:52 AM, Konstantin Belousov wrote: > On Wed, Nov 26, 2014 at 04:41:27PM -0800, Davide Italiano wrote: >> On Mon, Aug 25, 2014 at 12:37 PM, John Baldwin = wrote: >>> On Wednesday, August 20, 2014 11:00:14 AM Davide Italiano wrote: >>>> One of my personal goals for 11 is to get rid of cloning mechanism >>>> entirely, and pty(4) is one of the few in-kernel drivers still = relying >>>> on such mechanism. > Why this is good thing to do ? >=20 >>>> It's not possible, at least to my understanding, converting pty(4) = to >>>> cdevpriv(9) as happened with other drivers. This is mainly because = we >>>> always need a pair of devices (/dev/ptyXX and /dev/ttyXX) and >>>> userspace loops over ptyXX and after it successfully opens it tries = to >>>> open the other one with the same suffix. So, having a single device = is >>>> not really enough. >>>> My option, instead, is that of removing pty(4), which is nothing = more >>>> than a compatibility driver, and move pmtx(4) code somewhere else. >>>> The main drawback of the removal of this is that it makes = impossible >>>> to run FreeBSD <=3D 7 jails and SSH into them. I personally don't >>>> consider this a huge issue, in light of the fact that FreeBSD-7 has >>>> been EOL for a long time, but I would like to hear other people >>>> comments. > You don't, but other people care about ABI. >=20 > Besides older jails which you do not care about, there is significant > set of programs which were coded to use Berkley' pty directly. Even > high-profile applications like Emacs automatically selected pty(4) > up to its previous version on FreeBSD. >=20 >>>>=20 >>>> The code review for the proposed change can be found here: >>>> https://reviews.freebsd.org/D659 >>>>=20 >>>> If I won't get any objection I'll commit this in one week time, = i.e. >>>> August 27th. >>>=20 >>> Why not just statically create the pairs in /dev? Use some loader = tunable >>> (kern.ptymax) to set a count on the number of pre-created device = pairs to >>> create and then just explicitly create them in the mod_event = handler? It >>> could default to 100 or so. >>>=20 >>=20 >> Done, thank you for the suggestion, John. >>=20 >> root@maxwell:/home/davide # kldload pty >> root@maxwell/home/davide # sysctl -a |grep pty >> kern.tty_pty_warningcnt: 1 >> kern.npty: 32 >> debug.softdep.emptyjblocks: 0 >>=20 >> root@maxwell:/home/davide # ls /dev/pty* >> /dev/ptyl0 /dev/ptyl2 /dev/ptyl4 /dev/ptyl6 /dev/ptyl8 /dev/ptyla >> /dev/ptylc /dev/ptyle /dev/ptylg /dev/ptyli /dev/ptylk /dev/ptylm >> /dev/ptylo /dev/ptylq /dev/ptyls /dev/ptylu >> /dev/ptyl1 /dev/ptyl3 /dev/ptyl5 /dev/ptyl7 /dev/ptyl9 /dev/ptylb >> /dev/ptyld /dev/ptylf /dev/ptylh /dev/ptylj /dev/ptyll /dev/ptyln >> /dev/ptylp /dev/ptylr /dev/ptylt /dev/ptylv >>=20 >> https://reviews.freebsd.org/D1238 for review. >> I hope anybody that raised concerns about the previous patch can try >> this new one. >=20 > I do not see why dev_clone event makes your so unhappy. I object = against > removal of it (and this is what you are aiming at, it seems). It = provides > useful functionality, which is not substituted by anything cdevpriv(9) > can provide. >=20 > My only hope is that you are confusing dev_clone event and a library = of > clone_create(9)/clone_cleanup(9)/dev_stdclone(9) functions. The = former > is needed and cannot be replaced by cdevpriv(9). >=20 > The later is clumsy and never was used properly. My opinion is that it > is impossible to use properly. There are five uses of that in tree = left, > and it seems that removing them worth cleaning of buggy by design and > undocumented KPI. >=20 > Really big and complicated target is the hand-written timeout-based = (?!) > custom cloning code in snd(4). I believe it _can_ be converted to > cdevpriv(9). Thank you kib, I feel the same about leaving the pty system as it is. -Alfred=