From owner-svn-src-head@FreeBSD.ORG Thu May 21 15:53:56 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 25F1E1065679; Thu, 21 May 2009 15:53:56 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id F147A8FC1C; Thu, 21 May 2009 15:53:55 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id 9083946B29; Thu, 21 May 2009 11:53:55 -0400 (EDT) Date: Thu, 21 May 2009 16:53:55 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: "M. Warner Losh" In-Reply-To: <20090521.094100.70797067.imp@bsdimp.com> Message-ID: References: <3bbf2fe10905210629p46c7a204v6863aaba77354462@mail.gmail.com> <200905210942.35555.jhb@freebsd.org> <20090521.094100.70797067.imp@bsdimp.com> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: src-committers@FreeBSD.org, jhb@FreeBSD.org, svn-src-all@FreeBSD.org, attilio@FreeBSD.org, svn-src-head@FreeBSD.org, kostikbel@gmail.com Subject: Re: svn commit: r192535 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 May 2009 15:53:56 -0000 On Thu, 21 May 2009, M. Warner Losh wrote: > : devctl_notify() probably needs to grow a sleepable flag, or perhaps we need > : two variations, one that can sleep. > > devctl_notify() has expanded well beyond its original needs. Having an > extra case for sleeping is the wrong way to solve this problem. Really. > We're adding hacks on hacks on hacks here and we need to step back and > think. > > I specifically didn't put in CDEV notifications into devd when I originally > did it because one can get the same notification via kevents on /dev. > Maybe the right answer is to remove this stuff entirely and update devd to > do that instead? It isn't a lot of code, and should provide equivalent > functionality without needing to change the rules of the game when it comes > to destroy_dev(). Especially this close to the code slush... Well, the "can it sleep" question is fundamentally about whether it's a reliable protocol or not in the presence of low kernel memory -- experience in the network stack says you give code the option of failing if sleeping indefinitely if it knows it's running in a safe context, and otherwise you allow it to fail. Calls like if_detach(), destroy_dev(), etc, all assume unbounded sleeping is OK, so should use M_WAITOK for generating messages to devctl (although there is a question about over-filling buffers, etc -- should they block if things get backed up, and if so can that deadlock?). If there are cases where unsleepable locks must be held over notification, or it must run in a non-sleepable context such as an ithread, having a non-sleepable version (and hence one that can fail) is required. Robert N M Watson Computer Laboratory University of Cambridge