From owner-freebsd-usb@FreeBSD.ORG Tue May 26 02:46:21 2009 Return-Path: Delivered-To: usb@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 24F2D106564A; Tue, 26 May 2009 02:46:21 +0000 (UTC) (envelope-from maksim.yevmenkin@gmail.com) Received: from mail-px0-f106.google.com (mail-px0-f106.google.com [209.85.216.106]) by mx1.freebsd.org (Postfix) with ESMTP id E50A18FC16; Tue, 26 May 2009 02:46:20 +0000 (UTC) (envelope-from maksim.yevmenkin@gmail.com) Received: by pxi4 with SMTP id 4so3053981pxi.3 for ; Mon, 25 May 2009 19:46:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to:cc :content-type:content-transfer-encoding; bh=eTY8GcJf63upJDzZ7datySuDhSFGnICO5o7opNPrJr8=; b=dtM0BKaFMzfX20sITsSlqygEcGHsi0p/NbBSzwmE+LFElP9PMrN8H6BF44gGkBVJis KSr9fI65Ug/X+Or5oTfRBAXFGv8Ar9J8KWUN8xT33YId+9gqs6+8VySfbVRT9Q4X1GEk M7UaK8IcWnge9yvm3z1wR1hhAzY9ZdJO28vMg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=GOdwlwprBCorqbGr7vaa95jpbj87WMPsre1G9qM8wtm0yj2XBdywURWXmQz8WWdc1G ju9mp1pmgGqWvzyFyrlP0Fl+UAzKat8iMlUv1VyNBCIdGrXSgb4i5s0AoKd0J1wGrFwO FDrR6wKjVhCQU60BYMhFfJhaJJaDmckVj3+f8= MIME-Version: 1.0 Sender: maksim.yevmenkin@gmail.com Received: by 10.115.32.8 with SMTP id k8mr15504653waj.15.1243304706880; Mon, 25 May 2009 19:25:06 -0700 (PDT) In-Reply-To: <4A1AE08E.5010007@elischer.org> References: <200905251506.27771.freebsd-virtualization@dino.sk> <200905251547.59432.zec@icir.org> <4A1AE08E.5010007@elischer.org> Date: Mon, 25 May 2009 19:25:06 -0700 X-Google-Sender-Auth: 4244dd580da0df06 Message-ID: From: Maksim Yevmenkin To: Julian Elischer Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: usb@freebsd.org, Marko Zec , freebsd-virtualization@freebsd.org Subject: Re: Panic in netgraph with VIMAGE X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 May 2009 02:46:21 -0000 On Mon, May 25, 2009 at 11:16 AM, Julian Elischer wro= te: > Marko Zec wrote: >> >> On Monday 25 May 2009 15:06:27 Milan Obuch wrote: >>> >>> Hi, >>> there is some bug in (most probably) netgraph code. I did fresh csup an= d >>> rebuild today. Whenever I try to turn bluetooth on (equivalent to >>> plugging >>> in the dongle), panic occurs: >>> >>> ubt0: >> 2.00/31.64, addr 2> on usbus3 >>> panic: >>> in /usr/src/sys/modules/netgraph/netgraph/../../../netgraph/ng_base.c:6= 34 >>> ng_make_node_common() >>> =A0vnet=3D0 curvnet=3D0 >>> cpuid =3D 0 >>> >>> This does not occur with kernel from sources three days old. >> >> This is a known problem related to curvnet context not being set by the >> USB device attach code - I have to lurk / shop around for some cheap USB >> ethernet or bt devices to be able to reproduce & fix this locally, the >> alternative would be wild guessing and planting context setting macros a= t >> random places in the USB code, i.e. without testing, which I'm reluctant= to >> do. >> > > it probably requires someone who knows the bluetooth and usb-ethernet > code to decide how this is done. > > It seems to me that the bluetooth stuff should probably just always set > itself to the base (default) vimage, as it has many kinds of devices that > are not really 'interfaces' so to speak and probably deserve to be in the > base virtual machine. > It does have SOME interface type devices in theory but I don't know if th= ey > are supported. > > Maksim, in vimage, before yo call teh netgraph code, the mbuf should have= an > interface pointer and that in turn should have a pointer to the vimage.. > Alternatively, the thread coming into netgraph should run code from vimag= e.h > that sets the current image for that thread. =A0can you suggest places th= at > this may occur? hmm... i do not really know anything about vimage (yet :), but the call to INIT_VNET_NETGRAPH() in ng_make_node_common() seems (to me) out of place. from what i understand, ng_make_node_common() called on all sorts of nodes. some of those are not even network related. it seems to me that network related netgraph nodes (ng_(e)iface, ng_(k)socket, etc.) obviously should set vimage etc. pointer, however for the rest of the nodes some reasonable defaults should be used. as far as setting interface pointer in mbuf its going to be tricky. bluetooth devices do not associated with any network interface, so i'm not sure how to do it. i will need to study the code for a little bit before i can make any intelligent suggestions. thanks, max