Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 2 Mar 2008 15:58:50 +0100
From:      Luigi Rizzo <luigi@onelab2.iet.unipi.it>
To:        Paolo Pisati <piso@freebsd.org>
Cc:        freebsd-ipfw@freebsd.org, freebsd-net@freebsd.org
Subject:   Re: ipfw initialization: SI_ORDER_ANY -> SI_ORDER_MIDDLE?
Message-ID:  <20080302145850.GA33308@onelab2.iet.unipi.it>
In-Reply-To: <20080302144939.GA23353@tin.it>
References:  <20080302144939.GA23353@tin.it>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Mar 02, 2008 at 03:49:39PM +0100, Paolo Pisati wrote:
> Hi,
> 
> i just found out that depending on a KLD doesn't imply any
> initialization order, thus depending on a lock initialized in the ipfw
> init path is _really_ a bad idea from another KLD init path (see
> ip_fw_nat.c::ipfw_nat_init()).
> 
> A fix would be to move ipfw init priority from SI_ORDER_ANY to
> SI_ORDER_MIDDLE, but i guess there are side effects that i'm
> unaware in this modification...

The SI_ORDER_* definitions in /sys/sys/kernel.h are enumerated on a
large range, so if the existing code does not have races,
you can safely move the non-leaf modules
(such as ipfw,ko in your case) to (SI_ORDER_ANY - some_small_integer)
without breaking anything.

If this change breaks something, it means that there was already a
race condition and you are just pointing it out  - so it is a
worthwhile change...

	cheers
	luigi



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