Re: Why does this break under SMP?

H. Peter Anvin (hpa@transmeta.com)
9 Sep 1997 20:00:41 GMT


Followup to: <3415610C.F00B98D1@star.net>
By author: Bill Hawes <whawes@star.net>
In newsgroup: linux.dev.kernel
>
> Olaf Titz wrote:
> >
> > > this happened just enough times to do something about it. How hard is it
> > > to add an SMP/Uniprocessor flag to modules? [or is it already done ;)]
> >
> > What's needed is an SMP "flag" in <linux/version.h> in a form that can
> > be picked up at compile time. Perhaps like
> > #ifndef __SMP__
> > #error "SMP kernel needs compilation with __SMP__"
> > #endif
> > on SMP machines?
>
> The kernel and modules may have been compiled at different times.
>
> How about defining an external symbol in the kernel, kernel_is_SMP or
> kernel_is_UNI. Then have SMP modules refer to kernel_is_SMP, so you
> would get an undefined reference if you attempted to load a
> non-matching module.
>

That's part of it. Another part is that flags like this *NEED* to
make it into a header file (similar to module version numbers), so
that users don't have to specify a gazillion flags when compiling an
out-of-kernel-tree module. The current situation is really
unacceptable. -DMODVERSIONS is another such item; basically anything
that ends up getting specified with -D...

I did make a patch for this and sent to Linus, but he didn't like the
way I had hacked the Makefiles. I don't have time to redo it at this
point; maybe someone else wants to take a stab at it.

-hpa

-- 
    PGP: 2047/2A960705 BA 03 D3 2C 14 A8 A8 BD  1E DF FE 69 EE 35 BD 74
    See http://www.zytor.com/~hpa/ for web page and full PGP public key
Always looking for a few good BOsFH.  **  Linux - the OS of global cooperation
        I am Baha'i -- ask me about it or see http://www.bahai.org/