From owner-freebsd-arch@FreeBSD.ORG Mon Aug 11 15:44:56 2008 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 61CE21065675 for ; Mon, 11 Aug 2008 15:44:56 +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 D82D48FC2A for ; Mon, 11 Aug 2008 15:44:55 +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 m7BFhtSJ064616; Mon, 11 Aug 2008 11:44:08 -0400 (EDT) (envelope-from jhb@freebsd.org) From: John Baldwin To: "M. Warner Losh" Date: Mon, 11 Aug 2008 11:43:49 -0400 User-Agent: KMail/1.9.7 References: <200808091637.33820.jhb@freebsd.org> <20080810.165333.232928772.imp@bsdimp.com> In-Reply-To: <20080810.165333.232928772.imp@bsdimp.com> MIME-Version: 1.0 Content-Disposition: inline Message-Id: <200808111143.50023.jhb@freebsd.org> Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [IPv6:::1]); Mon, 11 Aug 2008 11:44:08 -0400 (EDT) X-Virus-Scanned: ClamAV 0.93.1/8007/Mon Aug 11 09:51:54 2008 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=4.2 tests=AWL,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: arch@freebsd.org Subject: Re: Make MOD_QUIESCE a bit more useful.. 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, 11 Aug 2008 15:44:56 -0000 On Sunday 10 August 2008 06:53:33 pm M. Warner Losh wrote: > In message: <200808091637.33820.jhb@freebsd.org> > John Baldwin writes: > : So currently the MOD_QUIESCE event is posted to a module when unloading a kld > : so it can veto non-forced unloads. However, the current implementation in > : the kernel linker is to run through all the modules in a file, posting > : MOD_QUIESCE followed by MOD_UNLOAD on each module serially. Thus, if you > : have multiple modules in a single kld and one of the modules veto's an unload > : request via MOD_QUIESCE, you don't know as the module author if any of your > : modules were unloaded via MOD_UNLOAD or not. I think a better approach would > : be to change the kernel linker to invoke MOD_QUIESCE on all modules in a > : single pass first. If none of those fail (or it's a forced unload), then it > : can do a second pass invoking MOD_UNLOAD on all the modules. > > That sounds great to me. I'm a bit surprised it is implemented the > way you say... So was I. What happens now is that the kernel linker does a for loop over all the modules calling 'module_unload()'. module_unload() invokes both MOD_QUIESCE and MOD_UNLOAD back to back. Hmm, so fixing this brings up one extra note: Do we need a new module event (say MOD_UNLOAD_ABORTED, MOD_AWAKEN, or MOD_DEQUIESCE) that would get invoked when a kldunload is veto'd by a MOD_QUIESCE event that would get posted to all the modules that had successfully QUIESCED so far? -- John Baldwin