Subject: Re: LKM 'pf': environment compile options mismatch - LKM '', kernel 'DEBUG,DIAGNOSTIC'
To: None <reed@reedmedia.net>
From: Manuel Bouyer <bouyer@antioche.eu.org>
List: port-xen
Date: 07/19/2006 23:00:38
On Wed, Jul 19, 2006 at 02:59:37PM -0500, reed@reedmedia.net wrote:
> > Well, modules are always compiled without options in the distrib.
> > As Xen kernels are compiled with debug options, these are incompatible.
> > You'll have to rebuild a LKM with these options, but I don't know the
> > details.
>
> So I retrieved netbsd-3 via cvs. On my NetBSD/i386 3.99.21 build system, I
> did:
>
> cd /usr/src/netbsd-3/src/sys/lkm/net/pf
>
> modified the Makefile to create Makefile.reed with:
>
> -CPPFLAGS+= -I$S/dist/pf -I$S -DINET6 -DINET
> +CPPFLAGS+= -I$S/dist/pf -I$S -DINET6 -DINET -DDIAGNOSTIC -DDEBUG
>
> and the ran:
>
> make USETOOLS=NEVER -f Makefile.reed
>
> I copied the resulting pf.o to the NetBSD 3.0 (XENU) system and ran:
>
> # /sbin/modload pf.o
> Module loaded as ID 0
> # modstat
> Type Id Offset Loadaddr Size Info Rev Module Name
> DEV 0 -1/161 cb820000 0098 cb8413a0 2 pf
>
> Moments later it panicked. (Not at modload time.)
>
> Went to console and saw:
>
> kernel: protection fault trap, code=0
> Stopped at 0xcb8235bf: cli
> emul_freebsd_object(cb844610,c049cd90,1,0,64) at 0xcb8235bf
> softclock(0,c049cdd0,c0335a03,3b9aca00,0) at netbsd:softclock+0x2e3
> softintr_dispatch(0,fffffffe,800,3,1) at netbsd:softintr_dispatch+0xb3
> DDB lost frame for netbsd:Xsoftclock+0x2e, trying 0xc049cdbc
> Xsoftclock() at netbsd:Xsoftclock+0x2e
> --- interrupt ---
> ?(31,11,11,f,2468f) at 0
> ds 0x11
> es 0x11
> fs 0x31
> gs 0x11
> edi 0xcb844610
> esi 0x1
> ebp 0xc049cd54 emul_freebsd_object+0x7db40
> ?(31,11,11,f,2468f) at 0
> ds 0x11
> es 0x11
> fs 0x31
> gs 0x11
> edi 0xcb844610
> esi 0x1
> ebp 0xc049cd54 emul_freebsd_object+0x7db40
> ebx 0xffffc000
> edx 0x246
> ecx 0xffffffff
> eax 0x786c2578
> eip 0xcb8235bf
> cs 0x9
> eflags 0x10246
> esp 0xc049cd4c emul_freebsd_object+0x7db38
> ss 0x11
> 0xcb8235bf: cli
> Stopped at 0xcb8235bf: cli
> db>
> db> reboot
> syncing disks... done
> unmounting file systems...
> unmounting /kern (kernfs)...
> unmounting / (/dev/xbd0a)...kernel: page fault trap, code=0
> Stopped at netbsd:buf_lotsfree+0xa: testb $0x40,0x23(%eax)
> db>
> rebooting...
>
>
> So what is the correct way to build a pf.o?
>
> Does anyone use kernel modules with Xen?
I don't think so. In fact, I think there's too much differences between
i386 and xen kernel headers to be able to share LKMs between i386 and Xen.
The lkms need to be built with includes from arch/xen. But I don't know
what needs to be changed in the Makefile for that. Maybe you need to
change MACHINE and/or MACHINE_ARCH make variables
--
Manuel Bouyer <bouyer@antioche.eu.org>
NetBSD: 26 ans d'experience feront toujours la difference
--