From owner-freebsd-hackers@FreeBSD.ORG Thu Jan 13 19:29:56 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5F280106566B for ; Thu, 13 Jan 2011 19:29:56 +0000 (UTC) (envelope-from se@FreeBSD.org) Received: from nm5.bullet.mail.sp2.yahoo.com (nm5.bullet.mail.sp2.yahoo.com [98.139.91.75]) by mx1.freebsd.org (Postfix) with SMTP id 3F9A28FC1D for ; Thu, 13 Jan 2011 19:29:56 +0000 (UTC) Received: from [98.139.91.63] by nm5.bullet.mail.sp2.yahoo.com with NNFMP; 13 Jan 2011 19:16:35 -0000 Received: from [98.136.185.47] by tm3.bullet.mail.sp2.yahoo.com with NNFMP; 13 Jan 2011 19:16:35 -0000 Received: from [127.0.0.1] by smtp108.mail.gq1.yahoo.com with NNFMP; 13 Jan 2011 19:16:35 -0000 X-Yahoo-Newman-Id: 16594.95375.bm@smtp108.mail.gq1.yahoo.com Received: from [192.168.119.19] (se@81.173.181.180 with plain) by smtp108.mail.gq1.yahoo.com with SMTP; 13 Jan 2011 11:16:34 -0800 PST X-Yahoo-SMTP: iDf2N9.swBDAhYEh7VHfpgq0lnq. X-YMail-OSG: HymDzi4VM1l8jWkxLd1sXdzavvPz6TlkqRHrK4sd9BQeNUw Ivg3Fy861E_Uan55in3Vu.donqMHjeyn5LN6qgouVj65ZEWgrFucQfZ1evWB zV8wes5ZrNCkirE9lz.Zyz3i1ZJSUxljvo7aQ3joeu5C020CJa2edh8gKN0j T0v9SVGdsx9Di.y6hs5GGOYYV_w0zsRRn_0FWE_zIDdzmvncQWyZkPk7xkio ggQ8SQKrQuSJkMVY_0JGhBJincZTEqA774lvj3UEBUk.IGEHjmdvbvAfFOxP 8J11YbpEZQCXETrSOQfUUjs5o_ueOeWeJnYsNRm.Nns_sI0tXqAonI67498R .Y1tVR5cdBvvqpHcX0Fy4mVjZ3A-- X-Yahoo-Newman-Property: ymail-3 Message-ID: <4D2F4F95.6020304@FreeBSD.org> Date: Thu, 13 Jan 2011 20:16:37 +0100 From: Stefan Esser User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.1.18) Gecko/20081105 Thunderbird/2.0.0.18 ThunderBrowse/3.2.2.1 Mnenhy/0.7.5.666 MIME-Version: 1.0 To: freebsd-hackers@freebsd.org References: <4D2E90C9.2010600@freebsd.org> In-Reply-To: <4D2E90C9.2010600@freebsd.org> X-Enigmail-Version: 1.1.1 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: Re: A question about "WARNING: attempt to domain_add(xyz) after domainfinalize()" X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Jan 2011 19:29:56 -0000 Am 13.01.2011 06:42, schrieb Julian Elischer: > On 1/12/11 5:26 AM, Svatopluk Kraus wrote: >> Hi, >> >> I'd like to add a new network domain into kernel (and never remove it) >> from loadable module. In fact, I did it, but I got following warning >> from domain_add(): "WARNING: attempt to domain_add(xyz) after >> domainfinalize()". Now, I try to figure out what is behind the >> warning, which seems to become KASSERT (now, in notyet section part of >> code, which is 6 years old). > > just ignore that message, everyone else does :-) Well, yes, but there are actual problems in the current code and it needs to be worked on. I checked the situation the last time the question arose about half a year ago, and there are races and real bugs (IIRC, you can only add one "domain" from a KLD, a second one will not be initialized). My spare time was (and to date is) very limited, but I still intend to prepare a fix (not sure whether the races can be completely avoided, but they are extremely hard to trigger since they only exist during module load). > teh problem is that the idea of domainfinalize() is incompatible with > having the ability to add domains from modules. > Luckily domain finalize doesn't actually do anything that stops your new > domain from working so it doesn't matter. Not exactly true: In fact, domainfinalize performs some init work for all domains and interfaces that have been compiled into the kernel. After domainfinalize has been called, this domain initialization (the initialization of pointers in the interface structure of all existing network devices) has to be performed by a call to the same code that domainfinalize calls in a loop for compiled in network interfaces. But there are checks in that code, which need to be checked and fixed. I had made annotations to the affected files, half a year ago, but do not have access to my development system right now and thus I cannot provide details, now. > you'll get the same message if you add netgraph.ko as an object. The netgraph domain is probably the only one that is often loaded from a KLD in generic systems. If another driver adds a domain and netgraph is also required, then I'd strongly suggest to compile netgraph into the kernel (and thus to have only one domain added from a KLD). Best regards, STefan