Andriy Gapon <a...@freebsd.org> wrote:

> on 10/07/2012 21:57 Fabian Keil said the following:
> > I do not use a completely NFS-free kernel, but I don't build any 
> > NFS-related modules. Trying to load an unpatched dtraceall results in:
> > 
> > Jul  9 21:58:48 r500 sudo:       fk : TTY=pts/16 ; PWD=/home/fk ; USER=root
> > ; COMMAND=/sbin/kldload dtraceall Jul  9 21:58:48 r500 kernel: [8922] KLD
> > dtnfsclient.ko: depends on oldnfs - not available or version mismatch Jul
> > 9 21:58:48 r500 kernel: [8922] linker_load_file: Unsupported file type Jul
> > 9 21:58:48 r500 kernel: [8922] KLD dtraceall.ko: depends on dtnfsclient -
> > not available or version mismatch Jul  9 21:58:48 r500 kernel: [8922]
> > linker_load_file: Unsupported file type
> > 
> > My assumption was that your patch and the "#elif defined (NFSCLIENT)" would
> > fix that, and indeed it does, but I later on realized that I actually do
> > have NFSCL in the kernel:
> > 
> > fk@r500 /usr/src $sysctl kern.conftxt | grep NFS options NFS_ROOT options
> > NFSLOCKD options NFSD options NFSCL
> > 
> > My impression is that the patch is missing an opt_nfs.h inclusion combined
> > with the Makefile voodoo to create the file.
> > 
> > The dtraceall module already has an opt_compat.h, even though the Makefile
> > logic to create it seems a bit dubious to me. It blindly assumes that
> > COMPAT_FREEBSD32 is available on amd64.
> 
> Not sure if I got correctly what the (perceived) problem actually is, but I
> have this to say: the proper way of building a module is either via
> buildkernel (MODULES_OVERRIDE, etc) or by using KERNBUILDDIR for "independent"
> module build if the module has any dependency on kernel options in effect.
> This could be a little bit sad (for third-party module providers), but this
> seems to be true.
> 
> Sometimes Makefile-s fake kernel options for truly independent module build
> (no KERNBUILDDIR) to provide the widest and/or safest feature set.  But this
> has to be done very carefully to ensure that module<->kernel*s* compatibility
> actually occurs.

I'm using the following modification of Sean's patch:

diff --git a/sys/modules/dtrace/dtraceall/dtraceall.c 
b/sys/modules/dtrace/dtraceall/dtraceall.c
index c57f590..d50b1e5 100644
--- a/sys/modules/dtrace/dtraceall/dtraceall.c
+++ b/sys/modules/dtrace/dtraceall/dtraceall.c
@@ -67,8 +67,11 @@ MODULE_DEPEND(dtraceall, opensolaris, 1, 1, 1);
 MODULE_DEPEND(dtraceall, dtrace, 1, 1, 1);
 MODULE_DEPEND(dtraceall, dtio, 1, 1, 1);
 MODULE_DEPEND(dtraceall, dtmalloc, 1, 1, 1);
+#if defined (NFSCL)
 MODULE_DEPEND(dtraceall, dtnfscl, 1, 1, 1);
+#elif defined (NFSCLIENT)
 MODULE_DEPEND(dtraceall, dtnfsclient, 1, 1, 1);
+#endif
 #if defined(__amd64__) || defined(__i386__)
 MODULE_DEPEND(dtraceall, fbt, 1, 1, 1);
 MODULE_DEPEND(dtraceall, fasttrap, 1, 1, 1);

The perceived problem is that after compiling dtraceall with
"make buildkernel", installing it with "make installkernel"
and rebooting, loading it results in: 

fk@r500 ~ $kldstat
Id Refs Address            Size     Name
 1   73 0xffffffff80200000 e492c0   kernel
 2    1 0xffffffff8104a000 226928   zfs.ko
 3   14 0xffffffff81271000 82b8     opensolaris.ko
 4    1 0xffffffff8127a000 23a48    geom_eli.ko
 5    2 0xffffffff8129e000 34380    crypto.ko
 7    1 0xffffffff812fe000 8640     acpi_video.ko
 8    1 0xffffffff81307000 7d00     acpi_ibm.ko
 9    4 0xffffffff81412000 29e31    usb.ko
10    1 0xffffffff8143c000 32ec     usb_quirk.ko
11    1 0xffffffff81440000 bded     ehci.ko
12    1 0xffffffff8144c000 8d02     umass.ko
13    1 0xffffffff81455000 5c2a     nullfs.ko
14    1 0xffffffff8145b000 51ac     fdescfs.ko
15    1 0xffffffff81461000 beb4     i915.ko
16    1 0xffffffff8146d000 173cc    drm.ko
17    1 0xffffffff81485000 b25      dtraceall.ko
18    1 0xffffffff81486000 4e00     profile.ko
19    3 0xffffffff8148b000 4073     cyclic.ko
20   10 0xffffffff81490000 23b931   dtrace.ko
21    1 0xffffffff816cc000 125da    systrace_freebsd32.ko
22    1 0xffffffff816df000 13797    systrace.ko
23    1 0xffffffff816f3000 44be     sdt.ko
24    1 0xffffffff816f8000 484d     lockstat.ko
25    1 0xffffffff816fd000 bce5     fasttrap.ko
26    1 0xffffffff81709000 6553     fbt.ko
27    1 0xffffffff81710000 448b     dtmalloc.ko
28    1 0xffffffff81715000 43d9     dtio.ko

Note that dtnfscl.ko is not loaded even though loading
it manually works and I have NFSCL in the kernel.

Fabian

Attachment: signature.asc
Description: PGP signature

Reply via email to