From owner-freebsd-current@FreeBSD.ORG Tue Jul 17 06:03:16 2012 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C6544106564A; Tue, 17 Jul 2012 06:03:16 +0000 (UTC) (envelope-from lacombar@gmail.com) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com [209.85.217.182]) by mx1.freebsd.org (Postfix) with ESMTP id 121728FC14; Tue, 17 Jul 2012 06:03:15 +0000 (UTC) Received: by lbon10 with SMTP id n10so208792lbo.13 for ; Mon, 16 Jul 2012 23:03:15 -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=FQSELrt8brOetp6tnq4nqSlgLLQaH7zTcdGHKvkojaw=; b=mVI9fNBeIUkmY3Y1mAl7XFFtPswARDLLwogZ746g30BojycpGBwuvciJQ+zokPqxGN cPId/TQTJRiTDlXBXWud/839X0qg72E7Ro885p/rtAIZ1qvaobD6SIsvobSCAD14tVfl GBdb3E/RZ0za3iLe0/yVhujwjcYF7L/MoZ3LDNJ4g+4XQxmkbhI4X31CLe+3wSExKfnC RLmz9RBkkb5ox+9oz18X70kaJmd2HGJNIRnBQJ3QhK1Ee/lrbLty528EBeQZn3XhZFEI 9terNdT8j7oiBovddBoIerdy00HfS9JrDLGcoqMd+sdel5lSkucU0DyYOiglN/HR7oBe dq8w== MIME-Version: 1.0 Received: by 10.112.54.100 with SMTP id i4mr566357lbp.97.1342504995036; Mon, 16 Jul 2012 23:03:15 -0700 (PDT) Received: by 10.114.13.68 with HTTP; Mon, 16 Jul 2012 23:03:14 -0700 (PDT) In-Reply-To: References: <31A0DCE7-3B93-41BC-805A-E0B163892112@bsdimp.com> <5C18109D-E7A8-4868-BEA9-26B63360BB24@bsdimp.com> <8048FFC5-6952-49FC-849D-EA1A5675ACBE@bsdimp.com> <73F3FBC9-337C-4F61-9470-5173D6DAE56B@bsdimp.com> Date: Tue, 17 Jul 2012 02:03:14 -0400 Message-ID: From: Arnaud Lacombe To: Warner Losh Content-Type: text/plain; charset=ISO-8859-1 Cc: FreeBSD Hackers , FreeBSD Current Subject: Re: newbus' ivar's limitation.. X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 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: Tue, 17 Jul 2012 06:03:17 -0000 Hi, On Fri, Jul 13, 2012 at 1:56 PM, Arnaud Lacombe wrote: > Hi, > > On Thu, Jul 12, 2012 at 1:20 AM, Warner Losh wrote: >> [..] >> Honestly, though, I think you'll be more pissed when you find out that the N:1 interface that you want is being done in the wrong domain. But I've been wrong before and look forward to seeing your replacement. >> > I will just pass function pointers for now, if things should be done > dirty, let's be explicit about it. > > Now, the hinted device attachment did work quite smoothly, however, I > would have a few suggestion: > 1) add a call to bus_enumerate_hinted_children() before the call > DEVICE_IDENTIFY() call in bus_generic_driver_added() > > this is required to be able to support dynamic loading and attachment > of hinted children. > > 2) have a generic bus_hinted_child method which would just add a new > child to the bus. > > 3) have bus_enumerate_hinted_children() and bus_generic_attach() > always ran on device attachment. > > There is current +100 explicit call to bus_generic_attach() in the > sys/dev/ tree. This should be done always and implicitly. > > 4) have bus_generic_detach() always ran prior to device detachment > > If not already the case. There is still the same +100 direct call to > bus_generic_detach is the tree. > > 5) have the bus_generic_* method be the default of their respective method > > 6) have device_delete_child() called upon device detachment. > > As a rule of thumb, when a kld is unloaded there should not be any > remains of anything built previously. Without device_delete_child() or > proper singleton implementation, multiple load/unload sequence of bus > will attempt to attach multiple version of a child, even if the single > child was added prior to the bus_generic_attach() call. > > Also, as a rule of thumb, if the same logic is implemented in more > than a few buses, it should be made generic and implicit. > > I am lazy, I hate doing the same things over and over, not to say it > raised the likelihood of bugs' introduction... > could I at least get some feedback on the proposals above ? Thanks, - Arnaud