tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: MP-safe ifnet with psz & psref



On Fri, May 20, 2016 at 3:01 AM, Taylor R Campbell
<campbell+netbsd-tech-kern%mumble.net@localhost> wrote:
>    Date: Thu, 19 May 2016 16:11:56 +0900
>    From: Ryota Ozaki <ozaki-r%netbsd.org@localhost>
>
>    I'm working on a next task that replaces an ifnet pointer embedded
>    in other objects, say mbuf and rtentry, with an interface index
>    (ifnet#if_index) and when we take an ifnet object from such objects,
>    look it up (with psz or psref) from the interface collection
>    (ifindex2ifnet, just an array). By doing so, we can ensure a taken
>    ifnet object isn't freed during manipulating it. And if an interface
>    which we're obtaining is being destroyed, a look-up just returns NULL.
>
> Can you explain why there are long-term mbufs and rtentries that may
> continue to point to ifnets that are gone?  Can you instead arrange to
> (1) prevent an ifnet from being used, and (2) flush all mbufs and
> rtentries pointing at it, before (3) destroying the ifnet?

For mbufs, currently we do nothing when destroying an interface object.
We can flush mbufs queued in its if_percpuq, but it's difficult to all
mbufs pointing to the interface, for example mbufs in other queues such
as pktqueues for ip and gif. (Well, we may be able to flush such mbufs
in every existing queues, I'm not sure it's a realistic approach.)
And we also have to wait for in-flight mbufs, which are dequeued and
in use, are disappeared somehow.

For rtentries, hmm I'm wrong :-/ The problem should be handled by
rtentries (the routing table), not ifnet. (joerg's comment awakes me.)

Thanks,
  ozaki-r


Home | Main Index | Thread Index | Old Index