From owner-svn-src-all@FreeBSD.ORG Fri Oct 24 15:11:33 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 59850106566C; Fri, 24 Oct 2008 15:11:33 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id D0EE38FC2C; Fri, 24 Oct 2008 15:11:32 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from localhost.corp.yahoo.com (john@localhost [IPv6:::1]) (authenticated bits=0) by server.baldwin.cx (8.14.2/8.14.2) with ESMTP id m9OFB5aW040064; Fri, 24 Oct 2008 11:11:24 -0400 (EDT) (envelope-from jhb@freebsd.org) From: John Baldwin To: Ed Schouten Date: Fri, 24 Oct 2008 10:36:09 -0400 User-Agent: KMail/1.9.7 References: <200810231911.m9NJBisd064280@svn.freebsd.org> <200810231555.06892.jhb@freebsd.org> <20081024045012.GD6808@hoeg.nl> In-Reply-To: <20081024045012.GD6808@hoeg.nl> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200810241036.10595.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [IPv6:::1]); Fri, 24 Oct 2008 11:11:24 -0400 (EDT) X-Virus-Scanned: ClamAV 0.93.1/8485/Fri Oct 24 09:38:51 2008 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=4.2 tests=BAYES_00,NO_RELAYS autolearn=ham version=3.1.3 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on server.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r184208 - head/sys/dev/uart X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2008 15:11:33 -0000 On Friday 24 October 2008 12:50:12 am Ed Schouten wrote: > * John Baldwin wrote: > > Perhaps have tty drivers sleep in detach until the tty is completely gone? > > Either that or free the unit number in the tty layer when the tty is > > abandoned. > > Well, I could add a routine to the TTY layer that does that. The reason > why the TTY layer is a little `lazy' with deallocating TTY unit numbers, > is because I want to be absolutely sure processes agree they do not use > the TTY (device name) anymore. > > I'll see if I can add a sleepable tty_gone() routine one of these days. I think what you want then is for the detach() routines to block until the tty is fully drained. This is similar to what we do for other places (ether_ifdetach() is supposed to sleep until the ifnet is completely unreferenced from userland for example (it may not fully ensure this yet, but that is the way the driver should use the API, the driver can't possibly close that sort of race in its own code). Actually, detach() _needs_ to block because when you kldunload a driver, once detach() returns the code segment for that module can be unmapped. If there are threads in that driver's tty routines still then you can get kernel page faults. -- John Baldwin