Re: netgraph(3) initialization order

From: Scott Long <scottl_at_freebsd.org>
Date: Tue, 04 Jan 2005 15:39:32 -0700
Maksim Yevmenkin wrote:
> Dear Hackers,
> 
> would anyone object if i change SI_ORDER_MIDDLE in the 
> /sys/netgraph/ng_base.c:2994 to say SI_ORDER_THIRD, i.e.
> 
> change
> 
> DECLARE_MODULE(netgraph, netgraph_mod, SI_SUB_DRIVERS, SI_ORDER_MIDDLE);
> 
> to
> 
> DECLARE_MODULE(netgraph, netgraph_mod, SI_SUB_DRIVERS, SI_ORDER_THIRD);
> 
> the reason for this change is that bluetooth device drivers depend on 
> netgraph(4) and when both netgraph(4) and bluetooth device driver (such 
> as ng_ubt(4)) compiled in the kernel you get a crash. basically 
> ng_ubt(4) mod_load callback is called before netgraph(4) mod_load 
> callback and ng_findtype() crashes on uninitialized mutex (DEVICE_MODULE 
> macro passes SI_SUB_DRIVERS, SI_ORDER_THIRD to the DECLARE_MODULE).
> 
> 
> option #2 would be to have DEVICE_MODULE_ORDERED macro which accepts two 
> extra parameters.
> 
> 
> and finally option #3 would be to duplicate entire content of the 
> DEVICE_MODULE macro in all bluetooth device drivers and specify order in 
> DECLARE_MODULE macro.
> 
> 
> any thoughts?
> 
> thanks,
> max

It might make more sense to stop classifying netgraph as a driver in
SI_SUB_DRIVERS and instead put it into a SYSINIT that happens prior to
SI_SUB_DRIVERS.

Scott
Received on Tue Jan 04 2005 - 21:41:07 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:25 UTC