From: Venkatesh Pallipadi Today, bigsmp mode is only detected with special oem dmi string or a boot option. This patch makes the selection of bigsmp automatic, whenever there are more 8 CPUs and xAPIC (APIC version 0x14) is supported. This patch should only affect systems with more than 8 logical CPUs that doesn't belong to any other special sub-archs. The same issue was also discussed around a year back: http://www.ussg.iu.edu/hypermail/linux/kernel/0408.0/1679.html where I had posted a slightly different patch from the one below and that patch did not go anywhere. The patch below is cleaner than the one in above link. i386 generic subarchitecture requires explicit dmi strings or command line to enable bigsmp mode. The patch below removes that restriction, and uses bigsmp as soon as it finds more than 8 logical CPUs and xAPIC support. Signed-off-by: Venkatesh Pallipadi Signed-off-by: Andrew Morton --- arch/i386/kernel/acpi/boot.c | 2 -- arch/i386/kernel/mpparse.c | 8 +++++++- arch/i386/kernel/setup.c | 16 +++++++++++++--- arch/i386/mach-generic/bigsmp.c | 5 ++++- arch/i386/mach-generic/probe.c | 4 ++-- include/asm-i386/apicdef.h | 1 + include/asm-i386/mpspec.h | 1 + 7 files changed, 28 insertions(+), 9 deletions(-) diff -puN arch/i386/kernel/acpi/boot.c~x86-automatically-enable-bigsmp-when-we-have-more-than-8-cpus arch/i386/kernel/acpi/boot.c --- devel/arch/i386/kernel/acpi/boot.c~x86-automatically-enable-bigsmp-when-we-have-more-than-8-cpus 2005-07-28 12:08:38.000000000 -0700 +++ devel-akpm/arch/i386/kernel/acpi/boot.c 2005-07-28 12:08:38.000000000 -0700 @@ -41,7 +41,6 @@ #ifdef CONFIG_X86_64 static inline void acpi_madt_oem_check(char *oem_id, char *oem_table_id) { } -extern void __init clustered_apic_check(void); static inline int ioapic_setup_disabled(void) { return 0; } #include @@ -847,7 +846,6 @@ acpi_process_madt(void) acpi_ioapic = 1; smp_found_config = 1; - clustered_apic_check(); } } if (error == -EINVAL) { diff -puN arch/i386/kernel/mpparse.c~x86-automatically-enable-bigsmp-when-we-have-more-than-8-cpus arch/i386/kernel/mpparse.c --- devel/arch/i386/kernel/mpparse.c~x86-automatically-enable-bigsmp-when-we-have-more-than-8-cpus 2005-07-28 12:08:38.000000000 -0700 +++ devel-akpm/arch/i386/kernel/mpparse.c 2005-07-28 12:08:38.000000000 -0700 @@ -65,6 +65,8 @@ int nr_ioapics; int pic_mode; unsigned long mp_lapic_addr; +unsigned int def_to_bigsmp = 0; + /* Processor that is doing the boot up */ unsigned int boot_cpu_physical_apicid = -1U; /* Internal processor count */ @@ -213,6 +215,11 @@ static void __init MP_processor_info (st ver = 0x10; } apic_version[m->mpc_apicid] = ver; + if ((num_processors > 8) && APIC_XAPIC(ver)) + def_to_bigsmp = 1; + else + def_to_bigsmp = 0; + bios_cpu_apicid[num_processors - 1] = m->mpc_apicid; } @@ -479,7 +486,6 @@ static int __init smp_read_mpc(struct mp } ++mpc_record; } - clustered_apic_check(); if (!num_processors) printk(KERN_ERR "SMP mptable: no processors registered!\n"); return num_processors; diff -puN arch/i386/kernel/setup.c~x86-automatically-enable-bigsmp-when-we-have-more-than-8-cpus arch/i386/kernel/setup.c --- devel/arch/i386/kernel/setup.c~x86-automatically-enable-bigsmp-when-we-have-more-than-8-cpus 2005-07-28 12:08:38.000000000 -0700 +++ devel-akpm/arch/i386/kernel/setup.c 2005-07-28 12:08:38.000000000 -0700 @@ -60,6 +60,11 @@ #include "setup_arch_pre.h" #include +#ifdef CONFIG_X86_LOCAL_APIC +#include +#include +#endif /* CONFIG_X86_LOCAL_APIC */ + /* Forward Declaration. */ void __init find_max_pfn(void); @@ -1573,9 +1578,6 @@ void __init setup_arch(char **cmdline_p) dmi_scan_machine(); -#ifdef CONFIG_X86_GENERICARCH - generic_apic_probe(*cmdline_p); -#endif if (efi_enabled) efi_map_memmap(); @@ -1592,6 +1594,14 @@ void __init setup_arch(char **cmdline_p) get_smp_config(); #endif +#ifdef CONFIG_X86_GENERICARCH + generic_apic_probe(*cmdline_p); +#endif + +#ifdef CONFIG_X86_LOCAL_APIC + clustered_apic_check(); +#endif + register_memory(); #ifdef CONFIG_VT diff -puN arch/i386/mach-generic/bigsmp.c~x86-automatically-enable-bigsmp-when-we-have-more-than-8-cpus arch/i386/mach-generic/bigsmp.c --- devel/arch/i386/mach-generic/bigsmp.c~x86-automatically-enable-bigsmp-when-we-have-more-than-8-cpus 2005-07-28 12:08:38.000000000 -0700 +++ devel-akpm/arch/i386/mach-generic/bigsmp.c 2005-07-28 12:08:38.000000000 -0700 @@ -47,7 +47,10 @@ static struct dmi_system_id __initdata b static __init int probe_bigsmp(void) { - dmi_check_system(bigsmp_dmi_table); + if (def_to_bigsmp) + dmi_bigsmp = 1; + else + dmi_check_system(bigsmp_dmi_table); return dmi_bigsmp; } diff -puN arch/i386/mach-generic/probe.c~x86-automatically-enable-bigsmp-when-we-have-more-than-8-cpus arch/i386/mach-generic/probe.c --- devel/arch/i386/mach-generic/probe.c~x86-automatically-enable-bigsmp-when-we-have-more-than-8-cpus 2005-07-28 12:08:38.000000000 -0700 +++ devel-akpm/arch/i386/mach-generic/probe.c 2005-07-28 12:08:38.000000000 -0700 @@ -24,9 +24,9 @@ struct genapic *genapic = &apic_default; struct genapic *apic_probe[] __initdata = { &apic_summit, - &apic_bigsmp, &apic_es7000, - &apic_default, /* must be last */ + &apic_bigsmp, /* must be last but one */ + &apic_default, /* must be last */ NULL, }; diff -puN include/asm-i386/apicdef.h~x86-automatically-enable-bigsmp-when-we-have-more-than-8-cpus include/asm-i386/apicdef.h --- devel/include/asm-i386/apicdef.h~x86-automatically-enable-bigsmp-when-we-have-more-than-8-cpus 2005-07-28 12:08:38.000000000 -0700 +++ devel-akpm/include/asm-i386/apicdef.h 2005-07-28 12:08:38.000000000 -0700 @@ -16,6 +16,7 @@ #define GET_APIC_VERSION(x) ((x)&0xFF) #define GET_APIC_MAXLVT(x) (((x)>>16)&0xFF) #define APIC_INTEGRATED(x) ((x)&0xF0) +#define APIC_XAPIC(x) ((x) == 0x14) #define APIC_TASKPRI 0x80 #define APIC_TPRI_MASK 0xFF #define APIC_ARBPRI 0x90 diff -puN include/asm-i386/mpspec.h~x86-automatically-enable-bigsmp-when-we-have-more-than-8-cpus include/asm-i386/mpspec.h --- devel/include/asm-i386/mpspec.h~x86-automatically-enable-bigsmp-when-we-have-more-than-8-cpus 2005-07-28 12:08:38.000000000 -0700 +++ devel-akpm/include/asm-i386/mpspec.h 2005-07-28 12:08:38.000000000 -0700 @@ -11,6 +11,7 @@ extern int mp_bus_id_to_local [MAX_MP_BU extern int quad_local_to_mp_bus_id [NR_CPUS/4][4]; extern int mp_bus_id_to_pci_bus [MAX_MP_BUSSES]; +extern unsigned int def_to_bigsmp; extern unsigned int boot_cpu_physical_apicid; extern int smp_found_config; extern void find_smp_config (void); _