Date: Fri, 22 Feb 2019 09:08:58 -0800 From: John Baldwin <jhb@FreeBSD.org> To: Andrew Gallatin <gallatin@cs.duke.edu>, Randall Stewart <rrs@netflix.com> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r344099 - head/sys/net Message-ID: <5651b9ff-fb79-d606-841e-ceb63936afdf@FreeBSD.org> In-Reply-To: <50bda411-2705-5a5d-2a0f-6bf3bfbfb2ef@cs.duke.edu> References: <201902131457.x1DEvx9V051533@repo.freebsd.org> <99453977-0f52-6050-3f40-e0fd7ea43d7f@FreeBSD.org> <80314D46-6FEC-462D-8EC5-FCE1ECFF81EF@netflix.com> <DC8566A0-7C0E-41E9-AA6A-7CDCE58976B4@netflix.com> <89d15ffe-1bc9-adaf-9307-4bf6541cc5e1@FreeBSD.org> <E0A0F0A9-18E2-47B0-9BB3-CF90C666ADA4@netflix.com> <1dcae85d-2a3a-1e7c-4692-c62f87020096@FreeBSD.org> <50bda411-2705-5a5d-2a0f-6bf3bfbfb2ef@cs.duke.edu>
next in thread | previous in thread | raw e-mail | index | archive | help
On 2/22/19 8:50 AM, Andrew Gallatin wrote: > I think the misunderstanding here is that I think he's not getting the > ifp from the route. > > My recollection is that he is holding the ifps when he enables HW pacing > in BBR. Due to limitations in different NIC hardware, you can only have > N different rates, etc. So he goes ahead and allocates those N rates up > front so that he knows he can reserve them & know that he can always get > them. > > Then when the system reboots, BBR has an eventhandler that goes ahead > and frees those reservations. I think that he's using the ifp that he's > holding here. > > In the case that tripped him up, that ifp was lagg. > > Your workaround would also work, but Randall does have a point about > symmetric alloc/free especially when viewed from his perspective, But it's not really an alloc. We have many other places in the kernel where an alloc routine is actually a "forward" to something else that allocates the real thing. For example, when you add a kevent on a file descriptor, that is routed to the 'file_filtops' in kern/kern_event.c, but that filtops only has an attach routine, it doesn't have a detach routine because it's attach routine is a forwarder to other filtops. It invokes the fo_kqfilter method that is responsible for setting up the right filtops to use. For sockets this routes to one of three filtops that all have detach methods but no attach methods. The way this is handled is that anytime a kevent is detached, the current filtops is used to find the detach event handler. We don't use the filter's type to get back to the original file_filtops and require that to forward the detach request on to the real filtops. Having the tag save the "real" ifp is similar to knote's storing the real filtops. Given your specific use case, it does seem that this commit is sufficient, but it's not the "always works" way to free a tag, and it might be used as a template that gets copied for use in another case where the extra guarantees of this specific use case don't hold. Given that I'd like to explore making lagg and vlan allocate real interposing tags to handle TLS, this may prove mostly academic as they would have "real" free routines then since their alloc routines would just be forwarders. -- John Baldwin
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5651b9ff-fb79-d606-841e-ceb63936afdf>