Re: [patch]K6-2/K-III compile option

Anders Fugmann (afu@bording.dk)
Thu, 30 Sep 1999 18:33:05 +0200


This is a multi-part message in MIME format.
--------------A7A3FB57866D5C0CE3C54CC3
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Jeff Garzik wrote:
>
> I submitted a similar patch a couple weeks ago. Comments:
>
> '-march=k6' doesn't always exist. Fall back to '-march=i586' if k6
> isn't known to the compiler.

Good idea...Done. See patch below.

>
> I'm not sure CONFIG_X86_USE_3DNOW, which enables _MMX_ code, is a win on
> all K6's. Wasn't the original K6 rather slow when doing MMX?

I beleive that the plain K6 is slower using mmx routines, but the
K6-2/K6-III should gain a bit.
This is why the options is only for the K6-2/K6-III, as mentioned in
Configure.help

Quoting you :-)
"Patches in the 2.3.18ac series enable MMX routines for the K7. Code
comments state that these routines are a win on K6-III, and I think
possibly the K6-II as well. It is definitely useful to enable
CONFIG_X86_USE_3DNOW and -march=k6 on the K6 series, but doing so
requires separating the K6 option from the PentiumTSC option."

>
> grep and make sure CONFIG_M586TSC isn't used in code as a conditional.
> (ie. make sure code isn't accidentally ifdef'd out, simply because
> CONFIG_M586TSC is not defined)

I've checked and found none.

BTW.
in the file arch/i386/lib/usercopy.c there is a "#ifdef
CONFIG_X86_USE_3DNOW_AND_WORKS"
which enables some mmx routines. I cannot find any other references to
"CONFIG_X86_USE_3DNOW_AND_WORKS".
Do you have an idea why this variable is used or is it just a typo?
Anyway... I've changed it to "#ifdef CONFIG_X86_USE_3DNOW", as you can
se below.

Also:
To whom should I send this patch, for it to be merged into the kernel
tree?

Thanks for your comments.

Anders Fugmann.

***Patch begins***

diff -r -u vanilla-2.3.18ac10/Documentation/Configure.help
linux/Documentation/Configure.help
--- vanilla-2.3.18ac10/Documentation/Configure.help Thu Sep 30
10:58:59 1999
+++ linux/Documentation/Configure.help Thu Sep 30 18:15:02 1999
@@ -1846,13 +1846,13 @@
CONFIG_M386
This is the processor type of your CPU. This information is used for
optimizing purposes. In order to compile a kernel that can run on
- all x86 CPU types (albeit not optimally fast), you can specify
- "386" here.
+ all x86 CPU types (albeit not optimally fast), you can specify "386"
+ here.

- If you specify one of "486" or "586" or "Pentium" or "PPro", then
- the kernel will not necessarily run on earlier architectures (e.g. a
- Pentium optimized kernel will run on a PPro, but not necessarily on
- a i486).
+ If you specify one of "486" or "586" or "Pentium" or "K6" or "PPro"
or
+ K7, then the kernel will not necessarily run on earlier architectures
+ (e.g. a Pentium optimized kernel will run on a PPro, but not
necessarily
+ on a i486).

Here are the settings recommended for greatest speed:
- "386" for the AMD/Cyrix/Intel 386DX/DXL/SL/SLC/SX, Cyrix/TI
@@ -1862,10 +1862,11 @@
AMD/Cyrix 5x86, NexGen Nx586 and UMC U5D or U5S.
- "586" for generic Pentium CPUs, possibly lacking the TSC
(time stamp counter) register.
- - "Pentium" for the Intel Pentium/Pentium MMX, AMD K5, K6 and
- K6-3D.
+ - "Pentium" for the Intel Pentium/Pentium MMX, AMD K5 and K6.
+ - "K6-II(I)" for AMD K6-2 or AMD K6-III.
- "PPro" for the Cyrix/IBM/National Semiconductor 6x86MX, MII and
Intel Pentium II/Pentium Pro.
+ - "K7" for the AMD Athlon processor.

If you don't know what to do, choose "386".

Only in linux/Documentation: Configure.help~
diff -r -u vanilla-2.3.18ac10/arch/i386/Makefile
linux/arch/i386/Makefile
--- vanilla-2.3.18ac10/arch/i386/Makefile Thu Sep 30 10:58:59 1999
+++ linux/arch/i386/Makefile Thu Sep 30 17:51:03 1999
@@ -52,6 +52,13 @@
AFLAGS := $(AFLAGS) -DCPU=586
endif

+ifdef CONFIG_MK6
+CFLAGS := $(CFLAGS) -DCPU=586
+CFLAGS += $(shell if $(CC) -march=k6 -S -o /dev/null -xc /dev/null
>/dev/null 2>&1; then echo "-march=k6"; \
+ elif $(CC) -march=i586 -S -o /dev/null -xc /dev/null
>/dev/null 2>&1; then echo "-march=i586"; fi)
+AFLAGS := $(AFLAGS) -DCPU=586
+endif
+
ifdef CONFIG_M686
CFLAGS := $(CFLAGS) -DCPU=686
CFLAGS += $(shell if $(CC) -march=i686 -S -o /dev/null -xc /dev/null
>/dev/null 2>&1; then echo "-march=i686"; fi)
@@ -59,7 +66,7 @@
endif

ifdef CONFIG_MK7
-CFLAGS := $(CFLAGS) -DCPU=686 -march=pentiumpro -mpentiumpro
-malign-functions=4 -fschedule-insns2 -mwide-multiply
-fexpensive-optimizations
+CFLAGS := $(CFLAGS) -DCPU=686 -malign-functions=4 -fschedule-insns2
-mwide-multiply -fexpensive-optimizations
CFLAGS += $(shell if $(CC) -march=i686 -S -o /dev/null -xc /dev/null
>/dev/null 2>&1; then echo "-march=i686"; fi)
AFLAGS := $(AFLAGS) -DCPU=686
endif
diff -r -u vanilla-2.3.18ac10/arch/i386/config.in
linux/arch/i386/config.in
--- vanilla-2.3.18ac10/arch/i386/config.in Thu Sep 30 10:58:59 1999
+++ linux/arch/i386/config.in Thu Sep 30 17:47:44 1999
@@ -18,8 +18,9 @@
"386 CONFIG_M386 \
486/Cx486 CONFIG_M486 \
586/K5/5x86/6x86 CONFIG_M586 \
- Pentium/K6/TSC CONFIG_M586TSC \
- PPro/6x86MX CONFIG_M686 \
+ Pentium/TSC/K6 CONFIG_M586TSC \
+ K6-2/K6-III CONFIG_MK6 \
+ PPro/6x86MX CONFIG_M686 \
Athlon CONFIG_MK7" PPro
#
# Define implied options from the CPU selection here
@@ -30,15 +31,14 @@
define_bool CONFIG_X86_BSWAP y
define_bool CONFIG_X86_POPAD_OK y
fi
-if [ "$CONFIG_M686" = "y" -o "$CONFIG_M586TSC" = "y" ]; then
+if [ "$CONFIG_M686" = "y" -o "$CONFIG_M586TSC" = "y" -o \
+ "$CONFIG_MK6" = "y" -o "$CONFIG_MK7" = "y" ]; then
define_bool CONFIG_X86_TSC y
fi
-if [ "$CONFIG_M686" = "y" ]; then
+if [ "$CONFIG_M686" = "y" -o "$CONFIG_MK7" = "y" ]; then
define_bool CONFIG_X86_GOOD_APIC y
fi
-if [ "$CONFIG_MK7" = "y" ]; then
- define_bool CONFIG_X86_TSC y
- define_bool CONFIG_X86_GOOD_APIC y
+if [ "$CONFIG_MK6" = "y" -o "$CONFIG_MK7" = "y" ]; then
define_bool CONFIG_X86_USE_3DNOW y
fi

diff -r -u vanilla-2.3.18ac10/arch/i386/defconfig
linux/arch/i386/defconfig
--- vanilla-2.3.18ac10/arch/i386/defconfig Thu Sep 30 10:58:59 1999
+++ linux/arch/i386/defconfig Thu Sep 30 17:47:44 1999
@@ -16,6 +16,7 @@
# CONFIG_M486 is not set
# CONFIG_M586 is not set
# CONFIG_M586TSC is not set
+# CONFIG_MK6 is not set
CONFIG_M686=y
# CONFIG_MK7 is not set
CONFIG_X86_WP_WORKS_OK=y
diff -r -u vanilla-2.3.18ac10/arch/i386/lib/usercopy.c
linux/arch/i386/lib/usercopy.c
--- vanilla-2.3.18ac10/arch/i386/lib/usercopy.c Wed Sep 29 18:41:25 1999
+++ linux/arch/i386/lib/usercopy.c Thu Sep 30 18:15:07 1999
@@ -8,7 +8,7 @@
#include <asm/uaccess.h>
#include <asm/mmx.h>

-#ifdef CONFIG_X86_USE_3DNOW_AND_WORKS
+#ifdef CONFIG_X86_USE_3DNOW

unsigned long
__generic_copy_to_user(void *to, const void *from, unsigned long n)

***Patch ends***
--------------A7A3FB57866D5C0CE3C54CC3
Content-Type: application/octet-stream;
name="k6-2.3.18ac10.diff.bz2"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="k6-2.3.18ac10.diff.bz2"

QlpoOTFBWSZTWeB4su8ABjJfgHAyXf///3/v3s6/79/xYAgdb7oYzfZqdtXZYIgAAaDDVTxQ
aD1AMgMgANGmgA0aANA00AGiImxqZAk0M1NGgND1AaANAAAABxkaZMTQZMmE0yBkNAaA0yaG
AE0BhKeopGVPTTIIeTU2oyPUyGmjQNNGmg0DTQA0CKSERiD0QaGhMmAA0AAajEaegAmEiQQC
A0E0Jpppik9qniGh6mmQTQGmhp6myl+CM15NziN/XvwnUGbS1g+vLz/EZr3l8tw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A47YDDSf7F3JFOFCQ4Hiy7w=
--------------A7A3FB57866D5C0CE3C54CC3--

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