cvs commit: src/sys/sys protosw.h src/sys/kern
uipc_domain.cuipc_socket2.c
Brooks Davis
brooks at one-eyed-alien.net
Tue Oct 19 16:29:19 PDT 2004
On Tue, Oct 19, 2004 at 04:12:27PM -0700, Julian Elischer wrote:
>
>
> Brooks Davis wrote:
>
> >On Tue, Oct 19, 2004 at 06:19:10PM -0400, Robert Watson wrote:
> >
> >
> >>On Tue, 19 Oct 2004, Julian Elischer wrote:
> >>
> >>
> >>
> >>>>>Another point: If you really want to keep the possibility to remove a
> >>>>>protocol, you have to introduce some busy counter that pervents
> >>>>>removal while
> >>>>>the kernel is inside a protocol function. This has to be handled by the
> >>>>>protocol itself, but it has to be taken care of somehow.
> >>>>>
> >>>>>
> >>>each protocol array entry could have either a mutex or a refcount or
> >>>both..
> >>>
> >>>
> >>The trick here is to get just enough synchronization to not break, but not
> >>enough to hurt. That's one of the reasons why I feel like the heavier
> >>weight approaches taken elsewhere may not be appropriate here. I guess no
> >>one is talking about loading UDP, but at the same time if we're going to
> >>have generic loadable protocol support, it would be nice to get a pretty
> >>clean API that would meet the requirements of higher volume protocols. As
> >>I mentioned in a previous e-mail, it might almost be desirable to say "no
> >>unloading" and simply avoid the hard problems, since atomic add is easy
> >>whereas atomic remove is hard.
> >>
> >>
> >
> >One of the things I've been looking at with interfaces is trying to
> >squash the really big races (mostly dummynet) by avoiding holding a
> >pointer to an interface any longer then necessicary. Instead I'm
> >
> >
> >planning to hold interface indexes instead.
> >
> >
> I've been against this idea for some time..
> there are some situations where interfaces can get created and destroyed
> as some relatively large rate.
> (i.e several per second in a worst case.)
>
> In particular I've seen interface reation and deltion on a very dynamic
> manner with some
> proprietary VPN solutions with interfaces coming and going on a regular
> basis as links come up and down.
>
>
> Consider doing the same as we do for PIDS..
> in 386bsd. one of the ealiest bugs we saw was traced back originally to
> something using a process
> pointer which had been stored somewhere. (The process however could exit)
> The fix was to make a hash-table of pids and store the pid instead, (and
> a gen number).
> If the process went away you couldn't find it, and the gen number would
> stop you from matching new processes.
>
> I think the same thing here.. rather than storing an index into an array
> (which could change or
> become invalid.) store a long interface ID that is always incremented
> and kept in a
> small hash table. This allows the slots in the array to be reused.
> (It's a pity an index is required by
> some standards.. maye however they could live with the ID as well).
> I'll live with the wrap time for interface creation.. (It'll probably
> outlive me however..)
We now have the index plus generation number in the form of
if_data.ifi_epoch so you can do that trick (if interfaces are being
created and destroyed with sub-second frequency we can move to storing
a bintime from a time_t in the 6.x timeframe.) The indexes we generate
are useless for SNMP in vpn-like environments. I've proposed a couple
of partial solutions in my EuroBSDCon paper, but at the end of the day,
complex systems like VPN concentrators will need to manage their own
indexes entirely internally and only use the if_index as a temporary
handle on each interface.
-- Brooks
--
Any statement of the form "X is the one, true Y" is FALSE.
PGP fingerprint 655D 519C 26A7 82E7 2529 9BF0 5D8E 8BE9 F238 1AD4
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/cvs-src/attachments/20041019/eb9bdebb/attachment.bin
More information about the cvs-src
mailing list