From owner-freebsd-arch@FreeBSD.ORG Mon Jan 8 19:20:21 2007 Return-Path: X-Original-To: freebsd-arch@freebsd.org Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D0C8916A47B for ; Mon, 8 Jan 2007 19:20:21 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (66-23-211-162.clients.speedfactory.net [66.23.211.162]) by mx1.freebsd.org (Postfix) with ESMTP id 4F04813C44C for ; Mon, 8 Jan 2007 19:20:21 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from localhost.corp.yahoo.com (john@localhost [127.0.0.1]) (authenticated bits=0) by server.baldwin.cx (8.13.6/8.13.6) with ESMTP id l08JKDdf068399; Mon, 8 Jan 2007 14:20:14 -0500 (EST) (envelope-from jhb@freebsd.org) From: John Baldwin To: freebsd-arch@freebsd.org Date: Mon, 8 Jan 2007 11:19:38 -0500 User-Agent: KMail/1.9.1 References: <20070106191401.GC8574@heave.ugcs.caltech.edu> <10319.1168112909@critter.freebsd.dk> <20070106213651.GD46094@hoeg.nl> In-Reply-To: <20070106213651.GD46094@hoeg.nl> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200701081119.39163.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [127.0.0.1]); Mon, 08 Jan 2007 14:20:15 -0500 (EST) X-Virus-Scanned: ClamAV 0.88.3/2424/Mon Jan 8 11:46:49 2007 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-4.2 required=4.2 tests=ALL_TRUSTED,AWL,BAYES_00, DATE_IN_PAST_03_06 autolearn=ham version=3.1.3 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on server.baldwin.cx Cc: Poul-Henning Kamp , Ed Schouten Subject: Re: Request for PTY/devfs changes X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jan 2007 19:20:21 -0000 On Saturday 06 January 2007 16:36, Ed Schouten wrote: > * Poul-Henning Kamp wrote: > > It doesn't even work to send a "this if for a create" flag along > > for the dev_clone, because another process might race in and do > > something silly before we get to that level. > > Sorry - I can't quite understand this. You mean a situation where two > threads perform an open() on the same filename at the same time could > cause two pty's to be allocated with the same name? But how is that > covered at this moment when two threads perform a stat() or open() at > the same time? devfs doesn't seem to handle any of this for you at all, forcing each bit of code that uses dev_clone to manage all this itself. :( When a device is opened you can mark it as opened. Perhaps you can have a callout that periodically checks to see if there are any "orphans" created due to a stat() and if so schedule a task on a taskqueue to purge them. I need to figure out something sane for /dev/ipmi0 before I can turn on cloning there myself. -- John Baldwin From owner-freebsd-arch@FreeBSD.ORG Mon Jan 8 19:29:07 2007 Return-Path: X-Original-To: freebsd-arch@freebsd.org Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D339416A415 for ; Mon, 8 Jan 2007 19:29:07 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from phk.freebsd.dk (phk.freebsd.dk [130.225.244.222]) by mx1.freebsd.org (Postfix) with ESMTP id 7A87A13C441 for ; Mon, 8 Jan 2007 19:29:07 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from critter.freebsd.dk (critter.freebsd.dk [192.168.48.2]) by phk.freebsd.dk (Postfix) with ESMTP id 7D3BB1747B; Mon, 8 Jan 2007 19:29:05 +0000 (UTC) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.13.8/8.13.8) with ESMTP id l08JT26E023674; Mon, 8 Jan 2007 19:29:02 GMT (envelope-from phk@critter.freebsd.dk) To: John Baldwin From: "Poul-Henning Kamp" In-Reply-To: Your message of "Mon, 08 Jan 2007 11:19:38 EST." <200701081119.39163.jhb@freebsd.org> Date: Mon, 08 Jan 2007 19:29:02 +0000 Message-ID: <23673.1168284542@critter.freebsd.dk> Sender: phk@critter.freebsd.dk Cc: Ed Schouten , freebsd-arch@freebsd.org Subject: Re: Request for PTY/devfs changes X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jan 2007 19:29:07 -0000 In message <200701081119.39163.jhb@freebsd.org>, John Baldwin writes: >On Saturday 06 January 2007 16:36, Ed Schouten wrote: >devfs doesn't seem to handle any of this for you at all, forcing each bit >of code that uses dev_clone to manage all this itself. :( When a device >is opened you can mark it as opened. Perhaps you can have a callout that >periodically checks to see if there are any "orphans" created due to a >stat() and if so schedule a task on a taskqueue to purge them. I need to >figure out something sane for /dev/ipmi0 before I can turn on cloning >there myself. If the device is entirely virtual, like pty, the driver should not allocate any state until open happens and the cdev should be marked with CHEAP_CLONE. In that case the cdev gets recycled quite fast if unreferenced. -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. From owner-freebsd-arch@FreeBSD.ORG Mon Jan 8 22:59:28 2007 Return-Path: X-Original-To: freebsd-arch@freebsd.org Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1B9BC16A580 for ; Mon, 8 Jan 2007 22:59:28 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (66-23-211-162.clients.speedfactory.net [66.23.211.162]) by mx1.freebsd.org (Postfix) with ESMTP id BCAAD13C448 for ; Mon, 8 Jan 2007 22:59:27 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from localhost.corp.yahoo.com (john@localhost [127.0.0.1]) (authenticated bits=0) by server.baldwin.cx (8.13.6/8.13.6) with ESMTP id l08MxKvh069768; Mon, 8 Jan 2007 17:59:21 -0500 (EST) (envelope-from jhb@freebsd.org) From: John Baldwin To: "Poul-Henning Kamp" Date: Mon, 8 Jan 2007 17:50:58 -0500 User-Agent: KMail/1.9.1 References: <23673.1168284542@critter.freebsd.dk> In-Reply-To: <23673.1168284542@critter.freebsd.dk> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200701081750.59131.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [127.0.0.1]); Mon, 08 Jan 2007 17:59:24 -0500 (EST) X-Virus-Scanned: ClamAV 0.88.3/2424/Mon Jan 8 11:46:49 2007 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=4.2 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.1.3 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on server.baldwin.cx Cc: Ed Schouten , freebsd-arch@freebsd.org Subject: Re: Request for PTY/devfs changes X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jan 2007 22:59:28 -0000 On Monday 08 January 2007 14:29, Poul-Henning Kamp wrote: > In message <200701081119.39163.jhb@freebsd.org>, John Baldwin writes: > >On Saturday 06 January 2007 16:36, Ed Schouten wrote: > > >devfs doesn't seem to handle any of this for you at all, forcing each bit > >of code that uses dev_clone to manage all this itself. :( When a device > >is opened you can mark it as opened. Perhaps you can have a callout that > >periodically checks to see if there are any "orphans" created due to a > >stat() and if so schedule a task on a taskqueue to purge them. I need to > >figure out something sane for /dev/ipmi0 before I can turn on cloning > >there myself. > > If the device is entirely virtual, like pty, the driver should not > allocate any state until open happens and the cdev should be marked > with CHEAP_CLONE. Unfortunately the pty uses 'make_dev_cred' with a specific credential and that credential reference is what is not getting released. > In that case the cdev gets recycled quite fast if unreferenced. How does devfs know to recycle the cdev? And will it recycle cdev's after they are closed? -- John Baldwin From owner-freebsd-arch@FreeBSD.ORG Tue Jan 9 05:15:05 2007 Return-Path: X-Original-To: freebsd-arch@freebsd.org Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E543316A412; Tue, 9 Jan 2007 05:15:04 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: from palm.hoeg.nl (palm.hoeg.nl [83.98.131.212]) by mx1.freebsd.org (Postfix) with ESMTP id 9D34C13C44C; Tue, 9 Jan 2007 05:15:04 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: by palm.hoeg.nl (Postfix, from userid 1000) id 0919F1CC6E; Tue, 9 Jan 2007 06:15:03 +0100 (CET) Date: Tue, 9 Jan 2007 06:15:03 +0100 From: Ed Schouten To: John Baldwin Message-ID: <20070109051502.GH46094@hoeg.nl> References: <23673.1168284542@critter.freebsd.dk> <200701081750.59131.jhb@freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="5vjQsMS/9MbKYGLq" Content-Disposition: inline In-Reply-To: <200701081750.59131.jhb@freebsd.org> User-Agent: Mutt/1.5.13 (2006-08-11) Cc: Poul-Henning Kamp , freebsd-arch@freebsd.org Subject: Re: Request for PTY/devfs changes X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jan 2007 05:15:05 -0000 --5vjQsMS/9MbKYGLq Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable * John Baldwin wrote: > Unfortunately the pty uses 'make_dev_cred' with a specific credential and= that=20 > credential reference is what is not getting released. Even worse: pty destruction has been completely disabled in the sourcecode. There is a '0 &&' prepended to an if-statement that causes the destructor never to be called. --=20 Ed Schouten WWW: http://g-rave.nl/ --5vjQsMS/9MbKYGLq Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (FreeBSD) iD8DBQFFoyTW52SDGA2eCwURAuVqAJ4jc5+pgQhyeHTeWIr3RhLkPGuuKACfcFHS 4ys712YfG0sVZTbacW8+Ej8= =hVNK -----END PGP SIGNATURE----- --5vjQsMS/9MbKYGLq-- From owner-freebsd-arch@FreeBSD.ORG Tue Jan 9 06:33:21 2007 Return-Path: X-Original-To: freebsd-arch@freebsd.org Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id F364216A407; Tue, 9 Jan 2007 06:33:20 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from phk.freebsd.dk (phk.freebsd.dk [130.225.244.222]) by mx1.freebsd.org (Postfix) with ESMTP id B47CD13C458; Tue, 9 Jan 2007 06:33:20 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from critter.freebsd.dk (critter.freebsd.dk [192.168.48.2]) by phk.freebsd.dk (Postfix) with ESMTP id 12BD01747B; Tue, 9 Jan 2007 06:33:18 +0000 (UTC) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.13.8/8.13.8) with ESMTP id l096XIga025838; Tue, 9 Jan 2007 06:33:18 GMT (envelope-from phk@critter.freebsd.dk) To: John Baldwin From: "Poul-Henning Kamp" In-Reply-To: Your message of "Mon, 08 Jan 2007 17:50:58 EST." <200701081750.59131.jhb@freebsd.org> Date: Tue, 09 Jan 2007 06:33:18 +0000 Message-ID: <25837.1168324398@critter.freebsd.dk> Sender: phk@critter.freebsd.dk Cc: Ed Schouten , freebsd-arch@freebsd.org Subject: Re: Request for PTY/devfs changes X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jan 2007 06:33:21 -0000 In message <200701081750.59131.jhb@freebsd.org>, John Baldwin writes: >On Monday 08 January 2007 14:29, Poul-Henning Kamp wrote: >Unfortunately the pty uses 'make_dev_cred' with a specific credential and that >credential reference is what is not getting released. devfs needs to learn about that cred if the cdev is marked cheap. >> In that case the cdev gets recycled quite fast if unreferenced. > >How does devfs know to recycle the cdev? And will it recycle cdev's after >they are closed? via the normal vnode cleaup. -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence.