SMP Extraversion

Kurt Garloff (garloff@suse.de)
Sat, 16 Oct 1999 12:51:11 +0200


--tsOsTdHNUZQcU9Ye
Content-Type: multipart/mixed; boundary="3MwIy2ne0vdjdPXF"

--3MwIy2ne0vdjdPXF
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

Hi Linus, Alan,

attached is a patch which does append the string "-SMP" to the kernel
version, if the kernel is compiled with CONFIG_SMP.

Rationale:
When changing the settings for the kernel, most modules won't break (though
I'd recommend to recompile them anyway, cause that's the way they are
designed).
The SMP setting is special: a __SMP__ preprocessor symbol is defined and
lots of critical data structures are different. Most modules will break.

For slight changes, the MODVERSION mechanism is best suited.

However, for UP vs. SMP, I prefer a more coarse approach: Append -SMP to the
kernel release.

This will have two consequences:
* The SMP modules will be stored in a different directory and won't
overwrite the UP ones. This is especially convenient for SMP kernel
hackers, that eg. use a UP kernel with DEBUG_SPINLOCK for debugging.
* insmod will refuse to load non-SMP modules into an SMP kernel and vice
versa. (And while MODVERSIONS is supposed to catch most of these as well,
you'll get killed, if you disabled it or have some modules without
MODVERSIONS.)

I'll suggest the patch to go into the official kernel.

Patch is attached.
It contains a few lines to check whether the SMP setting has been changed
and rebuilds include/linux/version.h, if necessary.
It has been tested on a few machines here and did not cause any trouble.

Regards,
--=20
Kurt Garloff <garloff@suse.de> Wuppertal, FRG
PGP2 key: See mail header, key servers Linux kernel development
SuSE GmbH, N=FCrnberg, FRG SCSI drivers: tmscsim(DC390), DC395

--3MwIy2ne0vdjdPXF
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="22x-SMP-extraversion.diff"

--- linux-2.2.12.SuSE.old/Makefile Mon Oct 11 19:34:30 1999
+++ linux-2.2.12.SuSE/Makefile Mon Oct 11 19:36:48 1999
@@ -60,7 +60,14 @@

ROOT_DEV = CURRENT

-KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
+# Test for SMP
+ifdef CONFIG_SMP
+SMPVERSION="-SMP"
+else
+SMPVERSION=
+endif
+
+KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)$(SMPVERSION)

#
# INSTALL_PATH specifies where to place the updated kernel and system map
@@ -297,7 +304,7 @@

include/linux/compile.h: $(CONFIGURATION) include/linux/version.h newversion
@echo -n \#define UTS_VERSION \"\#`cat .version` > .ver
- @if [ -n "$(CONFIG_SMP)" ] ; then echo -n " SMP" >> .ver; fi
+ @#if [ -n "$(CONFIG_SMP)" ] ; then echo -n " SMP" >> .ver; fi
@if [ -f .name ]; then echo -n \-`cat .name` >> .ver; fi
@echo ' '`date`'"' >> .ver
@echo \#define LINUX_COMPILE_TIME \"`date +%T`\" >> .ver
@@ -314,7 +320,16 @@
@echo \#define LINUX_COMPILER \"`$(CC) $(CFLAGS) -v 2>&1 | tail -1`\" >> .ver
@mv -f .ver $@

-include/linux/version.h: ./Makefile
+.kernelrelease.new:
+ @echo "$(KERNELRELEASE)" >./.kernelrelease.new
+
+.kernelrelease: .kernelrelease.new
+ @if diff ./.kernelrelease.new ./.kernelrelease &>/dev/null; \
+ then rm ./.kernelrelease.new; \
+ else mv ./.kernelrelease.new ./.kernelrelease; fi
+
+include/linux/version.h: ./Makefile .kernelrelease
+ @echo "Creating new version.h for $(KERNELRELEASE)"
@echo \#define UTS_RELEASE \"$(KERNELRELEASE)\" > .ver
@echo \#define LINUX_VERSION_CODE `expr $(VERSION) \\* 65536 + $(PATCHLEVEL) \\* 256 + $(SUBLEVEL)` >> .ver
@echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))' >>.ver
@@ -407,7 +422,7 @@
rm -f drivers/net/hamradio/soundmodem/gentbl
rm -f drivers/char/hfmodem/gentbl drivers/char/hfmodem/tables.h
rm -f drivers/sound/*_boot.h drivers/sound/.*.boot
- rm -f .version .config* config.in config.old
+ rm -f .version .kernelrelease .config* config.in config.old
rm -f scripts/tkparse scripts/kconfig.tk scripts/kconfig.tmp
rm -f scripts/cfconv config.in.tmp
rm -f scripts/lxdialog/*.o scripts/lxdialog/lxdialog

--3MwIy2ne0vdjdPXF--

--tsOsTdHNUZQcU9Ye
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.0e (GNU/Linux)
Comment: For info see http://www.gnupg.org

iQCVAwUBOAhYnRaQN/7O/JIVAQGy7wP/cX4Me/TAOLPf1lddpRIW6FkpwGWYRtpu
yAJB1GPMHU9W+2MmawXChiNmh8SiuXRpp56RJsumxBZ0bR7S1MtYO0zknSTRCdHR
Ba4W/LSxoP9bdStqnWqFr7JtYfXew/ukMx5WzIapqa9Zc1Y6+TiZY6YLCrmpiRQ7
FTvAeJBa2+8=
=fLg8
-----END PGP SIGNATURE-----

--tsOsTdHNUZQcU9Ye--

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/