From owner-freebsd-stable@FreeBSD.ORG Thu Jul 30 15:10:00 2009 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 036BD1065670 for ; Thu, 30 Jul 2009 15:10:00 +0000 (UTC) (envelope-from max@love2party.net) Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.186]) by mx1.freebsd.org (Postfix) with ESMTP id 883328FC08 for ; Thu, 30 Jul 2009 15:09:59 +0000 (UTC) (envelope-from max@love2party.net) Received: from vampire.homelinux.org (dslb-088-066-029-050.pools.arcor-ip.net [88.66.29.50]) by mrelayeu.kundenserver.de (node=mreu2) with ESMTP (Nemesis) id 0MKv5w-1MWX4N42DM-000cNA; Thu, 30 Jul 2009 16:57:24 +0200 Received: (qmail 28017 invoked from network); 30 Jul 2009 14:57:23 -0000 Received: from kvm.laiers.local (HELO kvm.localnet) (192.168.4.200) by mx.laiers.local with SMTP; 30 Jul 2009 14:57:23 -0000 From: Max Laier Organization: FreeBSD To: Robert Watson Date: Thu, 30 Jul 2009 16:57:22 +0200 User-Agent: KMail/1.11.4 (Linux/2.6.30-ARCH; KDE/4.2.4; x86_64; ; ) References: <06D5F9F6F655AD4C92E28B662F7F853E02F6F4BC@seaxch09.desktop.isilon.com> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200907301657.22609.max@love2party.net> X-Provags-ID: V01U2FsdGVkX1/Dlwmz0EhS7YnTjhLL+PQL9iZUZil+td8+xVC XWtAANmv6Jg5fJC8yH2eNV3yIl4dWl4Mvu2d8UZyGVNOEevo0d bbw0r4/xgXQpG2ueG6F7Q== Cc: freebsd-stable@freebsd.org, Matthew Fleming Subject: Re: Loading ng_socket at runtime? X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jul 2009 15:10:00 -0000 On Thursday 30 July 2009 11:39:00 Robert Watson wrote: > On Wed, 29 Jul 2009, Matthew Fleming wrote: > > I'm doing a migration from releng/6.1 to stable/7, and one of the many > > new things is that I get a warning when doing things with ng_socket that > > didn't used to happen. > > > > WARNING: attempt to net_add_domain(netgraph) after domainfinalize() > > I've wondered about these warnings also, and am not sure they're justified > -- any protocol loading after domainfinalize() should expect that timers > are already started, etc, and loadable protocols are clearly desirable. > > > - ignore the warning (usually a bad idea...) > > Probably remove the warning. Some more synchronization is likely required > in domain registration than is currently there -- on the other hand, it's > probably not a big issue that it's missing as write operations on the > domain list are conservative and extremely rare. > > I've CC'd Max Laier, who added the warnings -- perhaps he could lend some > insight into the types of problems he anticipated. The main one I'm aware > of is that mutating the domain list on a live system is risky because it's > not well-synchronized -- however, adding domains should be pretty safe in > practice. This originated from http://www.freebsd.org/cgi/query-pr.cgi?pr=kern/72772 - if I remember correctly. As usual, the devil is in the details. In the case of the PR there was a race for if_afdata contents. The specific problem described in that PR is a static initialization order problem, but - as I recall - we did see a similar issue with runtime loading of domains as well. The waring was added as a compromise. We didn't want to remove the ability to add netgraph at runtime, but would want to discourage more domains with module capabilities. A full fix was way out of reach at the time as it means a lot of synchronization around otherwise very static data (e.g. if_afdata). Maybe it is time to revisit as we now have read-mostly locks and there is more locking in place for things like address-lists (which was also an area of concern). In any case and my opinion, removing a domain should never be allowed at runtime. Unless we add proper synchronization around the protosw, that is. -- /"\ Best regards, | mlaier@freebsd.org \ / Max Laier | ICQ #67774661 X http://pf4freebsd.love2party.net/ | mlaier@EFnet / \ ASCII Ribbon Campaign | Against HTML Mail and News