dynamic smp aware modules (was: Re: Multiple kernel building/installing)

Simon 'corecode' Schubert corecode at fs.ei.tum.de
Thu Feb 22 16:48:39 PST 2007

YONETANI Tomokazu wrote:
On Thu, Feb 22, 2007 at 11:49:32PM +0100, Gergo Szakal wrote:
(did not want to pollute the commits list)
Does the last commit by corecode make it possivle to build/install an SMP and a non-SMP kernel together?
You've been able to *build* multiple kernels:
  make KERNCONF='GENERIC LINT' buildkernel
but you couldn't install the kernels with different names.
Yes, that didn't change either.  I just changed the infrastructure so that nrelease could build multiple kernels as well.

even if you install an SMP and non-SMP kernels with different names,
not all kernel modules can be shared -- at least any kernel modules
using spinlocks, such as nfs.ko and acpi.ko
I think we should change this.  And actually it is quite easy.  Replace

#ifdef SMP
	if (is_smp) {
and have some header doing

const static int is_smp =
# ifdef SMP
# else
# endif
extern const int is_smp;
and initialize is_smp appropriately in some kernel source.

The kernel will be compiled optimized, because the compiler knows that is_smp is a const value and thus can remove dead code.  Modules will take the penalty of checking this variable, but that's hardly an impact, because it will be in the cache anyways.  Just make sure that the variable is in its own cache line, which never changes.


Serve - BSD     +++  RENT this banner advert  +++    ASCII Ribbon   /"\
Work - Mac      +++  space for low €€€ NOW!1  +++      Campaign     \ /
Party Enjoy Relax   |   http://dragonflybsd.org      Against  HTML   \
Dude 2c 2 the max   !   http://golden-apple.biz       Mail + News   / \
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pgp00017.pgp
Type: application/octet-stream
Size: 252 bytes
Desc: "Description: OpenPGP digital signature"
URL: <http://lists.dragonflybsd.org/pipermail/kernel/attachments/20070222/de7991f3/attachment-0019.obj>

More information about the Kernel mailing list