Re: Panic in netgraph with VIMAGE

2009-05-25 Thread Maksim Yevmenkin
On Mon, May 25, 2009 at 11:16 AM, Julian Elischer  wrote:
> 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 and
>>> 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:634
>>> ng_make_node_common()
>>>  vnet=0 curvnet=0
>>> cpuid = 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 at
>> 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 they
> 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 vimage.h
> that sets the current image for that thread.  can you suggest places that
> 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
___
freebsd-virtualization@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
To unsubscribe, send any mail to 
"freebsd-virtualization-unsubscr...@freebsd.org"


Re: Panic in netgraph with VIMAGE

2009-05-25 Thread Julian Elischer

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 and
rebuild today. Whenever I try to turn bluetooth on (equivalent to plugging
in the dongle), panic occurs:

ubt0:  on usbus3
panic:
in /usr/src/sys/modules/netgraph/netgraph/../../../netgraph/ng_base.c:634
ng_make_node_common()
 vnet=0 curvnet=0
cpuid = 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 at 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 
they 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 vimage.h that sets the current image for that thread.  can 
you suggest places that this may occur?






Marko



Part from core.txt file:

#0  doadump () at pcpu.h:246
246<--->pcpu.h: No such file or directory.
<-->in pcpu.h
(kgdb) #0  doadump () at pcpu.h:246
#1  0xc0554e0e in boot (howto=260) at /usr/src/sys/kern/kern_shutdown.c:420
#2  0xc05550e2 in panic (fmt=Variable "fmt" is not available.
) at /usr/src/sys/kern/kern_shutdown.c:576
#3  0xc0b947c1 in ng_make_node_common (type=0xc0b8f9a0, nodepp=0xc416b3a8)
at
/usr/src/sys/modules/netgraph/netgraph/../../../netgraph/ng_base.c:634 #4 
0xc0b8bcc4 in ubt_attach (dev=0xc4294280)


at
/usr/src/sys/modules/netgraph/bluetooth/ubt/../../../../dev/usb/bluetooth/n
g_ubt.c:443 #5  0xc057dcbf in device_attach (dev=0xc4294280) at
device_if.h:178 #6  0xc057e88e in device_probe_and_attach (dev=0xc4294280)
at /usr/src/sys/kern/subr_bus.c:2473
#7  0xc0b38240 in usb2_probe_and_attach_sub (udev=0xc41fd800,
uaa=0xe4116c1c) at
/usr/src/sys/modules/usb/usb/../../../dev/usb/usb_device.c:1131 #8 
0xc0b3871a in usb2_probe_and_attach (udev=0xc41fd800, iface_index=255 'ÿ')
at /usr/src/sys/modules/usb/usb/../../../dev/usb/usb_device.c:1288 #9 
0xc0b40ff0 in uhub_explore (udev=0xc3f07000)

at /usr/src/sys/modules/usb/usb/../../../dev/usb/usb_hub.c:218
#10 0xc0b31f29 in usb2_bus_explore (pm=0xc3ed0dd4)

at
/usr/src/sys/modules/usb/usb/../../../dev/usb/controller/usb_controller.c:2
15 #11 0xc0b4343a in usb2_process (arg=0xc3ed0d74)
at /usr/src/sys/modules/usb/usb/../../../dev/usb/usb_process.c:139
#12 0xc0530008 in fork_exit (callout=0xc0b43360 ,.
arg=0xc3ed0d74, frame=0xe4116d38) at /usr/src/sys/kern/kern_fork.c:830
#13 0xc070b550 in fork_trampoline () at
/usr/src/sys/i386/i386/exception.s:270

At line 634 in ng_base.c, there is

INIT_VNET_NETGRAPH(curvnet);

I have options VIMAGE in my kernel config (actually this is first one
succesfully compiled with mentioned option, but I did not try it too often,
it just failed to compile before).

Now I recompiled kernel again, this time without options VIMAGE in config,
and panic does not occur.

So the original problem is INIT_VNET_NETGRAPH implementation in presence of
options VIMAGE in kernel config. If anyone has anything to test, please let
me know.

Regards,
Milan
___
freebsd-virtualization@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
To unsubscribe, send any mail to
"freebsd-virtualization-unsubscr...@freebsd.org"



___
freebsd-virtualization@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
To unsubscribe, send any mail to 
"freebsd-virtualization-unsubscr...@freebsd.org"


___
freebsd-virtualization@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
To unsubscribe, send any mail to 
"freebsd-virtualization-unsubscr...@freebsd.org"


Re: Panic in netgraph with VIMAGE

2009-05-25 Thread Marko Zec
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 and
> 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:634
> ng_make_node_common()
>  vnet=0 curvnet=0
> cpuid = 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 at random places 
in the USB code, i.e. without testing, which I'm reluctant to do.

Marko


> Part from core.txt file:
>
> #0  doadump () at pcpu.h:246
> 246<--->pcpu.h: No such file or directory.
> <-->in pcpu.h
> (kgdb) #0  doadump () at pcpu.h:246
> #1  0xc0554e0e in boot (howto=260) at /usr/src/sys/kern/kern_shutdown.c:420
> #2  0xc05550e2 in panic (fmt=Variable "fmt" is not available.
> ) at /usr/src/sys/kern/kern_shutdown.c:576
> #3  0xc0b947c1 in ng_make_node_common (type=0xc0b8f9a0, nodepp=0xc416b3a8)
> at
> /usr/src/sys/modules/netgraph/netgraph/../../../netgraph/ng_base.c:634 #4 
> 0xc0b8bcc4 in ubt_attach (dev=0xc4294280)
>
> at
> /usr/src/sys/modules/netgraph/bluetooth/ubt/../../../../dev/usb/bluetooth/n
>g_ubt.c:443 #5  0xc057dcbf in device_attach (dev=0xc4294280) at
> device_if.h:178 #6  0xc057e88e in device_probe_and_attach (dev=0xc4294280)
> at /usr/src/sys/kern/subr_bus.c:2473
> #7  0xc0b38240 in usb2_probe_and_attach_sub (udev=0xc41fd800,
> uaa=0xe4116c1c) at
> /usr/src/sys/modules/usb/usb/../../../dev/usb/usb_device.c:1131 #8 
> 0xc0b3871a in usb2_probe_and_attach (udev=0xc41fd800, iface_index=255 'ÿ')
> at /usr/src/sys/modules/usb/usb/../../../dev/usb/usb_device.c:1288 #9 
> 0xc0b40ff0 in uhub_explore (udev=0xc3f07000)
> at /usr/src/sys/modules/usb/usb/../../../dev/usb/usb_hub.c:218
> #10 0xc0b31f29 in usb2_bus_explore (pm=0xc3ed0dd4)
>
> at
> /usr/src/sys/modules/usb/usb/../../../dev/usb/controller/usb_controller.c:2
>15 #11 0xc0b4343a in usb2_process (arg=0xc3ed0d74)
> at /usr/src/sys/modules/usb/usb/../../../dev/usb/usb_process.c:139
> #12 0xc0530008 in fork_exit (callout=0xc0b43360 ,.
> arg=0xc3ed0d74, frame=0xe4116d38) at /usr/src/sys/kern/kern_fork.c:830
> #13 0xc070b550 in fork_trampoline () at
> /usr/src/sys/i386/i386/exception.s:270
>
> At line 634 in ng_base.c, there is
>
> INIT_VNET_NETGRAPH(curvnet);
>
> I have options VIMAGE in my kernel config (actually this is first one
> succesfully compiled with mentioned option, but I did not try it too often,
> it just failed to compile before).
>
> Now I recompiled kernel again, this time without options VIMAGE in config,
> and panic does not occur.
>
> So the original problem is INIT_VNET_NETGRAPH implementation in presence of
> options VIMAGE in kernel config. If anyone has anything to test, please let
> me know.
>
> Regards,
> Milan
> ___
> freebsd-virtualization@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
> To unsubscribe, send any mail to
> "freebsd-virtualization-unsubscr...@freebsd.org"


___
freebsd-virtualization@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
To unsubscribe, send any mail to 
"freebsd-virtualization-unsubscr...@freebsd.org"