From owner-freebsd-hackers@FreeBSD.ORG Mon Oct 22 17:41:20 2012 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6D80487A; Mon, 22 Oct 2012 17:41:20 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-oa0-f54.google.com (mail-oa0-f54.google.com [209.85.219.54]) by mx1.freebsd.org (Postfix) with ESMTP id 086698FC0C; Mon, 22 Oct 2012 17:41:19 +0000 (UTC) Received: by mail-oa0-f54.google.com with SMTP id n9so3626754oag.13 for ; Mon, 22 Oct 2012 10:41:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=cfIItJ/N69fEvzDLxn4N+v9HjU/1GScc0Ez1YHu22kk=; b=iSaLGO3jM34KUQZlYezf5nIzNybEWoo497/Ybk3/nDdL+fnFBiBQcj8AZ6l5xr593f 3/dt1xQwV5SFM6yk83Nn/8dLWBtPDST/Bse4Wm6mN5wp21hrF+nZP5YAEmVYcKvunpPw PlQI6aEj47eLtKUv6uWTA5kWwLRm3c6SLcUlLI4/OwNbKld3bRAmjjngOxj47SyjU7SO ngJ0KYYRKA7UTrf0lzLXcXFCxBl7RCW3Rq4uoNqNbDSAXY2V18Cv2ax0s/K1GhgNQfXR +Q74GNCOUlMPUNYjMqLcIVaFWQlwU6uRyLR02agaC1QcTvdYsOQk4FS3ziKjsYGnHtgi yD1Q== MIME-Version: 1.0 Received: by 10.60.170.200 with SMTP id ao8mr8680174oec.104.1350927679450; Mon, 22 Oct 2012 10:41:19 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.76.75.69 with HTTP; Mon, 22 Oct 2012 10:41:19 -0700 (PDT) In-Reply-To: <5085827D.5090108@freebsd.org> References: <201210212322.48791.zec@fer.hr> <201210221208.37592.zec@fer.hr> <5085827D.5090108@freebsd.org> Date: Mon, 22 Oct 2012 10:41:19 -0700 X-Google-Sender-Auth: -l9gehXv5QIFVzihQPoVc-FjOMI Message-ID: Subject: Re: VIMAGE crashes on 9.x with hotplug net80211 devices From: Adrian Chadd To: Julian Elischer Content-Type: text/plain; charset=ISO-8859-1 Cc: freebsd-net@freebsd.org, Marko Zec , freebsd-hackers@freebsd.org X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Oct 2012 17:41:20 -0000 On 22 October 2012 10:29, Julian Elischer 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