DragonFly kernel List (threaded) for 2007-02
DragonFly BSD
DragonFly kernel List (threaded) for 2007-02
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

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


From: "Simon 'corecode' Schubert" <corecode@xxxxxxxxxxxx>
Date: Fri, 23 Feb 2007 01:37:44 +0100

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.


 However,
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
	code
#endif

with
	if (is_smp) {
		code
	}

and have some header doing

#ifndef _KERNEL_MODULE
const static int is_smp =
# ifdef SMP
	1;
# else
	0;
# endif
#else
extern const int is_smp;
#endif

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.

comments?

cheers
 simon

--
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   / \

Attachment: signature.asc
Description: OpenPGP digital signature



[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]