Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 25 May 2009 19:25:06 -0700
From:      Maksim Yevmenkin <emax@freebsd.org>
To:        Julian Elischer <julian@elischer.org>
Cc:        usb@freebsd.org, freebsd-virtualization@freebsd.org
Subject:   Re: Panic in netgraph with VIMAGE
Message-ID:  <bb4a86c70905251925h2f111b24uf99566f285f7b389@mail.gmail.com>
In-Reply-To: <4A1AE08E.5010007@elischer.org>
References:  <200905251506.27771.freebsd-virtualization@dino.sk> <200905251547.59432.zec@icir.org> <4A1AE08E.5010007@elischer.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, May 25, 2009 at 11:16 AM, Julian Elischer <julian@elischer.org> 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: <Micro Star International product 0xa97a, class 224/1, rev
>>> 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bb4a86c70905251925h2f111b24uf99566f285f7b389>