From owner-svn-src-head@FreeBSD.ORG Fri Jul 12 18:39:37 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 856455B4; Fri, 12 Jul 2013 18:39:37 +0000 (UTC) (envelope-from crodr001@gmail.com) Received: from mail-la0-x230.google.com (mail-la0-x230.google.com [IPv6:2a00:1450:4010:c03::230]) by mx1.freebsd.org (Postfix) with ESMTP id 59957181B; Fri, 12 Jul 2013 18:39:36 +0000 (UTC) Received: by mail-la0-f48.google.com with SMTP id lx15so8006414lab.35 for ; Fri, 12 Jul 2013 11:39:35 -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=RSDoJCG4kNetOijkLE/tKQEfB2S0ZwaQahBWew0QeWg=; b=h0V1GG97OW8F/y5H0x0mS2HP4z+E7DfS0hJ8kZihlL/yUbh+fHKmlPsRgcSioGK5rF RkrqPPS/C7gsxdCqdeUC2Gy74w2dCybRL1gN+IKPq486lNos9E7JvIoaLgQ2nmPJ3Wm3 yyiRzM/RduxNxn0EV3sbZiT8xMBkBzxTO+qRhW/53sparX1AAPwNq5bppP+ekY8eVdKZ Sk/b/ptuBnB2FrQZTt7LOiN5ebCtlQqDIP2Xt0p3Szz5r6o781zryYZZuWcCuUAkL4OH h8813kNabrGEC3KgRXvxvudHYjHKZ1p4DOYaBE0COOOtSRXVTVLMbQhBTN0Bbiqe4It9 kKwQ== MIME-Version: 1.0 X-Received: by 10.112.29.17 with SMTP id f17mr19989193lbh.20.1373654375017; Fri, 12 Jul 2013 11:39:35 -0700 (PDT) Sender: crodr001@gmail.com Received: by 10.112.149.38 with HTTP; Fri, 12 Jul 2013 11:39:34 -0700 (PDT) In-Reply-To: References: <201307120803.r6C83ACp016523@svn.freebsd.org> Date: Fri, 12 Jul 2013 11:39:34 -0700 X-Google-Sender-Auth: XPN-FqzKBTyLYIvReG9hSo6sHlU Message-ID: Subject: Re: svn commit: r253255 - head/sys/netgraph/bluetooth/drivers/ubt From: Craig Rodrigues To: Adrian Chadd Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jul 2013 18:39:37 -0000 I like your patch. It may be worth having one more Netgraph person review it and give a sanity check, but I think we should commit your patch ASAP. I am new to VNET, but I am wondering if in your patch we can KASSERT if node->vnet is NULL. That would make things easier to debug. The part of my patch which which does CURVNET_SET is still necessary upon attach in Bluetooth. However, with your patch, we can get rid of the part of my patch which does CURVNET_SET upon Bluetooth detach. -- Craig On Fri, Jul 12, 2013 at 11:24 AM, Adrian Chadd wrote: > Hm, I just found a patch in my local collection which works for all > netgraph nodes. > > Maybe we should do that instead of this? > > http://people.freebsd.org/~adrian/ath/20130712-netgraph-vimage.diff > > That should solve it for all dynamic netgraph stuff, rather than just > bluetooth. > > > > -adrian > > On 12 July 2013 01:03, Craig Rodrigues wrote: > > Author: rodrigc > > Date: Fri Jul 12 08:03:10 2013 > > New Revision: 253255 > > URL: http://svnweb.freebsd.org/changeset/base/253255 > > > > Log: > > PR: kern/168520 > > Submitted by: "YAMAMOTO, Shigeru" > > Reviewed by: adrian > > > > In PC-BSD 9.1, VIMAGE is enabled in the kernel config. > > For laptops with Bluetooth capability, such as the HP Elitebook 8460p, > > the kernel will panic upon bootup, because curthread->td_vnet > > is not initialized. > > > > Properly initialize curthread->td_vnet when initializing the Bluetooth > stack. > > > > This allows laptops such as the HP Elitebook 8460p laptop > > to properly boot with VIMAGE kernels. > > > > Modified: > > head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c > > > > Modified: head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c > > > ============================================================================== > > --- head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c Fri Jul 12 > 07:43:56 2013 (r253254) > > +++ head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c Fri Jul 12 > 08:03:10 2013 (r253255) > > @@ -109,7 +109,9 @@ > > #include > > #include > > #include > > +#include > > #include > > +#include > > > > #include "usbdevs.h" > > #include > > @@ -123,6 +125,7 @@ > > #include > > #include > > > > +#include > > #include > > #include > > #include > > @@ -487,13 +490,14 @@ ubt_attach(device_t dev) > > > > sc->sc_dev = dev; > > sc->sc_debug = NG_UBT_WARN_LEVEL; > > - > > + CURVNET_SET(TD_TO_VNET(curthread)); > > /* > > * Create Netgraph node > > */ > > > > if (ng_make_node_common(&typestruct, &sc->sc_node) != 0) { > > UBT_ALERT(sc, "could not create Netgraph node\n"); > > + CURVNET_RESTORE(); > > return (ENXIO); > > } > > > > @@ -501,10 +505,12 @@ ubt_attach(device_t dev) > > if (ng_name_node(sc->sc_node, device_get_nameunit(dev)) != 0) { > > UBT_ALERT(sc, "could not name Netgraph node\n"); > > NG_NODE_UNREF(sc->sc_node); > > + CURVNET_RESTORE(); > > return (ENXIO); > > } > > NG_NODE_SET_PRIVATE(sc->sc_node, sc); > > NG_NODE_FORCE_WRITER(sc->sc_node); > > + CURVNET_RESTORE(); > > > > /* > > * Initialize device softc structure > > @@ -631,8 +637,10 @@ ubt_detach(device_t dev) > > /* Destroy Netgraph node */ > > if (node != NULL) { > > sc->sc_node = NULL; > > + CURVNET_SET(node->nd_vnet); > > NG_NODE_REALLY_DIE(node); > > ng_rmnode_self(node); > > + CURVNET_RESTORE(); > > } > > > > /* Make sure ubt_task in gone */ >