Date: Sun, 16 Feb 2014 19:20:46 +0900 From: =?ISO-2022-JP?B?SGlyb28gT25vICgbJEI+LkxuNDJAOBsoQik=?= <hiroo.ono+freebsd@gmail.com> To: Craig Rodrigues <rodrigc@freebsd.org> Cc: freebsd-current Current <freebsd-current@freebsd.org> Subject: Re: quick hack to support "option VIMAGE" on USB Ethernet Message-ID: <CANtk6SgsMhvN_buqxhkCEAdLFOrwTRdm52_Pw=oG9ak9nHE9SA@mail.gmail.com> In-Reply-To: <CAG=rPVd2atZXGAHbqNQXBg_wunoj_HP8dRcZZGjTtxCvJsEyaA@mail.gmail.com> References: <20130812.124834.1287983109881683567.shigeru@iij.ad.jp> <CAG=rPVcK-pfELCeUhK=EoShvZRsJaBzfW_4w_qM_=npi9zEoMg@mail.gmail.com> <20130813.125709.1168850046133874829.shigeru@iij.ad.jp> <CAG=rPVd2atZXGAHbqNQXBg_wunoj_HP8dRcZZGjTtxCvJsEyaA@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Hello, The problem of USB ethernet device with VIMAGE kernel still remains with 10.0-RELEASE and I think I have found the reason and a fix. I have filed a patch and backtrace as a followup to the PR http://www.freebsd.org/cgi/query-pr.cgi?pr=kern/183835 I will repeat the explanation here. The problem occur when ue_attach_post_task() (in sys/dev/usb/net/usb_ethernet.c) is called. ue_attach_post_task() calls if_alloc() (in sys/net/if.c) and ether_attach() (in sys/net/if_ethersubr.c), which finally refer V_if_index. The problem is that curvnet is NULL when ue_attach_post_task() is invoked, and with VIMAGE, V_if_index is defined to VNET(if_index) => VNET_VNET(curvnet, if_index) => (*VNET_VNET_PTR((curvnet), if_index)) => (*_VNET_PTR((curvnet)->vnet_data_base, if_index)) and so on. For device attach, the following code in device_probe_and_attach() (in kern/subr_bus.c) CURVNET_SET_QUIET(vnet0); error = device_attach(dev); CURVNET_RESTORE(); should assign curvnet to vnet0, but it is not the case for ue device. As an example of USB ethernet device, with if_axe, device_attach(dev) is axe_attach() (in sys/dev/usb/net/if_axe.c). axe_attach() calls uether_ifattach() (in sys/dev/usb/net/usb_ethernet.c) (other USB ethernet devices' *_attach() also call this function), which *queues* (not calls) ue_attach_post_task(). As ue_attach_post_task is called from usb_process (not from uther_ifattach), it is not assured that curvnet is properly assigned. 2013-08-14 4:08 GMT+09:00 Craig Rodrigues <rodrigc@freebsd.org>: > On Mon, Aug 12, 2013 at 8:57 PM, YAMAMOTO Shigeru <shigeru@iij.ad.jp> wrote: > >> >> My try is, >> 1) I try to enable "option VIMAGE" at r254236@HEAD. >> It causes panic at accessing V_if_index in ifindex_alloc_locked(). >> > > Can you provide the kernel backtrace for this panic? > It would be interesting to see where we need to initialize currvnet for USB > Ethernet. > I thought we already handled that case in subr_bus.c > > -- > Craig > _______________________________________________ > freebsd-current@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-current > To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANtk6SgsMhvN_buqxhkCEAdLFOrwTRdm52_Pw=oG9ak9nHE9SA>