Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 7 Nov 2011 14:31:30 -0500
From:      Arnaud Lacombe <lacombar@gmail.com>
To:        Andriy Gapon <avg@freebsd.org>
Cc:        Penta Upa <bsdboot@gmail.com>, freebsd-current@freebsd.org, Benjamin Kaduk <kaduk@mit.edu>, "K. Macy" <kmacy@freebsd.org>
Subject:   Re: panic at vm_page_wire with FreeBSD 9.0 Beta 3
Message-ID:  <CACqU3MUcFEx=d23bukQu8mHjAqTXaqSYq%2BNisYz9aMuQSq9EVA@mail.gmail.com>
In-Reply-To: <4EB11C32.80106@FreeBSD.org>
References:  <CAMsyT5QgHLqgSrt7qU_4FOVocW_GwmVWgZQ1A_CNrzkHQRTm4w@mail.gmail.com> <CAHM0Q_OWrQS_gnwupdJDwRFV9M3dKRN-SzkHgz6gJEedkvTPKQ@mail.gmail.com> <CAMsyT5Q5kMHRJQqFUdCCqqvKvFS_i5bvR8sHW6vNti_boD0nfA@mail.gmail.com> <alpine.GSO.1.10.1111020203230.882@multics.mit.edu> <4EB11C32.80106@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Hi,

On Wed, Nov 2, 2011 at 6:32 AM, Andriy Gapon <avg@freebsd.org> wrote:
>
> [restored cc: to the original poster]
>
> on 02/11/2011 08:10 Benjamin Kaduk said the following:
>> I am perhaps confused. =A0Last I checked, bsd.kmod.mk caused '-include
>> opt_global.h' to be passed on the command line. =A0Is the issue just tha=
t the
>> opt_global.h used for the kmod could be different from the actual kernel=
's
>> opt_global.h, because KERNCONF was not specified and the header is gener=
ated at
>> module-build time? =A0In this case, clearly the onus is on the user to p=
ass
>> KERNCONF at module build time.
>
> To be precise, this is what is actually passed to a compiler:
> sys/conf/kmod.mk:
> .if defined(KERNBUILDDIR)
> CFLAGS+=3D =A0 =A0 -DHAVE_KERNEL_OPTION_HEADERS -include ${KERNBUILDDIR}/=
opt_global.h
> .endif
>
> where KERNBUILDDIR can be passed via environment from a kernel build:
> sys/conf/kern.post.mk:
> MKMODULESENV+=3D =A0KERNBUILDDIR=3D"${.CURDIR}" SYSDIR=3D"${SYSDIR}"
>
> KERNCONF does not have any meaning in a module build.
>
> To make sure that a module build sees exactly the same kernel options as =
a
> kernel with which the module should work, one has to either build the mod=
ule
> together with the kernel (within the kernel build; search for MODULES in
> make.conf(5)) or to manually specify KERNBUILDDIR to point to a correct k=
ernel
> build directory. =A0(Which to a certain degree implies impossibility to b=
uild a
> "perfect" module for a pre-built binary kernel or to provide a "perfect"
> universal pre-built module for any custom kernel)
>
> Of course, the real problem is that modules should not care about any (or=
 at
> least some) kernel options, they should be isolated from the options via =
a
> proper KPI/KBI (perhaps DDI or "module-to-kernel interface" or whatever).=
 =A0A
> module should be able to work correctly with kernels built with different=
 options.
>
You cannot be make a point in shade of gray, it either "must care" or
"must not care" about kernel option, not "care about some, but not
other". Moreover, you cannot advocate stable internal KBI/KPI when you
are not even able to provide a stable userland ABI...

> P.P.S. [and tangential] I see that many module makefiles fake up various =
kernel
> options in a fashion similar to the following:
> .if !defined(KERNBUILDDIR)
> opt_compat.h:
> =A0 =A0 =A0 =A0echo "#define COMPAT_FREEBSD6 1" > ${.TARGET}
>
> opt_kbd.h:
> =A0 =A0 =A0 =A0echo "#define KBD_INSTALL_CDEV 1" > ${.TARGET}
> .endif
>
> And handful of modules fake up opt_global.h, e.g.:
> opt_global.h:
> =A0 =A0 =A0 =A0echo "#define ALTQ 1" =A0 =A0 > ${.TARGET}
<personal opinion>This mess is utterly broken.</personal opinion>

FWIW, I advocate to make KERNBUILDDIR (ie. kernel option's
configuration) mandatory for building any modules.

 - Arnaud

> --
> Andriy Gapon
> _______________________________________________
> 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?CACqU3MUcFEx=d23bukQu8mHjAqTXaqSYq%2BNisYz9aMuQSq9EVA>