From owner-freebsd-current@FreeBSD.ORG Sat Aug 2 13:20:50 2014 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6D44CD4D for ; Sat, 2 Aug 2014 13:20:50 +0000 (UTC) Received: from mail-qa0-x22e.google.com (mail-qa0-x22e.google.com [IPv6:2607:f8b0:400d:c00::22e]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2E6E72F53 for ; Sat, 2 Aug 2014 13:20:50 +0000 (UTC) Received: by mail-qa0-f46.google.com with SMTP id v10so5088527qac.19 for ; Sat, 02 Aug 2014 06:20:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=YWhjRMRfDnMgWHLrMlJCMMvTu5SuQ3ei2kG+bDzXiz8=; b=0ajhej8AHXdytyLaZJBnPq2JDrvYnR0UZcmVZYxu/i+riojEQa7dgxscWt59XbpV4y u35G4AR5V3fm/abY3Yw6uo6vaNR5xuBTyvZGHHjd9TZom2XZvlZOP69jg6u+P6NgXzNG NHKSya07PqATj8pjSVlJBv/QmvaTPSYsjFjFOFmAxt3ZhjyA+h75qI/WJKSj3pMvqa3f +pmcBBNSRluzwLS1g4nbd4Il1NQWW1orL3zqus3+5MhwQ1ADa3TMbMOqMdHHI/Jfoj+g 17nx49Q+UN7lEF1GtrCuKvhOn8fvkaAaQeIhcIFPnUPEqxAuuIBIcPL0Q91i4JmylV4P 9xoA== MIME-Version: 1.0 X-Received: by 10.140.41.133 with SMTP id z5mr17894188qgz.99.1406985649178; Sat, 02 Aug 2014 06:20:49 -0700 (PDT) Received: by 10.140.48.2 with HTTP; Sat, 2 Aug 2014 06:20:49 -0700 (PDT) In-Reply-To: <20140801222118.GH50495@funkthat.com> References: <20140801193403.GE50495@funkthat.com> <20140801222118.GH50495@funkthat.com> Date: Sat, 2 Aug 2014 15:20:49 +0200 Message-ID: Subject: Re: domain_add(xxx) after domainfinalize... From: Svatopluk Kraus To: freebsd-current@freebsd.org Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.18 Cc: John-Mark Gurney X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Aug 2014 13:20:50 -0000 Well, I did not look at network stack for long time, so the following things could be obsolete now, but at least: (1) There is some room left in mbuf header on its allocation, so protocols (link) headers can be added in the front of data without need of reallocation or data copying. The size of the room is evaluated from all domains at boot time. (2) All network address masks are shared among domains and protocols in mask radix tree. The tree is created with particular key size, which is again evaluated from all domains as maximal size of all known addresses. So, if new domain added after these evaluations does not break both them and some other things, there is no problem. Otherwise, some warnings are always nice if things go bad. Maybe some function which examine new domain and say there is no risk to add it would be nice. Svata On Sat, Aug 2, 2014 at 12:21 AM, John-Mark Gurney wrote: > Svatopluk Kraus wrote this message on Sat, Aug 02, 2014 at 00:05 +0200: > > Just what I've got in January 2011: > > > http://lists.freebsd.org/pipermail/freebsd-hackers/2011-January/034037.html > > Sadly, after three (or six+) years, it is clear that these bugs will > not be fixed, and this warning message is not useful, since no one has > stepped up to fix them.. > > btw, you might want to create a bug w/ the information you tracked down > to hopefully help the person that decides to finally fix them, though > I doubt they will ever be fixed as people apparently don't see bad > behavior... > > Unless someone fixes the bugs in the next few days, I will commit the > following patch: > Index: uipc_domain.c > =================================================================== > --- uipc_domain.c (revision 266964) > +++ uipc_domain.c (working copy) > @@ -227,15 +227,10 @@ > printf("WARNING: attempt to domain_add(%s) before " > "domaininit()\n", dp->dom_name); > #endif > -#ifdef notyet > - KASSERT(domain_init_status < 2, > - ("attempt to domain_add(%s) after domainfinalize()", > - dp->dom_name)); > -#else > - if (domain_init_status >= 2) > - printf("WARNING: attempt to domain_add(%s) after " > - "domainfinalize()\n", dp->dom_name); > -#endif > + /* > + * XXX - there are bugs WRT to adding domain after domain_finalize > is > + * called > + */ > mtx_unlock(&dom_mtx); > } > > > > On Fri, Aug 1, 2014 at 9:34 PM, John-Mark Gurney > wrote: > > > > > So, I have a laptop that devd loads the bluetooth module every time.. > > > > > > This means I get the following error on every boot: > > > WARNING: attempt to domain_add(bluetooth) after domainfinalize() > > > WARNING: attempt to domain_add(netgraph) after domainfinalize() > > > > > > Is there any real benefit to this warning? I just looked at the code, > > > and the domain gets added despite the warning... > > > > > > Also, it looks like the pervious warning, we should just make that an > > > if/panic since it's clearly a programming bug, or kill the ifndef > > > INVARIANTS... > > -- > John-Mark Gurney Voice: +1 415 225 5579 > > "All that I will do, has been done, All that I have, has not." >