Subject: Re: LKM versioning
To: Bill Studenmund <>
From: Andrew Brown <>
List: tech-kern
Date: 04/07/2003 13:50:16
>> I've been bitten by obsolete LKM causing kernel panic once too
>> often today, so I'm thinking how we could solve this once and for
>> all.
>> We now have LKM_VERSION, which is built into any LKM and
>> checked when LKM is loaded. When this number is different
>> to kernel LKM version, the LKM is refused and not glued into kernel.
>> However, this number is never changed, and manually changing it
>> inconvenient. It basically needs to be bumped any time kernel
>> version is bumped,.
>Not necessarily. _A_ version number needs bumping, but not necessarily
>this one. It could well be we need more than one.

so...a sort of per-subsystem version number?  fwiw, i've only built
the aperture driver about five times since installing 1.4something
(just before 1.5 was branched), so anything that makes me build it
more often is dreadful.  :)

>> Observing the lowest two digits of __NetBSD_Version__ are unused,
>> we could build LKM_VERSION like this:
>> #define LKM_VERSION	\
>> 	(__NetBSD_Version__ + (DIAGNOSTIC*1) + (DEBUG*2) + (MULTIPROCESSOR*4) \
>> 	 + (LOCKDEBUG*8))
>> This should help make LKMs a bit less fragile.
>> When the LKM would be refused, kernel would print some diagnostics
>> to help find out which options were used to build the kernel
>> and the LKM.
>> Opinions?
>I like what you're doing, but I think this won't scale. I think a better
>thing is to have an LKM version (to version the whole interface), the
>kernel version, and a string of "attributes," which would be things like
>DEBUG, etc. that indicate overall attributes that have to match.

USE_TOPDOWN_VM might be another one.  i'm not sure...

but the point is it's probably more than we can think of in five

>It also would help if we take Nathan & David's advice and just rip off an
>existing set of module interfaces, and to start writing our kernel with
>DDIs & such in mind.

as long as the code i have in one module:

	if (eb164_pci_intr[3].intr_nstrays >=
		eb164_pci_intr[3].intr_maxstrays) {
		printf("resetting interrupt...\n");

still works, i don't mind.  :)

|-----< "CODE WARRIOR" >-----|             * "ah!  i see you have the internet (Andrew Brown)                that goes *ping*!"       * "information is power -- share the wealth."