RFC: [2.6 patch] better i386 CPU selection
The most important changes since the first version of this patch:
- arch/i386/Makefile updates
- X86_GOOD_APIC -> X86_BAD_APIC
- made arch/i386/kernel/cpu{,mtrr/}/Makefile CPU specific
A 2.6.0-test5 kernel with this patch applied compiled and bootet on my K6.
This patch makes the bzImage for my computer (same .config, same compiler, same compiler options) a good 5 kB smaller.
I'd appreciate it if more people could try this patch and report whether their kernel compiles and works.
The patch below tries to implement a better i386 CPU selection.
In 2.4 selecting e.g. M486 has the semantics to get a kernel that runs on a 486 and above.
In 2.6 selecting M486 means that only the 486 is supported.
The help text for the X86_GENERIC option says it generates a generic kernel but the implementation is that it supports CPUs of the selected M* option and above.
There are two different needs:
1. the installation kernel of a distribution should support all CPUs this distribution supports (perhaps starting with the 386)
2. a sysadmin might e.g. want a kernel that support both a Pentium-III and a Pentium 4, but doesn't need to support a 386
The implementation in 2.4 was near to satisfy need 2., if X86_GENERIC in 2.6 was implemented as the help text says it would satisfy the need of 1.
The patch below against 2.6.0-test5 does a different implementation that lets you select all CPUs you want to support and it should therefore suit both needs.
Changes:
- changed the i386 CPU selection from a choice to single options for every cpu
- renamed the M* variables to CPU_*, this is needed to ask the users upgrading from older kernels instead of silently changing the semantics
- made arch/i386/kernel/cpu/Makefile CPU specific
- made arch/i386/kernel/cpu/mtrr/Makefile CPU specific
- X86_GOOD_APIC -> X86_BAD_APIC
- AMD Elan is a different subarch, you can't configure a kernel that runs on both the AMD Elan and other i386 CPUs
- added optimizing CFLAGS for the AMD Elan
- gcc 2.95 supports -march=k6 (no need for check_gcc)
- even gcc 3.3 doesn't seem to support -march=c3-2, use -march=c3
- help text changes/updates
Questions/TODO:
- please check whether my changes to arch/i386/kernel/cpu{,mtrr/}/Makefile are correct
- which CPUs exactly need X86_ALIGNMENT_16?
- change include/asm-i386/module.h to use some kind of bitmask
diffstat output:
arch/i386/Kconfig | 255 ++++++++++++----------------- arch/i386/Makefile | 104 +++++++++-- arch/i386/boot/setup.S | 2 arch/i386/kernel/cpu/Makefile | 34 ++- arch/i386/kernel/cpu/common.c | 27 +++ arch/i386/kernel/cpu/mtrr/Makefile | 14 + arch/i386/kernel/cpu/mtrr/main.c | 14 + arch/i386/lib/mmx.c | 2 arch/i386/mm/init.c | 6 drivers/serial/8250.h | 2 include/asm-i386/apic.h | 4 include/asm-i386/bugs.h | 7 include/asm-i386/module.h | 2 include/asm-i386/processor.h | 4 include/asm-i386/timex.h | 2 15 files changed, 292 insertions(+), 187 deletions(-)
cu
Adrian
arch/i386/Kconfig renamed from arch/i386/Kconfig.old +114 -141
@@ -43,6 +43,15 @@ help Choose this option if your computer is a standard PC or compatible. +config X86_ELAN + bool "Elan" + help + Select this for an AMD Elan processor. + + Do not use this option for K6/Athlon/Opteron processors! + + If unsure choose "PC-compatible" instead. + config X86_VOYAGER bool "Voyager (NCR)" help
@@ -125,48 +134,19 @@ default y depends on SMP && X86_ES7000 && MPENTIUMIII -choice - prompt "Processor family" - default M686 -config M386 - bool "386" - ---help--- - 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. - - The kernel will not necessarily run on earlier architectures than - the one you have chosen, 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 - 486DLC/DLC2, UMC 486SX-S and NexGen Nx586. Only "386" kernels - will run on a 386 class machine. - - "486" for the AMD/Cyrix/IBM/Intel 486DX/DX2/DX4 or - SL/SLC/SLC2/SLC3/SX/SX2 and UMC U5D or U5S. - - "586" for generic Pentium CPUs lacking the TSC - (time stamp counter) register. - - "Pentium-Classic" for the Intel Pentium. - - "Pentium-MMX" for the Intel Pentium MMX. - - "Pentium-Pro" for the Intel Pentium Pro. - - "Pentium-II" for the Intel Pentium II or pre-Coppermine Celeron. - - "Pentium-III" for the Intel Pentium III or Coppermine Celeron. - - "Pentium-4" for the Intel Pentium 4 or P4-based Celeron. - - "K6" for the AMD K6, K6-II and K6-III (aka K6-3D). - - "Athlon" for the AMD K7 family (Athlon/Duron/Thunderbird). - - "Crusoe" for the Transmeta Crusoe series. - - "Winchip-C6" for original IDT Winchip. - - "Winchip-2" for IDT Winchip 2. - - "Winchip-2A" for IDT Winchips with 3dNow! capabilities. - - "CyrixIII/VIA C3" for VIA Cyrix III or VIA C3. - - "VIA C3-2 for VIA C3-2 "Nehemiah" (model 9 and above). +if !X86_ELAN + +menu "Processor support" - If you don't know what to do, choose "386". +comment "Select all processors your kernel should support" -config M486 +config CPU_386 + bool "386" + help + Select this for a 386 series processor. + +config CPU_486 bool "486" help Select this for a 486 series processor, either Intel or one of the
@@ -174,227 +154,220 @@ DX2, and DX4 variants; also SL/SLC/SLC2/SLC3/SX/SX2 and UMC U5D or U5S. -config M586 +config CPU_586 bool "586/K5/5x86/6x86/6x86MX" help - Select this for an 586 or 686 series processor such as the AMD K5, - the Intel 5x86 or 6x86, or the Intel 6x86MX. This choice does not - assume the RDTSC (Read Time Stamp Counter) instruction. + Select this for a non-Intel 586 or 686 series processor such as + the AMD K5 or the Cyrix 6x86MX. + + Several CPUs that have their own options below (e.g. AMD K6, + Duron, Athlon and Opteeron, IDT Winchip, Cyrix III and + VIA C3) do _not_ need this option. + + This choice does not assume the RDTSC (Read Time Stamp Counter) + instruction. -config M586TSC +config CPU_586TSC bool "Pentium-Classic" help Select this for a Pentium Classic processor with the RDTSC (Read - Time Stamp Counter) instruction for benchmarking. + Time Stamp Counter) instruction. -config M586MMX +config CPU_586MMX bool "Pentium-MMX" help Select this for a Pentium with the MMX graphics/multimedia extended instructions. -config M686 +config CPU_686 bool "Pentium-Pro" help - Select this for Intel Pentium Pro chips. This enables the use of - Pentium Pro extended instructions, and disables the init-time guard - against the f00f bug found in earlier Pentiums. + Select this for Intel Pentium Pro chips. -config MPENTIUMII +config CPU_PENTIUMII bool "Pentium-II/Celeron(pre-Coppermine)" help Select this for Intel chips based on the Pentium-II and - pre-Coppermine Celeron core. This option enables an unaligned - copy optimization, compiles the kernel with optimization flags - tailored for the chip, and applies any applicable Pentium Pro - optimizations. + pre-Coppermine Celeron core. -config MPENTIUMIII +config CPU_PENTIUMIII bool "Pentium-III/Celeron(Coppermine)/Pentium-III Xeon" help Select this for Intel chips based on the Pentium-III and - Celeron-Coppermine core. This option enables use of some - extended prefetch instructions in addition to the Pentium II - extensions. + Celeron-Coppermine core. -config MPENTIUM4 +config CPU_PENTIUM4 bool "Pentium-4/Celeron(P4-based)/Xeon" help Select this for Intel Pentium 4 chips. This includes both - the Pentium 4 and P4-based Celeron chips. This option - enables compile flags optimized for the chip, uses the - correct cache shift, and applies any applicable Pentium III - optimizations. + the Pentium 4 and P4-based Celeron chips. -config MK6 +config CPU_K6 bool "K6/K6-II/K6-III" help - Select this for an AMD K6-family processor. Enables use of - some extended instructions, and passes appropriate optimization - flags to GCC. + Select this for an AMD K6, K6-II or K6-III (aka K6-3D). -config MK7 +config CPU_K7 bool "Athlon/Duron/K7" help - Select this for an AMD Athlon K7-family processor. Enables use of - some extended instructions, and passes appropriate optimization - flags to GCC. + Select this for an AMD Athlon K7-family processor. -config MK8 +config CPU_K8 bool "Opteron/Athlon64/Hammer/K8" help - Select this for an AMD Opteron or Athlon64 Hammer-family processor. Enables - use of some extended instructions, and passes appropriate optimization - flags to GCC. + Select this for an AMD Opteron or Athlon64 Hammer-family processor. -config MELAN - bool "Elan" - -config MCRUSOE +config CPU_CRUSOE bool "Crusoe" help - Select this for a Transmeta Crusoe processor. Treats the processor - like a 586 with TSC, and sets some GCC optimization flags (like a - Pentium Pro with no alignment requirements). + Select this for a Transmeta Crusoe processor. -config MWINCHIPC6 +config CPU_WINCHIPC6 bool "Winchip-C6" help - Select this for an IDT Winchip C6 chip. Linux and GCC - treat this chip as a 586TSC with some extended instructions - and alignment requirements. + Select this for an IDT Winchip C6 chip. -config MWINCHIP2 +config CPU_WINCHIP2 bool "Winchip-2" help - Select this for an IDT Winchip-2. Linux and GCC - treat this chip as a 586TSC with some extended instructions - and alignment requirements. + Select this for an IDT Winchip-2. -config MWINCHIP3D +config CPU_WINCHIP3D bool "Winchip-2A/Winchip-3" help - Select this for an IDT Winchip-2A or 3. Linux and GCC - treat this chip as a 586TSC with some extended instructions - and alignment reqirements. Also enable out of order memory - stores for this CPU, which can increase performance of some - operations. - -config MCYRIXIII - bool "CyrixIII/VIA-C3" - help - Select this for a Cyrix III or C3 chip. Presently Linux and GCC - treat this chip as a generic 586. Whilst the CPU is 686 class, - it lacks the cmov extension which gcc assumes is present when - generating 686 code. - Note that Nehemiah (Model 9) and above will not boot with this - kernel due to them lacking the 3DNow! instructions used in earlier - incarnations of the CPU. + Select this for an IDT Winchip-2A or 3 with 3dNow! + capabilities. + +config CPU_CYRIXIII + bool "Cyrix III/VIA C3" + help + Select this for a Cyrix III or VIA C3 chip. -config MVIAC3_2 + Note that Nehemiah (Model 9) and above need the next + option instead. + +config CPU_VIAC3_2 bool "VIA C3-2 (Nehemiah)" help - Select this for a VIA C3 "Nehemiah". Selecting this enables usage - of SSE and tells gcc to treat the CPU as a 686. - Note, this kernel will not boot on older (pre model 9) C3s. + Select this for a VIA C3 "Nehemiah" (model 9 and above). -endchoice +endmenu -config X86_GENERIC - bool "Generic x86 support" - help - Including some tuning for non selected x86 CPUs too. - when it has moderate overhead. This is intended for generic - distributions kernels. +endif + +# +# helper options +# +config CPU_INTEL + bool + depends on CPU_386 || CPU_486 || CPU_586TSC || CPU_686 || CPU_PENTIUMII || CPU_PENTIUMIII || CPU_PENTIUM4 + +config CPU_WINCHIP + bool + depends on CPU_WINCHIPC6 || CPU_WINCHIP2 || CPU_WINCHIP3D + default y + +config CPU_ONLY_K7 + bool + depends on CPU_K7 && !CPU_INTEL && !CPU_K6 && !CPU_K8 && !X86_ELAN && !CPU_CRUSOE && !CPU_WINCHIP && !CPU_CYRIXIII && !CPU_VIAC3_2 + +config CPU_ONLY_K8 + bool + depends on CPU_K8 && !CPU_INTEL && !CPU_K6 && !CPU_K7 && !X86_ELAN && !CPU_CRUSOE && !CPU_WINCHIP && !CPU_CYRIXIII && !CPU_VIAC3_2 + +config CPU_ONLY_WINCHIP + bool + depends on CPU_WINCHIP && !CPU_INTEL && !CPU_K6 && !CPU_K7 && !CPU_K8 && !X86_ELAN && !CPU_CRUSOE && !CPU_CYRIXIII && !CPU_VIAC3_2 + default y # # Define implied options from the CPU selection here # config X86_CMPXCHG bool - depends on !M386 + depends on !CPU_386 default y config X86_XADD bool - depends on !M386 + depends on !CPU_386 default y config X86_L1_CACHE_SHIFT int - default "7" if MPENTIUM4 || X86_GENERIC - default "4" if MELAN || M486 || M386 - default "5" if MWINCHIP3D || MWINCHIP2 || MWINCHIPC6 || MCRUSOE || MCYRIXIII || MK6 || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || M586TSC || M586 || MVIAC3_2 - default "6" if MK7 || MK8 + default "7" if CPU_PENTIUM4 + default "6" if CPU_K7 || CPU_K8 + default "5" if CPU_WINCHIP || CPU_CRUSOE || CPU_CYRIXIII || CPU_K6 || CPU_PENTIUMIII || CPU_PENTIUMII || CPU_686 || CPU_586MMX || CPU_586TSC || CPU_586 || CPU_VIAC3_2 + default "4" if X86_ELAN || CPU_486 || CPU_386 config RWSEM_GENERIC_SPINLOCK bool - depends on M386 + depends on CPU_386 default y config RWSEM_XCHGADD_ALGORITHM bool - depends on !M386 + depends on !CPU_386 default y config X86_PPRO_FENCE bool - depends on M686 || M586MMX || M586TSC || M586 || M486 || M386 + depends on CPU_686 default y config X86_F00F_BUG bool - depends on M586MMX || M586TSC || M586 || M486 || M386 + depends on CPU_586MMX || CPU_586TSC default y config X86_WP_WORKS_OK bool - depends on !M386 + depends on !CPU_386 default y config X86_INVLPG bool - depends on !M386 + depends on !CPU_386 default y config X86_BSWAP bool - depends on !M386 + depends on !CPU_386 default y config X86_POPAD_OK bool - depends on !M386 + depends on !CPU_386 default y config X86_ALIGNMENT_16 bool - depends on MWINCHIP3D || MWINCHIP2 || MWINCHIPC6 || MCYRIXIII || MELAN || MK6 || M586MMX || M586TSC || M586 || M486 || MVIAC3_2 + depends on CPU_WINCHIP || CPU_CYRIXIII || X86_ELAN || CPU_K6 || CPU_586MMX || CPU_586TSC || CPU_586 || CPU_486 || CPU_VIAC3_2 default y -config X86_GOOD_APIC +config X86_BAD_APIC bool - depends on MK7 || MPENTIUM4 || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || MK8 + depends on CPU_586TSC default y config X86_INTEL_USERCOPY bool - depends on MPENTIUM4 || MPENTIUMIII || MPENTIUMII || M586MMX || X86_GENERIC || MK8 || MK7 + depends on !CPU_386 && !CPU_486 && !CPU_586 && !CPU_586TSC && !CPU_686 && !CPU_K6 && !X86_ELAN && !CPU_CRUSOE && !CPU_WINCHIP && !CPU_CYRIXIII && !CPU_VIAC3_2 default y config X86_USE_PPRO_CHECKSUM bool - depends on MWINCHIP3D || MWINCHIP2 || MWINCHIPC6 || MCYRIXIII || MK7 || MK6 || MPENTIUM4 || MPENTIUMIII || MPENTIUMII || M686 || MK8 || MVIAC3_2 + depends on !CPU_386 && !CPU_486 && !CPU_586 && !CPU_586TSC && !CPU_586MMX && !X86_ELAN && !CPU_CRUSOE default y config X86_USE_3DNOW bool - depends on MCYRIXIII || MK7 + depends on !CPU_INTEL && !CPU_K6 && !CPU_K8 && !X86_ELAN && !CPU_CRUSOE && !CPU_WINCHIP && !CPU_VIAC3_2 default y config X86_OOSTORE bool - depends on MWINCHIP3D || MWINCHIP2 || MWINCHIPC6 + depends on CPU_ONLY_WINCHIP default y config HUGETLB_PAGE
@@ -517,7 +490,7 @@ config X86_TSC bool - depends on (MWINCHIP3D || MWINCHIP2 || MCRUSOE || MCYRIXIII || MK7 || MK6 || MPENTIUM4 || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || M586TSC || MK8 || MVIAC3_2) && !X86_NUMAQ + depends on !X86_NUMAQ && !CPU_386 && !CPU_486 && !CPU_586 && !X86_ELAN && !CPU_WINCHIPC6 default y config X86_MCE
arch/i386/Makefile renamed from arch/i386/Makefile.old +85 -19
113 lines not on this page · raw message
include/asm-i386/processor.h renamed from include/asm-i386/processor.h.old +2 -2
@@ -541,7 +541,7 @@#define K7_NOP7 ".byte 0x8D,0x04,0x05,0,0,0,0\n"#define K7_NOP8 K7_NOP7 ASM_NOP1 -#ifdef CONFIG_MK8 +#ifdef CONFIG_CPU_ONLY_K8 #define ASM_NOP1 K8_NOP1#define ASM_NOP2 K8_NOP2#define ASM_NOP3 K8_NOP3
@@ -550,7 +550,7 @@#define ASM_NOP6 K8_NOP6#define ASM_NOP7 K8_NOP7#define ASM_NOP8 K8_NOP8 -#elif defined(CONFIG_MK7 ) +#elif defined(CONFIG_CPU_ONLY_K7 )#define ASM_NOP1 K7_NOP1#define ASM_NOP2 K7_NOP2#define ASM_NOP3 K7_NOP3
drivers/serial/8250.h renamed from drivers/serial/8250.h.old +1 -1
@@ -44,7 +44,7 @@#undef SERIAL_DEBUG_PCI -#if defined(__i386__) && (defined(CONFIG_M386 ) || defined(CONFIG_M486 )) +#if defined(__i386__) && (defined(CONFIG_CPU_386 ) || defined(CONFIG_CPU_486 ))#define SERIAL_INLINE #endif
arch/i386/boot/setup.S renamed from arch/i386/boot/setup.S.old +1 -1
@@ -744,7 +744,7 @@ # AMD Elan bug fix by Robert Schwebel. # -#if defined(CONFIG_MELAN) +#if defined(CONFIG_X86_ELAN) movb $0x02, %al # alternate A20 gate outb %al, $0x92 # this works on SC410/SC520 a20_elan_wait:
include/asm-i386/timex.h renamed from include/asm-i386/timex.h.old +1 -1
@@ -12,7 +12,7 @@#ifdef CONFIG_X86_PC9800 extern int CLOCK_TICK_RATE ;#else -#ifdef CONFIG_MELAN +#ifdef CONFIG_X86_ELAN # define CLOCK_TICK_RATE 1189200/* AMD Elan has different frequency! */ #else # define CLOCK_TICK_RATE 1193182/* Underlying HZ */
arch/i386/lib/mmx.c renamed from arch/i386/lib/mmx.c.old +1 -1
@@ -121,7 +121,7 @@return p; } -#ifdef CONFIG_MK7 +#ifndef CONFIG_CPU_CYRIXIII /* * The K7 has streaming cache bypass load/store. The Cyrix III, K6 and
arch/i386/kernel/cpu/Makefile renamed from arch/i386/kernel/cpu/Makefile.old +25 -9
@@ -2,16 +2,32 @@ # Makefile for x86-compatible CPU details and quirks # -obj-y := common.o proc.o +obj-y := common.o proc.o + + +obj-$(CONFIG_CPU_486) += amd.o +obj-$(CONFIG_CPU_586) += amd.o +obj-$(CONFIG_CPU_K6) += amd.o +obj-$(CONFIG_CPU_K7) += amd.o +obj-$(CONFIG_CPU_K8) += amd.o + +obj-$(CONFIG_CPU_WINCHIP) += centaur.o +obj-$(CONFIG_CPU_CYRIXIII) += centaur.o +obj-$(CONFIG_CPU_VIAC3_2) += centaur.o + +obj-$(CONFIG_CPU_486) += cyrix.o +obj-$(CONFIG_CPU_586) += cyrix.o + +obj-$(CONFIG_CPU_INTEL) += intel.o + +obj-$(CONFIG_CPU_586) += nexgen.o + +obj-$(CONFIG_CPU_586) += rise.o + +obj-$(CONFIG_CPU_CRUSOE) += transmeta.o + +obj-$(CONFIG_CPU_486) += umc.o -obj-y += amd.o -obj-y += cyrix.o -obj-y += centaur.o -obj-y += transmeta.o -obj-y += intel.o -obj-y += rise.o -obj-y += nexgen.o -obj-y += umc.o obj-$(CONFIG_X86_MCE) += mcheck/
arch/i386/kernel/cpu/common.c renamed from arch/i386/kernel/cpu/common.c.old +27 -0
@@ -434,15 +434,42 @@void __init early_cpu_init (void ) { + +#if defined(CONFIG_CPU_INTEL )intel_cpu_init (); +#endif + +#if defined(CONFIG_CPU_486 ) || defined(CONFIG_CPU_586 )cyrix_init_cpu (); +#endif + +#if defined(CONFIG_CPU_486 )nsc_init_cpu (); +#endif + +#if defined(CONFIG_CPU_486 ) || defined(CONFIG_CPU_586 ) || defined(CONFIG_CPU_K6 ) || defined(CONFIG_CPU_K7 ) || defined(CONFIG_CPU_K8 )amd_init_cpu (); +#endif + +#if defined(CONFIG_CPU_WINCHIP ) || defined(CONFIG_CPU_CYRIXIII ) || defined(CONFIG_CPU_VIAC3_2 )centaur_init_cpu (); +#endif + +#if defined(CONFIG_CPU_CRUSOE )transmeta_init_cpu (); +#endif + +#if defined(CONFIG_CPU_586 )rise_init_cpu (); +#endif + +#if defined(CONFIG_CPU_586 )nexgen_init_cpu (); +#endif + +#if defined(CONFIG_CPU_486 )umc_init_cpu (); +#endif #ifdef CONFIG_DEBUG_PAGEALLOC /* pse is not compatible with on-the-fly unmapping,
arch/i386/mm/init.c renamed from arch/i386/mm/init.c.old +5 -1
@@ -436,8 +436,12 @@if (!mem_map)BUG ();#endif - + +#ifdef CONFIG_CPU_686 bad_ppro =ppro_with_ram_bug (); +#else + bad_ppro =0 ; +#endif #ifdef CONFIG_HIGHMEM /* check that fixmap and pkmap do not overlap */
arch/i386/kernel/cpu/mtrr/Makefile renamed from arch/i386/kernel/cpu/mtrr/Makefile.old +10 -4
@@ -1,5 +1,11 @@ -obj-y := main.o if.o generic.o state.o -obj-y += amd.o -obj-y += cyrix.o -obj-y += centaur.o +obj-y := main.o if.o generic.o state.o + +obj-$(CONFIG_CPU_K6) += amd.o + +obj-$(CONFIG_CPU_586) += cyrix.o + +obj-$(CONFIG_CPU_WINCHIP) += centaur.o +obj-$(CONFIG_CPU_CYRIXIII) += centaur.o +obj-$(CONFIG_CPU_VIAC3_2) += centaur.o +
arch/i386/kernel/cpu/mtrr/main.c renamed from arch/i386/kernel/cpu/mtrr/main.c.old +14 -0
@@ -475,12 +475,16 @@printk (KERN_WARNING "mtrr: register: %d too big\n" , reg); goto out; } + +#if defined(CONFIG_CPU_586 )if (is_cpu (CYRIX ) && !use_intel ()) {if ((reg ==3 ) && arr3_protected) {printk (KERN_WARNING "mtrr: ARR3 cannot be changed\n" ); goto out; } } +#endif + mtrr_if->get (reg, &lbase, &lsize, <ype);if (lsize <1 ) {printk (KERN_WARNING "mtrr: MTRR %d not used\n" , reg);
@@ -536,9 +540,19 @@static void __init init_ifs (void ) { + +#if defined(CONFIG_CPU_K6 )amd_init_mtrr (); +#endif + +#if defined(CONFIG_CPU_586 )cyrix_init_mtrr (); +#endif + +#if defined(CONFIG_CPU_WINCHIP ) || defined(CONFIG_CPU_CYRIXIII ) || defined(CONFIG_CPU_VIAC3_2 )centaur_init_mtrr (); +#endif + }static void init_other_cpus (void )
include/asm-i386/bugs.h renamed from include/asm-i386/bugs.h.old +3 -4
@@ -152,9 +152,8 @@* - In order to run on anything without a TSC, we need to be * compiled for a i486. * - In order to support the local APIC on a buggy Pentium machine, -* we need to be compiled with CONFIG_X86_GOOD_APIC disabled, -* which happens implicitly if compiled for a Pentium or lower -* (unless an advanced selection of CPU features is used) as an +* we need to be compiled with CONFIG_X86_BAD_APIC enabled, +* which happens implicitly if compiled for a Pentium as an * otherwise config implies a properly working local APIC without * the need to do extra reads from the APIC. */
@@ -185,7 +184,7 @@* integrated APIC (see 11AP erratum in "Pentium Processor * Specification Update"). */ -#if defined(CONFIG_X86_LOCAL_APIC ) && defined(CONFIG_X86_GOOD_APIC ) +#if defined(CONFIG_X86_LOCAL_APIC ) && !defined(CONFIG_X86_BAD_APIC )if (boot_cpu_data.x86_vendor ==X86_VENDOR_INTEL && cpu_has_apic && boot_cpu_data.x86 == 5
include/asm-i386/apic.h renamed from include/asm-i386/apic.h.old +2 -2
@@ -41,7 +41,7 @@do { }while (apic_read (APIC_ICR ) &APIC_ICR_BUSY ); } -#ifdef CONFIG_X86_GOOD_APIC +#ifndef CONFIG_X86_BAD_APIC # define FORCE_READ_AROUND_WRITE 0# define apic_read_around (x)# define apic_write_around (x,y) apic_write((x),(y))
@@ -56,7 +56,7 @@/* * ack_APIC_irq() actually gets compiled as a single instruction: * - a single rmw on Pentium/82489DX -* - a single write on P6+ cores (CONFIG_X86_GOOD_APIC) +* - a single write on P6+ cores (!CONFIG_X86_BAD_APIC) * ... yummie. */
include/asm-i386/module.h renamed from include/asm-i386/module.h.old +1 -1
@@ -49,7 +49,7 @@#elif CONFIG_MVIAC3_2 #define MODULE_PROC_FAMILY "VIAC3-2 "#else -#error unknown processor family +#define MODULE_PROC_FAMILY "this needs to be fixed"#endif #define MODULE_ARCH_VERMAGIC MODULE_PROC_FAMILY
Quoted 1 line · Adrian Bunk
I'd appreciate it if more people could try this patch and report whether their kernel compiles and works.
Compiling with config below produces linking errors:
arch/i386/lib/lib.a(usercopy.o): In function `__copy_to_user_ll':usercopy.o(.text+0x279): undefined reference to movsl_mask' arch/i386/lib/lib.a(usercopy.o): In function __copy_from_user_ll':usercopy.o(.text+0x2e9): undefined reference to `movsl_mask'
.config:
CONFIG_X86=yCONFIG_MMU=yCONFIG_UID16=yCONFIG_GENERIC_ISA_DMA=yCONFIG_EXPERIMENTAL=yCONFIG_CLEAN_COMPILE=yCONFIG_STANDALONE=yCONFIG_BROKEN_ON_SMP=yCONFIG_SYSVIPC=yCONFIG_SYSCTL=yCONFIG_EMBEDDED=yCONFIG_KALLSYMS=yCONFIG_FUTEX=yCONFIG_EPOLL=yCONFIG_IOSCHED_DEADLINE=yCONFIG_X86_PC=yCONFIG_CPU_K7=yCONFIG_X86_CMPXCHG=yCONFIG_X86_XADD=yCONFIG_RWSEM_XCHGADD_ALGORITHM=yCONFIG_X86_WP_WORKS_OK=yCONFIG_X86_INVLPG=yCONFIG_X86_BSWAP=yCONFIG_X86_POPAD_OK=yCONFIG_X86_INTEL_USERCOPY=yCONFIG_X86_USE_PPRO_CHECKSUM=yCONFIG_X86_USE_3DNOW=yCONFIG_X86_UP_APIC=yCONFIG_X86_UP_IOAPIC=yCONFIG_X86_LOCAL_APIC=yCONFIG_X86_IO_APIC=yCONFIG_X86_TSC=yCONFIG_X86_MCE=yCONFIG_X86_MCE_NONFATAL=yCONFIG_NOHIGHMEM=yCONFIG_MTRR=yCONFIG_ACPI_HT=yCONFIG_ACPI=yCONFIG_ACPI_BOOT=yCONFIG_ACPI_BUS=yCONFIG_ACPI_INTERPRETER=yCONFIG_ACPI_EC=yCONFIG_ACPI_POWER=yCONFIG_ACPI_PCI=yCONFIG_ACPI_SYSTEM=yCONFIG_PCI=yCONFIG_PCI_GODIRECT=yCONFIG_PCI_DIRECT=yCONFIG_HOTPLUG=yCONFIG_BINFMT_ELF=yCONFIG_BLK_DEV_FD=yCONFIG_BLK_DEV_LOOP=yCONFIG_IDE=yCONFIG_BLK_DEV_IDE=yCONFIG_BLK_DEV_IDEDISK=yCONFIG_IDEDISK_MULTI_MODE=yCONFIG_BLK_DEV_IDECD=yCONFIG_BLK_DEV_IDEFLOPPY=yCONFIG_IDE_TASKFILE_IO=yCONFIG_BLK_DEV_IDEPCI=yCONFIG_IDEPCI_SHARE_IRQ=yCONFIG_BLK_DEV_IDEDMA_PCI=yCONFIG_IDEDMA_PCI_AUTO=yCONFIG_BLK_DEV_ADMA=yCONFIG_BLK_DEV_SIS5513=yCONFIG_BLK_DEV_VIA82CXXX=yCONFIG_BLK_DEV_IDEDMA=yCONFIG_IDEDMA_AUTO=yCONFIG_SCSI=yCONFIG_BLK_DEV_SD=yCONFIG_CHR_DEV_ST=yCONFIG_BLK_DEV_3W_XXXX_RAID=yCONFIG_SCSI_AIC7XXX=yCONFIG_MD=yCONFIG_BLK_DEV_DM=yCONFIG_NET=yCONFIG_PACKET=yCONFIG_PACKET_MMAP=yCONFIG_UNIX=yCONFIG_INET=yCONFIG_NETFILTER=yCONFIG_IP_NF_CONNTRACK=yCONFIG_IP_NF_FTP=yCONFIG_IP_NF_IPTABLES=yCONFIG_IP_NF_MATCH_STATE=yCONFIG_IP_NF_FILTER=yCONFIG_IP_NF_TARGET_REJECT=yCONFIG_IP_NF_NAT=yCONFIG_IP_NF_NAT_NEEDED=yCONFIG_IP_NF_TARGET_MASQUERADE=yCONFIG_IP_NF_TARGET_REDIRECT=yCONFIG_IP_NF_NAT_FTP=yCONFIG_IP_NF_TARGET_LOG=yCONFIG_IPV6_SCTP__=yCONFIG_NETDEVICES=yCONFIG_TUN=yCONFIG_NET_ETHERNET=yCONFIG_MII=yCONFIG_NET_TULIP=yCONFIG_TULIP=yCONFIG_TULIP_MMIO=yCONFIG_NET_PCI=yCONFIG_NATSEMI=yCONFIG_SIS900=yCONFIG_NS83820=y
# Token Ring devices (depends on LLC=y)CONFIG_INPUT=yCONFIG_INPUT_MOUSEDEV=yCONFIG_INPUT_EVDEV=yCONFIG_SOUND_GAMEPORT=yCONFIG_VT=yCONFIG_VT_CONSOLE=yCONFIG_HW_CONSOLE=yCONFIG_SERIAL_8250=yCONFIG_SERIAL_8250_CONSOLE=yCONFIG_SERIAL_CORE=yCONFIG_SERIAL_CORE_CONSOLE=yCONFIG_UNIX98_PTYS=yCONFIG_I2C=yCONFIG_I2C_CHARDEV=yCONFIG_AGP=yCONFIG_AGP_SIS=yCONFIG_AGP_VIA=yCONFIG_DRM=yCONFIG_DRM_R128=yCONFIG_EXT2_FS=yCONFIG_XFS_FS=yCONFIG_ISO9660_FS=yCONFIG_JOLIET=yCONFIG_FAT_FS=yCONFIG_MSDOS_FS=yCONFIG_VFAT_FS=yCONFIG_PROC_FS=yCONFIG_DEVFS_FS=yCONFIG_DEVFS_MOUNT=yCONFIG_DEVPTS_FS=yCONFIG_TMPFS=yCONFIG_RAMFS=yCONFIG_NFSD=yCONFIG_NFSD_V3=yCONFIG_LOCKD=yCONFIG_LOCKD_V4=yCONFIG_EXPORTFS=yCONFIG_SUNRPC=yCONFIG_MSDOS_PARTITION=yCONFIG_NLS=yCONFIG_FB=yCONFIG_VIDEO_SELECT=yCONFIG_FB_ATY128=yCONFIG_VGA_CONSOLE=yCONFIG_DUMMY_CONSOLE=yCONFIG_FRAMEBUFFER_CONSOLE=yCONFIG_PCI_CONSOLE=y
CONFIG_FONT_8x8=y
CONFIG_FONT_8x16=yCONFIG_LOGO=yCONFIG_LOGO_LINUX_CLUT224=yCONFIG_SOUND=yCONFIG_SND=yCONFIG_SND_INTEL8X0=yCONFIG_USB=yCONFIG_USB_DEVICEFS=yCONFIG_USB_DYNAMIC_MINORS=yCONFIG_USB_EHCI_HCD=yCONFIG_USB_OHCI_HCD=yCONFIG_USB_UHCI_HCD=yCONFIG_USB_PRINTER=yCONFIG_USB_STORAGE=yCONFIG_USB_HID=yCONFIG_USB_HIDINPUT=yCONFIG_USB_USBNET=yCONFIG_USB_CDCETHER=yCONFIG_DEBUG_KERNEL=yCONFIG_MAGIC_SYSRQ=yCONFIG_X86_EXTRA_IRQS=yCONFIG_X86_FIND_SMP_CONFIG=yCONFIG_X86_MPPARSE=yCONFIG_X86_BIOS_REBOOT=y
Quoted 7 lines · Kevin P. Fleming
Quoted 2 lines · Adrian Bunk
I'd appreciate it if more people could try this patch and report whether their kernel compiles and works.
Compiling with config below produces linking errors:
Quoted 7 lines
arch/i386/lib/lib.a(usercopy.o): In function `__copy_to_user_ll':
usercopy.o(.text+0x279): undefined reference tomovsl_mask' arch/i386/lib/lib.a(usercopy.o): In function__copy_from_user_ll':usercopy.o(.text+0x2e9): undefined reference to `movsl_mask'.config:
...
Thanks for your report. I found the problem and I'll send an updated patch soon.
cu
Adrian
BTW: It's easier if you send the complete .config.
Signature · 4 lines
"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon SeedQuoted 2 lines · Adrian Bunk
This patch makes the bzImage for my computer (same .config, same compiler, same compiler options) a good 5 kB smaller.
For the invasiveness of the patch, 5KB really is a questionable gain..
Quoted 3 lines
In 2.4 selecting e.g. M486 has the semantics to get a kernel that runs on a 486 and above.
In 2.6 selecting M486 means that only the 486 is supported.
What are you basing this on ? This seems bogus to me. Last I checked, I could for eg, boot a 386 kernel on an Athlon.
arch/i386/Kconfig line 252
Quoted 7 lines
arch/i386/Kconfig renamed from arch/i386/Kconfig.old +2
-3+config CPU_VIAC3_2 bool "VIA C3-2 (Nehemiah)" help - Select this for a VIA C3 "Nehemiah". Selecting this enables usage - of SSE and tells gcc to treat the CPU as a 686. - Note, this kernel will not boot on older (pre model 9) C3s. + Select this for a VIA C3 "Nehemiah" (model 9 and above).
You lost an important part of helptext.
arch/i386/Kconfig line 281
Quoted 12 lines
arch/i386/Kconfig renamed from arch/i386/Kconfig.old +12
-0+config CPU_ONLY_K7 + bool + depends on CPU_K7 && !CPU_INTEL && !CPU_K6 && !CPU_K8 && !X86_ELAN && !CPU_CRUSOE && !CPU_WINCHIP && !CPU_CYRIXIII && !CPU_VIAC3_2 + +config CPU_ONLY_K8 + bool + depends on CPU_K8 && !CPU_INTEL && !CPU_K6 && !CPU_K7 && !X86_ELAN && !CPU_CRUSOE && !CPU_WINCHIP && !CPU_CYRIXIII && !CPU_VIAC3_2 + +config CPU_ONLY_WINCHIP + bool + depends on CPU_WINCHIP && !CPU_INTEL && !CPU_K6 && !CPU_K7 && !CPU_K8 && !X86_ELAN && !CPU_CRUSOE && !CPU_CYRIXIII && !CPU_VIAC3_2 + default y
These are hurrendous. Each time we add support for a new CPU we have to update each and every one of these. This won't fly, someone *WILL* miss one. We've had this sort of thing happen before, and its an accident waiting to happen.
arch/i386/Makefile line 42
Quoted 9 lines
arch/i386/Makefile renamed from arch/i386/Makefile.old +9
-0+ +ifdef CONFIG_CPU_K8 + ifdef CONFIG_CPU_PENTIUM4 + cpuflags-y := $(call check_gcc,-march=pentium3,-march=i686) + else + cpuflags-y := $(call check_gcc,-march=k8,$(call check_gcc,-march=athlon,-march=i686 $(align)-functions=4)) + endif +endif +
These horrible nesting things are also a real PITA, as theres >1 case that needs updating when something changes for a particular vendor/family. The cflags-$foo stuff in 2.6 was just starting to become readable, and you want to undo that?
arch/i386/lib/mmx.c line 127
Quoted 11 lines
arch/i386/lib/mmx.c renamed from arch/i386/lib/mmx.c.old +1
-1@@ -121,7 +121,7 @@return p; } -#ifdef CONFIG_MK7 +#ifndef CONFIG_CPU_CYRIXIII /* * The K7 has streaming cache bypass load/store. The Cyrix III, K6 and
wtf ?
Quoted 4 lines
arch/i386/mm/init.c renamed from arch/i386/mm/init.c.old +0
-0@@ -436,8 +436,12 @@if (!mem_map)
arch/i386/mm/init.c line 445
Quoted 10 lines
arch/i386/mm/init.c renamed from arch/i386/mm/init.c.old +5
-1BUG ();#endif - + +#ifdef CONFIG_CPU_686 bad_ppro =ppro_with_ram_bug (); +#else + bad_ppro =0 ; +#endif
If we boot a 386 kernel on a ppro with that bug, this goes bang.
Quoted 5 lines
arch/i386/mm/init.c renamed from arch/i386/mm/init.c.old +2
-0static void __init init_ifs (void ) { + +#if defined(CONFIG_CPU_K6 )amd_init_mtrr ();
arch/i386/mm/init.c
Quoted 10 lines
arch/i386/mm/init.c renamed from arch/i386/mm/init.c.old +8
-0+#endif + +#if defined(CONFIG_CPU_586 )cyrix_init_mtrr (); +#endif + +#if defined(CONFIG_CPU_WINCHIP ) || defined(CONFIG_CPU_CYRIXIII ) || defined(CONFIG_CPU_VIAC3_2 )centaur_init_mtrr (); +#endif +
For the handful of bytes saved in the mtrr driver, I'm more concerned about ifdef noise, and the fact that we don't have a compile once-run everywhere MTRR driver anymore unless you pick your options right
Dave
Signature · 1 line
Dave Jones http://www.codemonkey.org.uk
Quoted 6 lines · Dave Jones
Quoted 2 lines · Adrian Bunk
This patch makes the bzImage for my computer (same .config, same compiler, same compiler options) a good 5 kB smaller.
For the invasiveness of the patch, 5KB really is a questionable gain..
I should have stated that the arch/i386/kernel/cpu{,/mtrr}/Makefile parts are an example of what is possible with such a CPU selection schema.
I'll send a splitted patch where this is only an optional enhanchement.
Quoted 6 lines
Quoted 3 lines
In 2.4 selecting e.g. M486 has the semantics to get a kernel that runs on a 486 and above.
In 2.6 selecting M486 means that only the 486 is supported.What are you basing this on ? This seems bogus to me. Last I checked, I could for eg, boot a 386 kernel on an Athlon.
It currently works. The question is the exact semantics of X86_GENERIC. If you read the description of X86_GENERIC it implicitely says a kernel for a 386 isn't generic.
Quoted 9 lines
arch/i386/Kconfig line 252
Quoted 7 lines
arch/i386/Kconfig renamed from arch/i386/Kconfig.old +2
-3+config CPU_VIAC3_2 bool "VIA C3-2 (Nehemiah)" help - Select this for a VIA C3 "Nehemiah". Selecting this enables usage - of SSE and tells gcc to treat the CPU as a 686. - Note, this kernel will not boot on older (pre model 9) C3s. + Select this for a VIA C3 "Nehemiah" (model 9 and above).You lost an important part of helptext.
With the patch to the Makefile the "enables usage of SSE and tells gcc to treat the CPU as a 686" is only true if you don't compile support for older CPUs.
Quoted 15 lines
...
arch/i386/Makefile line 42
Quoted 9 lines
arch/i386/Makefile renamed from arch/i386/Makefile.old +9
-0+ +ifdef CONFIG_CPU_K8 + ifdef CONFIG_CPU_PENTIUM4 + cpuflags-y := $(call check_gcc,-march=pentium3,-march=i686) + else + cpuflags-y := $(call check_gcc,-march=k8,$(call check_gcc,-march=athlon,-march=i686 $(align)-functions=4)) + endif +endif +These horrible nesting things are also a real PITA, as theres >1 case that needs updating when something changes for a particular vendor/family. The cflags-$foo stuff in 2.6 was just starting to become readable, and you want to undo that?
The idea is to move the question "Which CPU option supports bot an Athlon and a Pentium 4?" from the user to the kernel. The user no longer has to take care of this, he simply selects all CPUs he wants to support.
Quoted 6 lines
Quoted 6 lines
arch/i386/lib/mmx.c renamed from arch/i386/lib/mmx.c.old +0
-0@@ -121,7 +121,7 @@return p; }
Quoted 7 lines
arch/i386/lib/mmx.c line 127
Quoted 5 lines
arch/i386/lib/mmx.c renamed from arch/i386/lib/mmx.c.old +1
-1-#ifdef CONFIG_MK7 +#ifndef CONFIG_CPU_CYRIXIII /* * The K7 has streaming cache bypass load/store. The Cyrix III, K6 and wtf ?
It's logical considering the dependencies of X86_USE_3DNOW.
But thinking about it a second time, it seems a CONFIG_CPU_ONLY_K7 does the same and is less error prone.
Quoted 8 lines
Quoted 8 lines
arch/i386/mm/init.c renamed from arch/i386/mm/init.c.old +1
-1@@ -436,8 +436,12 @@if (!mem_map)BUG ();#endif - +
Quoted 8 lines
arch/i386/mm/init.c line 445
Quoted 6 lines
arch/i386/mm/init.c renamed from arch/i386/mm/init.c.old +4
-0+#ifdef CONFIG_CPU_686 bad_ppro =ppro_with_ram_bug (); +#else + bad_ppro =0 ; +#endif If we boot a 386 kernel on a ppro with that bug, this goes bang.
ppro_with_ram_bug checks for one specific ppro bug. On a 386 this funtion returns 0.
This is part of the (optional) part of this patch that selects only the needed parts in arch/i386/kernel/cpu/Makefile. When compiling a kernel without any support for Intel CPUs I got a linker error. It could be CONFIG_CPU_INTEL (since that's when arch/i386/kernel/cpu/intel.c gets compiled) but since this function returns 1 only for some ppro's I've optimized it to ppro_with_ram_bug.
Quoted 11 lines
Quoted 11 lines
arch/i386/mm/init.c renamed from arch/i386/mm/init.c.old +7
-0static void __init init_ifs (void ) { + +#if defined(CONFIG_CPU_K6 )amd_init_mtrr (); +#endif + +#if defined(CONFIG_CPU_586 )cyrix_init_mtrr (); +#endif +
Quoted 8 lines
arch/i386/mm/init.c
Quoted 4 lines
arch/i386/mm/init.c renamed from arch/i386/mm/init.c.old +3
-0+#if defined(CONFIG_CPU_WINCHIP ) || defined(CONFIG_CPU_CYRIXIII ) || defined(CONFIG_CPU_VIAC3_2 )centaur_init_mtrr (); +#endif +For the handful of bytes saved in the mtrr driver, I'm more concerned about ifdef noise, and the fact that we don't have a compile once-run everywhere MTRR driver anymore unless you pick your options right
You have a "compile once-run everywhere MTRR driver" if you select all CPUs.
As stated above, this isn't part of the core patch.
Quoted 1 line
Dave
cu
Adrian
Signature · 4 lines
"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon SeedQuoted 6 lines · Adrian Bunk
Quoted 4 lines
Quoted 1 line
In 2.6 selecting M486 means that only the 486 is supported.
What are you basing this on ? This seems bogus to me. Last I checked, I could for eg, boot a 386 kernel on an Athlon.
It currently works.
Exactly, then your first statement above is bogus.
Quoted 3 lines
The question is the exact semantics of
X86_GENERIC.
If you read the description ofX86_GENERICit implicitely says a kernel for a 386 isn't generic.
Apart from using incorrect cache line alignments on P4, an i386 kernel is no more, no less generic than one compiled with X86_GENERIC
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
arch/i386/Kconfig renamed from arch/i386/Kconfig.old +2
-3+config CPU_VIAC3_2 bool "VIA C3-2 (Nehemiah)" help - Select this for a VIA C3 "Nehemiah". Selecting this enables usage - of SSE and tells gcc to treat the CPU as a 686. - Note, this kernel will not boot on older (pre model 9) C3s. + Select this for a VIA C3 "Nehemiah" (model 9 and above).
Quoted 4 lines
Quoted 1 line
You lost an important part of helptext.
With the patch to the
Makefilethe "enables usage of SSE and tells gcc to treat the CPU as a 686" is only true if you don't compile support for older CPUs.
Incidentally, looking closer you broke this option.
+ifdef CONFIG_CPU_VIAC3_2
+ cpuflags-y := $(call check_gcc,-march=c3,-march=i686) +endif
Its C3_2 becauase it needs -march=c3-2 to use SSE instead of 3dnow prefetches. One thing that just occured to me, it may be possible to dispose of this option completley now that Andi's runtime patching code is in. If I get time I'll take a look at that.
Quoted 14 lines
Quoted 5 lines
Quoted 5 lines
arch/i386/Makefile renamed from arch/i386/Makefile.old +5
-0+ifdef CONFIG_CPU_K8 + ifdef CONFIG_CPU_PENTIUM4 + cpuflags-y := $(call check_gcc,-march=pentium3,-march=i686) + else + cpuflags-y := $(call check_gcc,-march=k8,$(call check_gcc,-march=athlon,-march=i686 $(align)-functions=4))Quoted 8 lines
arch/i386/Makefile line 42
Quoted 3 lines
arch/i386/Makefile renamed from arch/i386/Makefile.old +3
-0+ endif +endif +These horrible nesting things are also a real PITA, as theres >1 case that needs updating when something changes for a particular vendor/family. The cflags-$foo stuff in 2.6 was just starting to become readable, and you want to undo that?
Quoted 4 lines
The idea is to move the question "Which CPU option supports bot an Athlon and a Pentium 4?" from the user to the kernel. The user no longer has to take care of this, he simply selects all CPUs he wants to support.
That should be solved using CONFIG_X86_GENERIC, not fuglifying the Makefiles. Seriously, I think this is completely the wrong approach. Seriously, how many mails does l-k get of people saying, "Oh duh, my no booting kernel was because I chose to compile for Athlon, and I have a Pentium 4" or the likes? This seems to be a solution in search of a problem.
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
arch/i386/lib/mmx.c renamed from arch/i386/lib/mmx.c.old +1
-1-#ifdef CONFIG_MK7 +#ifndef CONFIG_CPU_CYRIXIII /* * The K7 has streaming cache bypass load/store. The Cyrix III, K6 and
Quoted 6 lines
Quoted 1 line
wtf ?
It's logical considering the dependencies of
X86_USE_3DNOW.But thinking about it a second time, it seems a
CONFIG_CPU_ONLY_K7does the same and is less error prone.
X86_USE_3DNOW would seem more logical to me. I never checked if this was a win on C3, but as that also has 3dnow its possibly worth looking into.
Quoted 15 lines
Quoted 15 lines
Quoted 14 lines
arch/i386/mm/init.c renamed from arch/i386/mm/init.c.old +5
-1@@ -436,8 +436,12 @@if (!mem_map)BUG ();#endif - + +#ifdef CONFIG_CPU_686 bad_ppro =ppro_with_ram_bug (); +#else + bad_ppro =0 ; +#endif
Quoted 4 lines
Quoted 1 line
If we boot a 386 kernel on a ppro with that bug, this goes bang.
ppro_with_ram_bugchecks for one specific ppro bug. On a 386 this funtion returns 0.
I'm not talking about running it on a 386. I'm talking about running a kernel _compiled as 386_, on a PPro which has the bug this fixes. With your patch, this code does nothing, and the bug doesn't get worked around. Currently, it does the right thing. You're saving a half dozen or so bytes, and making things like vendor boot kernels (typically compiled as 386) not perform a necessary errata workaround. And "You can select 486/586/686 too" is not an answer. These kernels need to be small, and errata workarounds should NEVER be compiled out for exactly this reason.
Quoted 16 lines
Quoted 16 lines
Quoted 15 lines
arch/i386/mm/init.c renamed from arch/i386/mm/init.c.old +10
-0static void __init init_ifs (void ) { + +#if defined(CONFIG_CPU_K6 )amd_init_mtrr (); +#endif + +#if defined(CONFIG_CPU_586 )cyrix_init_mtrr (); +#endif + +#if defined(CONFIG_CPU_WINCHIP ) || defined(CONFIG_CPU_CYRIXIII ) || defined(CONFIG_CPU_VIAC3_2 )centaur_init_mtrr (); +#endif +
Quoted 6 lines
Quoted 3 lines
For the handful of bytes saved in the mtrr driver, I'm more concerned about ifdef noise, and the fact that we don't have a compile once-run everywhere MTRR driver anymore unless you pick your options right
You have a "compile once-run everywhere MTRR driver" if you select all CPUs.
That doesn't solve the 'looks ugly as all hell' problem.
Dave
Signature · 1 line
Dave Jones http://www.codemonkey.org.uk
Quoted 10 lines · Dave Jones
Quoted 6 lines · Adrian Bunk
Quoted 4 lines
Quoted 1 line
In 2.6 selecting M486 means that only the 486 is supported.
What are you basing this on ? This seems bogus to me. Last I checked, I could for eg, boot a 386 kernel on an Athlon.
It currently works.
Exactly, then your first statement above is bogus.
It was a leftover from a first version where I had a misunderstanding regarding the exact effects of X86_L1_CACHE_SHIFT.
If it should continue to work as it currently works the description "Generic x86 support" is _very_ misleading.
What does a user think on which machines a kernel will run after he enabled the following options?
- "Athlon/Duron/K7"
- "Generic x86 support"
Quoted 6 lines
Quoted 3 lines
The question is the exact semantics of
X86_GENERIC.
If you read the description ofX86_GENERICit implicitely says a kernel for a 386 isn't generic.Apart from using incorrect cache line alignments on P4, an i386 kernel is no more, no less generic than one compiled with
X86_GENERIC
plus X86_INTEL_USERCOPY
Quoted 19 lines
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
arch/i386/Kconfig renamed from arch/i386/Kconfig.old +2
-3+config CPU_VIAC3_2 bool "VIA C3-2 (Nehemiah)" help - Select this for a VIA C3 "Nehemiah". Selecting this enables usage - of SSE and tells gcc to treat the CPU as a 686. - Note, this kernel will not boot on older (pre model 9) C3s. + Select this for a VIA C3 "Nehemiah" (model 9 and above).Quoted 4 lines
Quoted 1 line
You lost an important part of helptext.
With the patch to the
Makefilethe "enables usage of SSE and tells gcc to treat the CPU as a 686" is only true if you don't compile support for older CPUs.Incidentally, looking closer you broke this option.
arch/i386/Makefile renamed from arch/i386/Makefile.old +3
-0+ifdef CONFIG_CPU_VIAC3_2 + cpuflags-y := $(call check_gcc,-march=c3,-march=i686) +endif
Quoted 3 lines
Its
C3_2becauase it needs -march=c3-2 to use SSE instead of 3dnow prefetches. One thing that just occured to me, it may be possible
...
Which gcc does support -march=c3-2 ? gcc 3.3.1 doesn't support it.
That's the reason why I changed this -march setting (as noted in my changelog).
Quoted 9 lines
...
Quoted 8 lines
Quoted 7 lines
arch/i386/lib/mmx.c line 127
Quoted 5 lines
arch/i386/lib/mmx.c renamed from arch/i386/lib/mmx.c.old +1
-1-#ifdef CONFIG_MK7 +#ifndef CONFIG_CPU_CYRIXIII /* * The K7 has streaming cache bypass load/store. The Cyrix III, K6 and wtf ?
Quoted 7 lines
Quoted 4 lines
It's logical considering the dependencies of
X86_USE_3DNOW.But thinking about it a second time, it seems a
CONFIG_CPU_ONLY_K7does the same and is less error prone.
X86_USE_3DNOWwould seem more logical to me. I never checked if this was a win on C3, but as that also has 3dnow its possibly worth looking into.
Current -test5 (without my patch) has
config X86_USE_3DNOW
bool
depends on MCYRIXIII || MK7
default yThis #ifdef is there to differenciate between the K7 and the generic MMX implementation.
Quoted 20 lines
Quoted 15 lines
Quoted 15 lines
Quoted 14 lines
arch/i386/mm/init.c renamed from arch/i386/mm/init.c.old +5
-1@@ -436,8 +436,12 @@if (!mem_map)BUG ();#endif - + +#ifdef CONFIG_CPU_686 bad_ppro =ppro_with_ram_bug (); +#else + bad_ppro =0 ; +#endif Quoted 4 lines
Quoted 1 line
If we boot a 386 kernel on a ppro with that bug, this goes bang.
ppro_with_ram_bugchecks for one specific ppro bug. On a 386 this funtion returns 0.
Quoted 6 lines
I'm not talking about running it on a 386. I'm talking about running a kernel
_compiledas 386_, on a PPro which has the bug this fixes. With your patch, this code does nothing, and the bug doesn't get worked around. Currently, it does the right thing. You're saving a half dozen or so bytes, and making things like vendor boot kernels (typically compiled as 386) not perform a necessary errata workaround.
Well, this is an optional part of my patch. It will be splitted from the main part.
Quoted 4 lines
And "You can select 486/586/686 too" is not an answer. These kernels need to be small, and errata workarounds should NEVER be compiled out for exactly this reason.
...
Why is a kernel compiled with support for all CPUs necessarily much bigger than a current M386 kernel?
OTOH, why waste space on a 486 for 3DNow! support?
Quoted 1 line
Dave
cu
Adrian
Signature · 4 lines
"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon SeedQuoted 4 lines · Adrian Bunk
What does a user think on which machines a kernel will run after he enabled the following options?
- "Athlon/Duron/K7"
- "Generic x86 support"
Currently, as you can only choose one of them, it should be obvious. With your 'you can choose n number of options' patch, it becomes confusing why there is a generic option at all.
Quoted 5 lines
Quoted 4 lines
Quoted 2 lines
If you read the description of
X86_GENERICit implicitely says a kernel for a 386 isn't generic.Apart from using incorrect cache line alignments on P4, an i386 kernel is no more, no less generic than one compiled with
X86_GENERICplus
X86_INTEL_USERCOPY
Sure, but that still doesn't prevent it being used on any system as a generic kernel.
Quoted 11 lines
Quoted 9 lines
Incidentally, looking closer you broke this option.
arch/i386/Makefile renamed from arch/i386/Makefile.old +3
-0+ifdef CONFIG_CPU_VIAC3_2 + cpuflags-y := $(call check_gcc,-march=c3,-march=i686) +endifIts
C3_2becauase it needs -march=c3-2 to use SSE instead of 3dnow prefetches. One thing that just occured to me, it may be possible
...Which gcc does support -march=c3-2 ? gcc 3.3.1 doesn't support it.
the 3.3.2 and 3.4 branches have it.
Quoted 6 lines
Quoted 4 lines
And "You can select 486/586/686 too" is not an answer. These kernels need to be small, and errata workarounds should NEVER be compiled out for exactly this reason.
...Why is a kernel compiled with support for all CPUs necessarily much bigger than a current M386 kernel?
Adding in stuff like cpu specific memory copy routines for example. There have been several cases where vendors haven't been able to squeeze a boot kernel onto a CD by 40 or so bytes in the past, leading to a last minute scavenge to try and reclaim that space. Every little helps.
Quoted 1 line
OTOH, why waste space on a 486 for 3DNow! support?
I'm arguing for errata workarounds, not extended support.
Dave
Signature · 1 line
Dave Jones http://www.codemonkey.org.uk
Quoted 10 lines · Dave Jones
Quoted 4 lines · Adrian Bunk
What does a user think on which machines a kernel will run after he enabled the following options?
- "Athlon/Duron/K7"
- "Generic x86 support"Currently, as you can only choose one of them, it should be obvious. With your 'you can choose n number of options' patch, it becomes confusing why there is a generic option at all.
No, currently you first choose the CPU. This CPU selection selects most settings like the CPU features (e.g. enables X86_F00F_BUG) and the gcc optimization flags.
The "Generic x86 support" question is asked later.
My patch removes the generic option since it's no longer needed.
Quoted 7 lines
...
Quoted 6 lines
Quoted 6 lines
Incidentally, looking closer you broke this option.
arch/i386/Makefile renamed from arch/i386/Makefile.old +3
-0+ifdef CONFIG_CPU_VIAC3_2 + cpuflags-y := $(call check_gcc,-march=c3,-march=i686) +endif
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Its
C3_2becauase it needs -march=c3-2 to use SSE instead of 3dnow prefetches. One thing that just occured to me, it may be possible
...Which gcc does support -march=c3-2 ? gcc 3.3.1 doesn't support it.
the 3.3.2 and 3.4 branches have it.
Ah I didn't know that. The 20030831 snapshot of the 3.3 branch in Debian unstable was the latest gcc I checked.
Quoted 7 lines
Quoted 6 lines
Quoted 4 lines
And "You can select 486/586/686 too" is not an answer. These kernels need to be small, and errata workarounds should NEVER be compiled out for exactly this reason.
...Why is a kernel compiled with support for all CPUs necessarily much bigger than a current M386 kernel?
Quoted 8 lines
Adding in stuff like cpu specific memory copy routines for example. There have been several cases where vendors haven't been able to squeeze a boot kernel onto a CD by 40 or so bytes in the past, leading to a last minute scavenge to try and reclaim that space. Every little helps.
Quoted 1 line
OTOH, why waste space on a 486 for 3DNow! support?
I'm arguing for errata workarounds, not extended support.
I'll send the cpu selection patch with the arch/i386/kernel/cpu/ and arch/i386/kernel/cpu/mtrr/ stuff as separate patches.
Quoted 1 line
Dave
cu
Adrian
Signature · 4 lines
"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon SeedQuoted 7 lines · Dave Jones
Quoted 4 lines
In 2.4 selecting e.g. M486 has the semantics to get a kernel that runs on a 486 and above.
In 2.6 selecting M486 means that only the 486 is supported.What are you basing this on ? This seems bogus to me. Last I checked, I could for eg, boot a 386 kernel on an Athlon.
If you know that you're only booting on a 486, why include all the junk needed solely for later processors?
Quoted 10 lines
Quoted 10 lines
arch/i386/Kconfig renamed from arch/i386/Kconfig.old +9
-0+config CPU_ONLY_K7 + bool + depends on CPU_K7 && !CPU_INTEL && !CPU_K6 && !CPU_K8 && !X86_ELAN && !CPU_CRUSOE && !CPU_WINCHIP && !CPU_CYRIXIII && !CPU_VIAC3_2 + +config CPU_ONLY_K8 + bool + depends on CPU_K8 && !CPU_INTEL && !CPU_K6 && !CPU_K7 && !X86_ELAN && !CPU_CRUSOE && !CPU_WINCHIP && !CPU_CYRIXIII && !CPU_VIAC3_2 + +config CPU_ONLY_WINCHIP
Quoted 8 lines
arch/i386/Kconfig line 281
Quoted 3 lines
arch/i386/Kconfig renamed from arch/i386/Kconfig.old +3
-0+ bool + depends on CPU_WINCHIP && !CPU_INTEL && !CPU_K6 && !CPU_K7 && !CPU_K8 && !X86_ELAN && !CPU_CRUSOE && !CPU_CYRIXIII && !CPU_VIAC3_2 + default yThese are hurrendous. Each time we add support for a new CPU we have to update each and every one of these. This won't fly, someone *WILL* miss one. We've had this sort of thing happen before, and its an accident waiting to happen.
Agreed
Quoted 8 lines
Quoted 8 lines
arch/i386/mm/init.c renamed from arch/i386/mm/init.c.old +1
-1@@ -436,8 +436,12 @@if (!mem_map)BUG ();#endif - +
Quoted 8 lines
arch/i386/mm/init.c line 445
Quoted 6 lines
arch/i386/mm/init.c renamed from arch/i386/mm/init.c.old +4
-0+#ifdef CONFIG_CPU_686 bad_ppro =ppro_with_ram_bug (); +#else + bad_ppro =0 ; +#endif If we boot a 386 kernel on a ppro with that bug, this goes bang.
Echo my first comment. I think it's fair to make this stuff fine-grained -- as long as present behavior is preserved. So IMO fine-grained "I really want this cpu, and this cpu only" stuff really requires a dependency on CONFIG_EMBEDDED. When !CONFIG_EMBEDDED, for example, it would define CONFIG_CPU_686 to ensure the required 686 pieces were in place.
I like the general direction of Adrian's patch, and think that moving in this direction will provide a lot of hidden maintenance _benefits_ after the initial pain... But. Adrian's patch is a tough thing to get right, and IMO requires a lot of testing.
Quoted 11 lines
Quoted 11 lines
arch/i386/mm/init.c renamed from arch/i386/mm/init.c.old +7
-0static void __init init_ifs (void ) { + +#if defined(CONFIG_CPU_K6 )amd_init_mtrr (); +#endif + +#if defined(CONFIG_CPU_586 )cyrix_init_mtrr (); +#endif +
Quoted 8 lines
arch/i386/mm/init.c
Quoted 4 lines
arch/i386/mm/init.c renamed from arch/i386/mm/init.c.old +3
-0+#if defined(CONFIG_CPU_WINCHIP ) || defined(CONFIG_CPU_CYRIXIII ) || defined(CONFIG_CPU_VIAC3_2 )centaur_init_mtrr (); +#endif +For the handful of bytes saved in the mtrr driver, I'm more concerned about ifdef noise, and the fact that we don't have a compile once-run everywhere MTRR driver anymore unless you pick your options right
The arch/i386/kernel/cpu stuff is so modular, code like the above just screams for an ->init_mtrr() hook in there. drivers/char/hw_random.c (portably) depends on VIA RNG's xstore instruction, which implies a dependency on code and settings in arch/i386/*. So, there's nothing fundamentally wrong with sticking your fingers in there, IMO...
Jeff
Quoted 9 lines · Jeff Garzik
Quoted 6 lines
Quoted 3 lines
In 2.4 selecting e.g. M486 has the semantics to get a kernel that runs on a 486 and above.
In 2.6 selecting M486 means that only the 486 is supported.What are you basing this on ? This seems bogus to me. Last I checked, I could for eg, boot a 386 kernel on an Athlon.
If you know that you're only booting on a 486, why include all the junk needed solely for later processors?
Reread. a kernel _compiled for 386_
Precisely what junk do you mean ?
Quoted 2 lines
Quoted 1 line
If we boot a 386 kernel on a ppro with that bug, this goes bang.
Echo my first comment.
Echo 2 lines above. People do use 386 kernels for install kernels on distros. Removing errata workarounds means distros start randomly exploding during installs.
Dave
Signature · 1 line
Dave Jones http://www.codemonkey.org.uk
Quoted 15 lines · Dave Jones
Quoted 9 lines · Jeff Garzik
Quoted 6 lines
Quoted 3 lines
In 2.4 selecting e.g. M486 has the semantics to get a kernel that runs on a 486 and above.
In 2.6 selecting M486 means that only the 486 is supported.What are you basing this on ? This seems bogus to me. Last I checked, I could for eg, boot a 386 kernel on an Athlon.
If you know that you're only booting on a 486, why include all the junk needed solely for later processors?
Reread. a kernel
_compiledfor 386_
Precisely what junk do you mean ?
Quoted 6 lines
Quoted 2 lines
Quoted 1 line
If we boot a 386 kernel on a ppro with that bug, this goes bang.
Echo my first comment.
Echo 2 lines above. People do use 386 kernels for install kernels on distros. Removing errata workarounds means distros start randomly exploding during installs.
You're not understanding the model. I understand your comment about using 386 kernels for install kernels. If Adrian's patch is done right, _absolutely nothing should change_ in your described scenario.
Distros would continue doing what they've always done, and would continue to get the behavior they have always gotten.
Unless you're a power user and select CONFIG_EMBEDDED, of course. Then behavior changes.
Jeff
Quoted 3 lines · Jeff Garzik
You're not understanding the model. I understand your comment about using 386 kernels for install kernels. If Adrian's patch is done right,
_absolutelynothing shouldchange_in your described scenario.
Duh sorry - althoug Im unconvinced the ifdef explosion is worth it for the tiny ones (the few hundred byte workarounds)
Quoted 5 lines · Jeff Garzik
Quoted 4 lines
Echo 2 lines above. People do use 386 kernels for install kernels on distros. Removing errata workarounds means distros start randomly exploding during installs.
Quoted 7 lines
You're not understanding the model. I understand your comment about using 386 kernels for install kernels. If Adrian's patch is done right,
_absolutelynothing shouldchange_in your described scenario.Distros would continue doing what they've always done, and would continue to get the behavior they have always gotten.
...
I'm not sure whether you understand my intention.
Nothing will change, except that if you want to support all CPUs, you have to select all CPUs instead of 386.
My main intention is to get a clear user interface (user = person compiling the kernel) that suits everyone's needs and to put all the logic what to do when you plan to support several different CPUs into the kernel.
I don't like the current user interface that says "if you want to support both an Athlon and a Pentium 4 in your kernel use the Pentium III option. And for better optimization, also check the "generic" option".
Quoted 1 line
Jeff
cu
Adrian
Signature · 4 lines
"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon SeedQuoted 3 lines · Adrian Bunk
I'm not sure whether you understand my intention.
Nothing will change, except that if you want to support all CPUs, you have to select all CPUs instead of 386.
This is incorrect. You don't want to change the behavior that people are relying on. I wasn't describing your intentions, I was describing what you _should_ do ;-)
Jeff
Quoted 2 lines · Jeff Garzik
If you know that you're only booting on a 486, why include all the junk needed solely for later processors?
Because its a nightmare to provide a billion CPU specific kernels, a set of foo and higher kernels and a "generic kernel", then do it for each platform 2.6 supports for x86, then test it.
The submission already looks like something out of a puzzle book