Date: Mon, 22 Oct 2012 10:41:19 -0700 From: Adrian Chadd <adrian@freebsd.org> To: Julian Elischer <julian@freebsd.org> Cc: freebsd-net@freebsd.org, Marko Zec <zec@fer.hr>, freebsd-hackers@freebsd.org Subject: Re: VIMAGE crashes on 9.x with hotplug net80211 devices Message-ID: <CAJ-Vmo=qsNAJxsUBBs9fpUZ-qHjVC79G0wy8OhRJjMpfFgzHqg@mail.gmail.com> In-Reply-To: <5085827D.5090108@freebsd.org> References: <CAJ-VmomchJZ7GUKrAjmmyBXDw-6H6O5fAxT_tfAFfhU=HknG1g@mail.gmail.com> <201210212322.48791.zec@fer.hr> <CAJ-VmokH2VqK-5of2%2B79mKbQ9m61tTvdqCCSJkj3EPejmDaH=A@mail.gmail.com> <201210221208.37592.zec@fer.hr> <CAJ-VmokU2yY39y0BO8QroJWK8YUUZG=WtakxjMpd%2B_AjMZzt7A@mail.gmail.com> <5085827D.5090108@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On 22 October 2012 10:29, Julian Elischer <julian@freebsd.org> wrote: >> The trouble is going to be handling unplug and kldunload events too. >> Does curvnet -> vnet0 during kldunload events? > > I think in unload events we probably need to cycle through all vnets and > do individual shutdowns of anything that is set up on that vnet.. > (but I'm not reading the code to say that, it's possible to ignore me > safely) Well, in an unload event you know the device you're unloading. However, there may be clones and such involved. It's not like a kldunload will kill a specific VAP on an ath(4) interface, it'll kill the whole interface with all vaps. So in net80211 I need to teach the VAP setup/destroy path to use CURVNET_*() correctly. That's a given. I still however need to ensure that CURVNET_SET(vnet0)/CURVNET_RESTORE() is used around the device attach/detach, as right now the hotplug code doesn't do this. So Marko: * Given that you've "fixed" the kldload path and bootup path to set CURVNET_SET(vnet0) as a special case, how about we teach the device_attach() path to just do this in general? * How does kldunload work right now if any devices are in a vnet? If I kldunload if_bridge with vnets everywhere, what happens? if_bridge doesn't at all know anything about VIMAGE. How do the cloned interfaces get correctly destroyed? I don't want to have to teach _every network device_ that they need to be vnet aware on attach or detach. * the device probe/attach path should just use vnet0; and * the device detach/destroy path, to things like if_free(), should have those functions just use ifp->if_vnet, rather than assuming CURVNET_SET() was called. I know you wanted to be warned if parts of the stack weren't correctly using CURVNET_SET()/CURVNET_RESTORE(), but I think this battle is already lost. :/ Adrian
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAJ-Vmo=qsNAJxsUBBs9fpUZ-qHjVC79G0wy8OhRJjMpfFgzHqg>