From owner-freebsd-net@FreeBSD.ORG Mon Oct 22 14:12:58 2012 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 57FC2E7C; Mon, 22 Oct 2012 14:12:58 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-ob0-f182.google.com (mail-ob0-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id 063558FC14; Mon, 22 Oct 2012 14:12:57 +0000 (UTC) Received: by mail-ob0-f182.google.com with SMTP id wc20so3290930obb.13 for ; Mon, 22 Oct 2012 07:12:57 -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=67VTMkU+JlSCEgDpiB3cOxrzm5fnUFdT+yPtDiIMd9U=; b=ORw5bAAjR9UDGrpbE2k+zuzSz33FBWtUb3vJUUIDSpRIMBZCeo2VupiFYpMxybDlO8 SlhJfZdJsQSL8hcqjIrEI+SJClt7xvPJ6/2Ul/Mta/k3GpMG/bJ8IdlItOg5Nl9Je0AC 9XJgivnUvlxA5ToP/TUfUe9PHbvCPklMOVthAyI9t6mqCvE/rn9W9U6ETkNOd/xydYmz D6eg+SlQL7VKRIPEdcs/e5LDBJCF2NmYkI8+PSqhMDkedukDFqd5Xg68Z4nVA/5JPfZX rBY55JF0bwZp3VyfDK2EQiLols++EnqxIeZLeJDOfUgYt3yDVago1BfXaZnBOvsr797r BxlQ== MIME-Version: 1.0 Received: by 10.182.154.70 with SMTP id vm6mr7292629obb.50.1350915177132; Mon, 22 Oct 2012 07:12:57 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.76.75.69 with HTTP; Mon, 22 Oct 2012 07:12:57 -0700 (PDT) In-Reply-To: <201210221208.37592.zec@fer.hr> References: <201210212322.48791.zec@fer.hr> <201210221208.37592.zec@fer.hr> Date: Mon, 22 Oct 2012 07:12:57 -0700 X-Google-Sender-Auth: ixxynEG1VCVa90_2bXmj7Yd0OpA Message-ID: Subject: Re: VIMAGE crashes on 9.x with hotplug net80211 devices From: Adrian Chadd To: Marko Zec Content-Type: text/plain; charset=ISO-8859-1 Cc: freebsd-net@freebsd.org, freebsd-hackers@freebsd.org X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Oct 2012 14:12:58 -0000 On 22 October 2012 03:08, Marko Zec wrote: > The only option I can think of now is to update all of the hotunpluggable > device_detach() handlers to do CURVNET_SET(ifp->if_vnet) before calling > further down into the networking stack, because as you already observed, > whatever triggers a device_detach() handler is not aware of the nature of > the driver. Right. Well, since most things are in theory hotpluggable these days (or soon will be, with pcie hotplug), I think we need a slightly more generic solution. >> (how the hell does this work for devices attached at probe time? What >> vnet context do they have, and why doesn't the kernel panic there?) > > Because at boot / autoconfiguration time curvnet is implicitly set to vnet0 > between SI_SUB_VNET and SI_SUB_VNET_DONE (i.e. before going SMP). > > Similarly, curvnet is set to vnet0 during kldload events. .. like this. The trouble is going to be handling unplug and kldunload events too. Does curvnet -> vnet0 during kldunload events? Thanks, Adrian