[ENBD] nbd with an SMP kernel?
Peter T. Breuer
ptb@it.uc3m.es
Fri, 13 Oct 2000 09:14:53 +0200 (MET DST)
"A month of sundays ago leonid@hmdc-admin.fas.harvard.edu wrote:"
>
> On Fri, 13 Oct 2000, Peter T. Breuer wrote:
> > ... CONFIG_BLK_DEV_NBD=m EXTRA_CFLAGS="$(EXTRA_CFLAGS) -D__KERNEL__ ...
> > ^^^^^^^^^^^^^^^^added
>
> Well, that was actually the first thing I tried when I discovered that the
> flag doesn't get passed to the lower-level module; it doesn't work though
It works just perfectly fine. All that happens is that -D__SMP__ is
delivered to the nbd.o compile line.
> (it won't compile because of some undeclared vars/functions), so I had to
There are no undeclared versions or funcions! Again, think, where
would these come from! They aren't in my code, or my code wouldn't
compile normally. So they must be injected by new macros in the kernel,
which is GOOD, because that's what you want. But if the kernel injects
them, then the symbols ARE used in the kernel, and so they are
declared in the kernel (because the kernel compiles).
> add -D__BOOT_KERNEL_SMP to the EXTRA_CFLAGS. I mentioned this in my 1st
This flag does not appear in my kernel source:
barney:/usr/oboe/ptb/lang/c/nbd/nbd-2.4.15% find
/usr/src/linux-2.2.15 -type f -name "*.[ch]" | xargs grep BOOT_KERNEL_SMP
barney:/usr/oboe/ptb/lang/c/nbd/nbd-2.4.15%
(I repeated with just "-type f" to be sure, and just checked 2.4.0test1
too)
> note; then it compiles but still doesn't work.
You are barking up several gum trees. Your sources are adulterated AND
you are not tracing their usage correctly.
> I just had a bright idea though: the kernel I'm using hasn't been
> compiled from the source I'm using. As I mentioned, both come from RedHat
Well, that would slightly kill your efforts.
Just to prove that you shouldn't have any trouble:
gcc -O2 -Wall -D_LARGEFILE64_SOURCE -D__SMP__ -D__KERNEL__ -DMODULE
-DDEBUG=0 -I/var/home/oboe/ptb/lang/c/nbd/nbd-2.4.15/linux/include
-DUNIX98_NR_MAJORS=UNIX98_PTY_MAJOR_COUNT -c -o nbd.o
/var/home/oboe/ptb/lang/c/nbd/nbd-2.4.15/linux/drivers/block/nbd.c
In file included from /usr/include/linux/sched.h:21,
from /usr/include/asm/uaccess.h:8,
from
/var/home/oboe/ptb/lang/c/nbd/nbd-2.4.15/linux/drivers/block/nbd.c:144:
/usr/include/linux/tty.h:46: warning: `UNIX98_NR_MAJORS' redefined
*Initialization*:1: warning: this is the location of the previous
definition
/usr/include/asm/smp.h: In function `hard_smp_processor_id':
In file included from /usr/include/linux/smp.h:11,
from /usr/include/linux/sched.h:20,
from /usr/include/asm/uaccess.h:8,
from
/var/home/oboe/ptb/lang/c/nbd/nbd-2.4.15/linux/drivers/block/nbd.c:144:
/usr/include/asm/smp.h:209: warning: implicit declaration of function
`GET_APIC_ID'
/usr/include/asm/smp.h:209: `APIC_BASE' undeclared (first use in this
function)
/usr/include/asm/smp.h:209: (Each undeclared identifier is reported
only once
/usr/include/asm/smp.h:209: for each function it appears in.)
/usr/include/asm/smp.h:209: `APIC_ID' undeclared (first use in this
function)
make[1]: *** [nbd.o] Error 1
make[1]: Leaving directory `/var/tmp'
make: *** [module] Error 2
Ooops. OK, OK, so add -DCONFIG_X86_LOCAL_APIC to the compile line.
It looks like your kernel .config is missing it. There:
gcc -O2 -Wall -D_LARGEFILE64_SOURCE -D__SMP__
-DCONFIG_X86_LOCAL_APIC -D__KERNEL__ -DMODULE -DDEBUG=0
-I/var/home/oboe/ptb/lang/c/nbd/nbd-2.4.15/linux/include
-DUNIX98_NR_MAJORS=UNIX98_PTY_MAJOR_COUNT -c -o nbd.o
/var/home/oboe/ptb/lang/c/nbd/nbd-2.4.15/linux/drivers/block/nbd.c
In file included from /usr/include/linux/sched.h:21,
from /usr/include/asm/uaccess.h:8,
from
/var/home/oboe/ptb/lang/c/nbd/nbd-2.4.15/linux/drivers/block/nbd.c:144:
/usr/include/linux/tty.h:46: warning: `UNIX98_NR_MAJORS' redefined
*Initialization*:1: warning: this is the location of the previous
definition
make[1]: Leaving directory `/var/tmp'
barney:/usr/oboe/ptb/lang/c/nbd/nbd-2.4.15% strings - /tmp/nbd.o | grep
kernel_version
kernel_version=2.2.15
__module_kernel_version
barney:/usr/oboe/ptb/lang/c/nbd/nbd-2.4.15%
(as you would expect, since I didn't modify the EXTRAVERSION line).
I don't know what problem you are having, but it only took a minute or
two to notice and fix the above, and I don't think your configuration
shoudl cause you any more problems. Note that you have evidently
to configure the kernel for SMP first (which I didn't do) in order to
avoid such hiccups. The .config file is read in by the kernel
makefiles.
Peter