From patchwork Sat Jan 16 03:07:06 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yinghai Lu X-Patchwork-Id: 73300 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.2) with ESMTP id o0G39erq009827 for ; Sat, 16 Jan 2010 03:09:41 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754412Ab0APDJK (ORCPT ); Fri, 15 Jan 2010 22:09:10 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1758867Ab0APDIx (ORCPT ); Fri, 15 Jan 2010 22:08:53 -0500 Received: from sca-es-mail-2.Sun.COM ([192.18.43.133]:33987 "EHLO sca-es-mail-2.sun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758865Ab0APDIZ (ORCPT ); Fri, 15 Jan 2010 22:08:25 -0500 Received: from fe-sfbay-09.sun.com ([192.18.43.129]) by sca-es-mail-2.sun.com (8.13.7+Sun/8.12.9) with ESMTP id o0G38ORa004128; Fri, 15 Jan 2010 19:08:24 -0800 (PST) MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: TEXT/PLAIN Received: from conversion-daemon.fe-sfbay-09.sun.com by fe-sfbay-09.sun.com (Sun Java(tm) System Messaging Server 7u2-7.04 64bit (built Jul 2 2009)) id <0KWB00200KGLMS00@fe-sfbay-09.sun.com>; Fri, 15 Jan 2010 19:08:24 -0800 (PST) Received: from localhost.localdomain ([unknown] [10.6.76.26]) by fe-sfbay-09.sun.com (Sun Java(tm) System Messaging Server 7u2-7.04 64bit (built Jul 2 2009)) with ESMTPSA id <0KWB0014HKPN5B10@fe-sfbay-09.sun.com>; Fri, 15 Jan 2010 19:08:21 -0800 (PST) Date: Fri, 15 Jan 2010 19:07:06 -0800 From: Yinghai Lu Subject: [PATCH 35/37] x86: according to nr_cpu_ids to decide if need to leave logical flat In-reply-to: <1263611228-6751-1-git-send-email-yinghai@kernel.org> To: Ingo Molnar , Thomas Gleixner , "H. Peter Anvin" , Andrew Morton , Jesse Barnes , Christoph Lameter Cc: linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, Yinghai Lu Message-id: <1263611228-6751-36-git-send-email-yinghai@kernel.org> X-Mailer: git-send-email 1.6.4.2 References: <1263611228-6751-1-git-send-email-yinghai@kernel.org> Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c index c5f4906..b4f47c5 100644 --- a/arch/x86/kernel/apic/apic.c +++ b/arch/x86/kernel/apic/apic.c @@ -1647,9 +1647,7 @@ int __init APIC_init_uniprocessor(void) #endif enable_IR_x2apic(); -#ifdef CONFIG_X86_64 default_setup_apic_routing(); -#endif verify_local_APIC(); connect_bsp_APIC(); diff --git a/arch/x86/kernel/apic/probe_32.c b/arch/x86/kernel/apic/probe_32.c index 1a6559f..d657558 100644 --- a/arch/x86/kernel/apic/probe_32.c +++ b/arch/x86/kernel/apic/probe_32.c @@ -52,7 +52,7 @@ static int __init print_ipi_mode(void) } late_initcall(print_ipi_mode); -void default_setup_apic_routing(void) +static void local_default_setup_apic_routing(void) { #ifdef CONFIG_X86_IO_APIC printk(KERN_INFO @@ -103,7 +103,7 @@ struct apic apic_default = { .init_apic_ldr = default_init_apic_ldr, .ioapic_phys_id_map = default_ioapic_phys_id_map, - .setup_apic_routing = default_setup_apic_routing, + .setup_apic_routing = local_default_setup_apic_routing, .multi_timer_check = NULL, .apicid_to_node = default_apicid_to_node, .cpu_to_logical_apicid = default_cpu_to_logical_apicid, @@ -212,6 +212,22 @@ void __init generic_bigsmp_probe(void) #endif } +void __init default_setup_apic_routing(void) +{ +#ifdef CONFIG_X86_BIGSMP + /* + * make sure we go to bigsmp according to real nr_cpu_ids + */ + if (!cmdline_apic && apic == &apic_default) { + if (nr_cpu_ids > 8) { + apic = &apic_bigsmp; + printk(KERN_INFO "Overriding APIC driver with %s\n", + apic->name); + } + } +#endif +} + void __init generic_apic_probe(void) { if (!cmdline_apic) { diff --git a/arch/x86/kernel/apic/probe_64.c b/arch/x86/kernel/apic/probe_64.c index 0a428dd..7163cf8 100644 --- a/arch/x86/kernel/apic/probe_64.c +++ b/arch/x86/kernel/apic/probe_64.c @@ -67,7 +67,8 @@ void __init default_setup_apic_routing(void) } #endif - if (apic == &apic_flat && num_processors > 8) + /* not just num_processors, we could have hotplug cpus */ + if (apic == &apic_flat && nr_cpu_ids > 8) apic = &apic_physflat; printk(KERN_INFO "Setting APIC routing to %s\n", apic->name); diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c index eff2fe1..96f5f40 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c @@ -1083,9 +1083,7 @@ void __init native_smp_prepare_cpus(unsigned int max_cpus) set_cpu_sibling_map(0); enable_IR_x2apic(); -#ifdef CONFIG_X86_64 default_setup_apic_routing(); -#endif if (smp_sanity_check(max_cpus) < 0) { printk(KERN_INFO "SMP disabled\n");