Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 17 Jul 2012 02:03:14 -0400
From:      Arnaud Lacombe <lacombar@gmail.com>
To:        Warner Losh <imp@bsdimp.com>
Cc:        FreeBSD Hackers <freebsd-hackers@freebsd.org>, FreeBSD Current <freebsd-current@freebsd.org>
Subject:   Re: newbus' ivar's limitation..
Message-ID:  <CACqU3MVdYwg_VriY=FgbZ20xV0Xb6CkdpZyrxRTLw60GTFJj=A@mail.gmail.com>
In-Reply-To: <CACqU3MW%2BBjXu%2B2sAgbtc%2Bx-Mc4heowr9Bi6LAfFR5QYsMVf2Nw@mail.gmail.com>
References:  <CACqU3MVh6shncm2Vtqj9oe_HxowWscCZ1eJf0q2F%2B=t_xKKBfQ@mail.gmail.com> <31A0DCE7-3B93-41BC-805A-E0B163892112@bsdimp.com> <CACqU3MVy65ck%2Bb8TKXwfXnBV9iuFzj%2ButRBH4Ecg6XDz3Vg5kQ@mail.gmail.com> <5C18109D-E7A8-4868-BEA9-26B63360BB24@bsdimp.com> <CACqU3MUcbozpyqRLUS91p-%2BXANsisLoHzYpbQ8KjCr02=kMHYg@mail.gmail.com> <8048FFC5-6952-49FC-849D-EA1A5675ACBE@bsdimp.com> <CACqU3MVVDSo8fNmCcCm0dyq6skOf%2BJ_9bUWmxpBi137FD=efyg@mail.gmail.com> <CACqU3MVZmuavxcLZ8LGqP5Ze0yW4bkd5NfSFUfUK_Q6wbzDs8Q@mail.gmail.com> <73F3FBC9-337C-4F61-9470-5173D6DAE56B@bsdimp.com> <CACqU3MW%2BBjXu%2B2sAgbtc%2Bx-Mc4heowr9Bi6LAfFR5QYsMVf2Nw@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Hi,

On Fri, Jul 13, 2012 at 1:56 PM, Arnaud Lacombe <lacombar@gmail.com> wrote:
> Hi,
>
> On Thu, Jul 12, 2012 at 1:20 AM, Warner Losh <imp@bsdimp.com> 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CACqU3MVdYwg_VriY=FgbZ20xV0Xb6CkdpZyrxRTLw60GTFJj=A>