public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [patch 1/2] x86, apic: use physical mode for IBM summit platforms
@ 2010-01-18 20:10 Suresh Siddha
  2010-01-18 20:10 ` [patch 2/2] x86, apic: use logical flat for systems with <= 8 logical cpus Suresh Siddha
  0 siblings, 1 reply; 11+ messages in thread
From: Suresh Siddha @ 2010-01-18 20:10 UTC (permalink / raw)
  To: torvalds, hpa, mingo, tglx
  Cc: linux-kernel, Suresh Siddha, Chris McDermott,
	Ananth N Mavinakayanahalli, Yinghai Lu, stable

[-- Attachment #1: ibm_summit_oem_check_for_x64.patch --]
[-- Type: text/plain, Size: 1327 bytes --]

Chris McDermott from IBM confirmed that hurricane chipset in IBM summit
platforms doesn't support logical flat mode. Irrespective of the other things
like apic_id's, total number of logical cpu's, Linux kernel should default
to physical mode for this system. 32bit kernel does so using the OEM checks
for the IBM summit platform. Add a similar OEM platform check for the 64bit
kernel too. Otherwise the linux kernel boot can hang on this platform under
certain bios/platform settings.

Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
Tested-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Cc: Chris McDermott <lcm@linux.vnet.ibm.com>
Cc: Yinghai Lu <yinghai@kernel.org>
Cc: stable@kernel.org
---
 arch/x86/kernel/apic/apic_flat_64.c |    5 +++++
 1 file changed, 5 insertions(+)

Index: tip/arch/x86/kernel/apic/apic_flat_64.c
===================================================================
--- tip.orig/arch/x86/kernel/apic/apic_flat_64.c
+++ tip/arch/x86/kernel/apic/apic_flat_64.c
@@ -240,6 +240,11 @@ static int physflat_acpi_madt_oem_check(
 		printk(KERN_DEBUG "system APIC only can use physical flat");
 		return 1;
 	}
+
+	if (!strncmp(oem_id, "IBM", 3) && !strncmp(oem_table_id, "EXA", 3)) {
+		printk(KERN_DEBUG "IBM Summit detected, will use apic physical");
+		return 1;
+	}
 #endif
 
 	return 0;



^ permalink raw reply	[flat|nested] 11+ messages in thread

* [patch 2/2] x86, apic: use logical flat for systems with <= 8 logical cpus
  2010-01-18 20:10 [patch 1/2] x86, apic: use physical mode for IBM summit platforms Suresh Siddha
@ 2010-01-18 20:10 ` Suresh Siddha
  2010-02-09 18:00   ` [tip:x86/urgent] x86, apic: Don't use logical-flat mode when CPU hotplug may exceed 8 CPUs tip-bot for Suresh Siddha
  0 siblings, 1 reply; 11+ messages in thread
From: Suresh Siddha @ 2010-01-18 20:10 UTC (permalink / raw)
  To: torvalds, hpa, mingo, tglx
  Cc: linux-kernel, Suresh Siddha, Yinghai Lu,
	Ananth N Mavinakayanahalli, Chris McDermott

[-- Attachment #1: use_flat_mode_for_upto_8_logical_cpus.patch --]
[-- Type: text/plain, Size: 2668 bytes --]

We can use logical flat mode if there are <= 8 logical cpu's (irrespective
of physical apic id values). This will enable simplified and efficient IPI
and device interrupt routing on such platforms.

This has been tested to work on both Intel and AMD platforms. Exceptions
like IBM summit platform which can't use logical flat mode are addressed
by using OEM platform checks.

Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Cc: Chris McDermott <lcm@linux.vnet.ibm.com>
---
 arch/x86/kernel/apic/apic.c     |   15 +--------------
 arch/x86/kernel/apic/probe_64.c |    8 +++-----
 2 files changed, 4 insertions(+), 19 deletions(-)

Index: tip/arch/x86/kernel/apic/apic.c
===================================================================
--- tip.orig/arch/x86/kernel/apic/apic.c
+++ tip/arch/x86/kernel/apic/apic.c
@@ -61,12 +61,6 @@ unsigned int boot_cpu_physical_apicid = 
 
 /*
  * The highest APIC ID seen during enumeration.
- *
- * This determines the messaging protocol we can use: if all APIC IDs
- * are in the 0 ... 7 range, then we can use logical addressing which
- * has some performance advantages (better broadcasting).
- *
- * If there's an APIC ID above 8, we use physical addressing.
  */
 unsigned int max_physical_apicid;
 
@@ -1898,14 +1892,7 @@ void __cpuinit generic_processor_info(in
 		max_physical_apicid = apicid;
 
 #ifdef CONFIG_X86_32
-	/*
-	 * Would be preferable to switch to bigsmp when CONFIG_HOTPLUG_CPU=y
-	 * but we need to work other dependencies like SMP_SUSPEND etc
-	 * before this can be done without some confusion.
-	 * if (CPU_HOTPLUG_ENABLED || num_processors > 8)
-	 *       - Ashok Raj <ashok.raj@intel.com>
-	 */
-	if (max_physical_apicid >= 8) {
+	if (num_processors > 8) {
 		switch (boot_cpu_data.x86_vendor) {
 		case X86_VENDOR_INTEL:
 			if (!APIC_XAPIC(version)) {
Index: tip/arch/x86/kernel/apic/probe_64.c
===================================================================
--- tip.orig/arch/x86/kernel/apic/probe_64.c
+++ tip/arch/x86/kernel/apic/probe_64.c
@@ -64,15 +64,13 @@ void __init default_setup_apic_routing(v
 			apic = &apic_x2apic_phys;
 		else
 			apic = &apic_x2apic_cluster;
-		printk(KERN_INFO "Setting APIC routing to %s\n", apic->name);
 	}
 #endif
 
-	if (apic == &apic_flat) {
-		if (max_physical_apicid >= 8)
+	if (apic == &apic_flat && num_processors > 8)
 			apic = &apic_physflat;
-		printk(KERN_INFO "Setting APIC routing to %s\n", apic->name);
-	}
+
+	printk(KERN_INFO "Setting APIC routing to %s\n", apic->name);
 
 	if (is_vsmp_box()) {
 		/* need to update phys_pkg_id */



^ permalink raw reply	[flat|nested] 11+ messages in thread

* [tip:x86/urgent] x86, apic: Don't use logical-flat mode when CPU hotplug may exceed 8 CPUs
  2010-01-18 20:10 ` [patch 2/2] x86, apic: use logical flat for systems with <= 8 logical cpus Suresh Siddha
@ 2010-02-09 18:00   ` tip-bot for Suresh Siddha
  2010-02-09 18:47     ` Yinghai Lu
  0 siblings, 1 reply; 11+ messages in thread
From: tip-bot for Suresh Siddha @ 2010-02-09 18:00 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, yinghai, stable, suresh.b.siddha, tglx,
	shaohui.zheng

Commit-ID:  418f727639cfc8f03068aae09f473c493c759b9b
Gitweb:     http://git.kernel.org/tip/418f727639cfc8f03068aae09f473c493c759b9b
Author:     Suresh Siddha <suresh.b.siddha@intel.com>
AuthorDate: Tue, 9 Feb 2010 09:18:35 -0800
Committer:  H. Peter Anvin <hpa@zytor.com>
CommitDate: Tue, 9 Feb 2010 09:29:17 -0800

x86, apic: Don't use logical-flat mode when CPU hotplug may exceed 8 CPUs

We need to fall back from logical-flat APIC mode to physical-flat mode
when we have more than 8 CPUs.  However, in the presence of CPU
hotplug, we have to consider the number of possible CPUs rather than
the number of current CPUs; otherwise we may cross the 8-CPU boundary
when CPUs are added later.

Reported-by: Shaohui Zheng <shaohui.zheng@intel.com>
Acked-by: Shaohui Zheng <shaohui.zheng@intel.com>
Cc: Yinghai Lu <yinghai@kernel.org>
LKML-Reference: <20100118201256.672679042@sbs-t61.sc.intel.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Cc: <stable@kernel.org>
---
 arch/x86/kernel/apic/apic.c     |    2 +-
 arch/x86/kernel/apic/probe_64.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index 3987e44..fc1d579 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -1892,7 +1892,7 @@ void __cpuinit generic_processor_info(int apicid, int version)
 		max_physical_apicid = apicid;
 
 #ifdef CONFIG_X86_32
-	if (num_processors > 8) {
+	if (num_possible_cpus() > 8) {
 		switch (boot_cpu_data.x86_vendor) {
 		case X86_VENDOR_INTEL:
 			if (!APIC_XAPIC(version)) {
diff --git a/arch/x86/kernel/apic/probe_64.c b/arch/x86/kernel/apic/probe_64.c
index 450fe20..83e9be4 100644
--- a/arch/x86/kernel/apic/probe_64.c
+++ b/arch/x86/kernel/apic/probe_64.c
@@ -67,7 +67,7 @@ void __init default_setup_apic_routing(void)
 	}
 #endif
 
-	if (apic == &apic_flat && num_processors > 8)
+	if (apic == &apic_flat && num_possible_cpus() > 8)
 			apic = &apic_physflat;
 
 	printk(KERN_INFO "Setting APIC routing to %s\n", apic->name);

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [tip:x86/urgent] x86, apic: Don't use logical-flat mode when CPU hotplug may exceed 8 CPUs
  2010-02-09 18:00   ` [tip:x86/urgent] x86, apic: Don't use logical-flat mode when CPU hotplug may exceed 8 CPUs tip-bot for Suresh Siddha
@ 2010-02-09 18:47     ` Yinghai Lu
  2010-02-10  2:01       ` Suresh Siddha
  0 siblings, 1 reply; 11+ messages in thread
From: Yinghai Lu @ 2010-02-09 18:47 UTC (permalink / raw)
  To: mingo, hpa, linux-kernel, yinghai, stable, suresh.b.siddha, tglx,
	shaohui.zheng
  Cc: linux-tip-commits

On 02/09/2010 10:00 AM, tip-bot for Suresh Siddha wrote:
> Commit-ID:  418f727639cfc8f03068aae09f473c493c759b9b
> Gitweb:     http://git.kernel.org/tip/418f727639cfc8f03068aae09f473c493c759b9b
> Author:     Suresh Siddha <suresh.b.siddha@intel.com>
> AuthorDate: Tue, 9 Feb 2010 09:18:35 -0800
> Committer:  H. Peter Anvin <hpa@zytor.com>
> CommitDate: Tue, 9 Feb 2010 09:29:17 -0800
> 
> x86, apic: Don't use logical-flat mode when CPU hotplug may exceed 8 CPUs
> 
> We need to fall back from logical-flat APIC mode to physical-flat mode
> when we have more than 8 CPUs.  However, in the presence of CPU
> hotplug, we have to consider the number of possible CPUs rather than
> the number of current CPUs; otherwise we may cross the 8-CPU boundary
> when CPUs are added later.
> 
> Reported-by: Shaohui Zheng <shaohui.zheng@intel.com>
> Acked-by: Shaohui Zheng <shaohui.zheng@intel.com>
> Cc: Yinghai Lu <yinghai@kernel.org>
> LKML-Reference: <20100118201256.672679042@sbs-t61.sc.intel.com>
> Signed-off-by: H. Peter Anvin <hpa@zytor.com>
> Cc: <stable@kernel.org>
> ---
>  arch/x86/kernel/apic/apic.c     |    2 +-
>  arch/x86/kernel/apic/probe_64.c |    2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
> index 3987e44..fc1d579 100644
> --- a/arch/x86/kernel/apic/apic.c
> +++ b/arch/x86/kernel/apic/apic.c
> @@ -1892,7 +1892,7 @@ void __cpuinit generic_processor_info(int apicid, int version)
>  		max_physical_apicid = apicid;
>  
>  #ifdef CONFIG_X86_32
> -	if (num_processors > 8) {
> +	if (num_possible_cpus() > 8) {

for 32bit you can not use this function yet.
that only can be used after prefill_possible_map()

>  		switch (boot_cpu_data.x86_vendor) {
>  		case X86_VENDOR_INTEL:
>  			if (!APIC_XAPIC(version)) {
> diff --git a/arch/x86/kernel/apic/probe_64.c b/arch/x86/kernel/apic/probe_64.c
> index 450fe20..83e9be4 100644
> --- a/arch/x86/kernel/apic/probe_64.c
> +++ b/arch/x86/kernel/apic/probe_64.c
> @@ -67,7 +67,7 @@ void __init default_setup_apic_routing(void)
>  	}
>  #endif
>  
> -	if (apic == &apic_flat && num_processors > 8)
> +	if (apic == &apic_flat && num_possible_cpus() > 8)
>  			apic = &apic_physflat;
>  
>  	printk(KERN_INFO "Setting APIC routing to %s\n", apic->name);

please check
http://patchwork.kernel.org/patch/74536/
http://patchwork.kernel.org/patch/74533/
http://patchwork.kernel.org/patch/74525/
http://patchwork.kernel.org/patch/74524/

YH

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [tip:x86/urgent] x86, apic: Don't use logical-flat mode when CPU hotplug may exceed 8 CPUs
  2010-02-09 18:47     ` Yinghai Lu
@ 2010-02-10  2:01       ` Suresh Siddha
  2010-02-10  2:26         ` Yinghai Lu
                           ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Suresh Siddha @ 2010-02-10  2:01 UTC (permalink / raw)
  To: Yinghai Lu
  Cc: mingo@redhat.com, hpa@zytor.com, linux-kernel@vger.kernel.org,
	stable@kernel.org, tglx@linutronix.de, Zheng, Shaohui,
	linux-tip-commits@vger.kernel.org

On Tue, 2010-02-09 at 10:47 -0800, Yinghai Lu wrote:
> >  #ifdef CONFIG_X86_32
> > -	if (num_processors > 8) {
> > +	if (num_possible_cpus() > 8) {
> 
> for 32bit you can not use this function yet.
> that only can be used after prefill_possible_map()

Yinghai, Agreed. How about the appended patch? I tested and it works.
Peter wants a small quick fix for this issue (to resolve the boot issue
reported in the virtualization guest context) so that we can queue it
for .33 and .32 kernels (as some distributions will be based on these
kernels).

Can you please Ack if it is ok?

thanks,
suresh
---

From: Suresh Siddha <suresh.b.siddha@intel.com>
Subject: x86, apic: Don't use logical-flat mode when CPU hotplug may exceed 8 CPUs

We need to fall back from logical-flat APIC mode to physical-flat mode
when we have more than 8 CPUs.  However, in the presence of CPU
hotplug(with bios listing not enabled but possible cpus as disabled cpus in
MADT), we have to consider the number of possible CPUs rather than
the number of current CPUs; otherwise we may cross the 8-CPU boundary
when CPUs are added later.

32bit apic code can use more cleanups (like the removal of vendor checks in
32bit default_setup_apic_routing()) and more unifications with 64bit code.
Yinghai has some patches in works already. This patch addresses the boot issue
that is reported in the virtualization guest context.

Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
Acked-by: Shaohui Zheng <shaohui.zheng@intel.com>
Cc: <stable@kernel.org>
---

diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index 036d28a..0acbcdf 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -1185,9 +1185,6 @@ static void __init acpi_process_madt(void)
 		if (!error) {
 			acpi_lapic = 1;
 
-#ifdef CONFIG_X86_BIGSMP
-			generic_bigsmp_probe();
-#endif
 			/*
 			 * Parse MADT IO-APIC entries
 			 */
@@ -1197,8 +1194,6 @@ static void __init acpi_process_madt(void)
 				acpi_ioapic = 1;
 
 				smp_found_config = 1;
-				if (apic->setup_apic_routing)
-					apic->setup_apic_routing();
 			}
 		}
 		if (error == -EINVAL) {
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index a85f216..6e29b2a 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -1641,9 +1641,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();
@@ -1891,21 +1889,6 @@ void __cpuinit generic_processor_info(int apicid, int version)
 	if (apicid > max_physical_apicid)
 		max_physical_apicid = apicid;
 
-#ifdef CONFIG_X86_32
-	if (num_processors > 8) {
-		switch (boot_cpu_data.x86_vendor) {
-		case X86_VENDOR_INTEL:
-			if (!APIC_XAPIC(version)) {
-				def_to_bigsmp = 0;
-				break;
-			}
-			/* If P4 and above fall through */
-		case X86_VENDOR_AMD:
-			def_to_bigsmp = 1;
-		}
-	}
-#endif
-
 #if defined(CONFIG_SMP) || defined(CONFIG_X86_64)
 	early_per_cpu(x86_cpu_to_apicid, cpu) = apicid;
 	early_per_cpu(x86_bios_cpu_apicid, cpu) = apicid;
diff --git a/arch/x86/kernel/apic/probe_32.c b/arch/x86/kernel/apic/probe_32.c
index 1a6559f..88e78ae 100644
--- a/arch/x86/kernel/apic/probe_32.c
+++ b/arch/x86/kernel/apic/probe_32.c
@@ -54,6 +54,31 @@ late_initcall(print_ipi_mode);
 
 void default_setup_apic_routing(void)
 {
+	int version = apic_version[boot_cpu_physical_apicid];
+
+	if (num_possible_cpus() > 8) {
+		switch (boot_cpu_data.x86_vendor) {
+		case X86_VENDOR_INTEL:
+			if (!APIC_XAPIC(version)) {
+				def_to_bigsmp = 0;
+				break;
+			}
+			/* If P4 and above fall through */
+		case X86_VENDOR_AMD:
+			def_to_bigsmp = 1;
+		}
+	}
+
+#ifdef CONFIG_X86_BIGSMP
+	generic_bigsmp_probe();
+#endif
+
+	if (apic->setup_apic_routing)
+		apic->setup_apic_routing();
+}
+
+void setup_apic_flat_routing(void)
+{
 #ifdef CONFIG_X86_IO_APIC
 	printk(KERN_INFO
 		"Enabling APIC mode:  Flat.  Using %d I/O APICs\n",
@@ -103,7 +128,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		= setup_apic_flat_routing,
 	.multi_timer_check		= NULL,
 	.apicid_to_node			= default_apicid_to_node,
 	.cpu_to_logical_apicid		= default_cpu_to_logical_apicid,
diff --git a/arch/x86/kernel/apic/probe_64.c b/arch/x86/kernel/apic/probe_64.c
index 450fe20..83e9be4 100644
--- a/arch/x86/kernel/apic/probe_64.c
+++ b/arch/x86/kernel/apic/probe_64.c
@@ -67,7 +67,7 @@ void __init default_setup_apic_routing(void)
 	}
 #endif
 
-	if (apic == &apic_flat && num_processors > 8)
+	if (apic == &apic_flat && num_possible_cpus() > 8)
 			apic = &apic_physflat;
 
 	printk(KERN_INFO "Setting APIC routing to %s\n", apic->name);
diff --git a/arch/x86/kernel/mpparse.c b/arch/x86/kernel/mpparse.c
index 40b54ce..a2c1edd 100644
--- a/arch/x86/kernel/mpparse.c
+++ b/arch/x86/kernel/mpparse.c
@@ -359,13 +359,6 @@ static int __init smp_read_mpc(struct mpc_table *mpc, unsigned early)
 		x86_init.mpparse.mpc_record(1);
 	}
 
-#ifdef CONFIG_X86_BIGSMP
-	generic_bigsmp_probe();
-#endif
-
-	if (apic->setup_apic_routing)
-		apic->setup_apic_routing();
-
 	if (!num_processors)
 		printk(KERN_ERR "MPTABLE: no processors registered!\n");
 	return num_processors;
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index b2ebcba..c08829a 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -1087,9 +1087,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");



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [tip:x86/urgent] x86, apic: Don't use logical-flat mode when CPU hotplug may exceed 8 CPUs
  2010-02-10  2:01       ` Suresh Siddha
@ 2010-02-10  2:26         ` Yinghai Lu
  2010-02-10  3:00           ` Yinghai Lu
  2010-02-10  3:42         ` Yinghai Lu
  2010-02-10  6:27         ` tip-bot for Suresh Siddha
  2 siblings, 1 reply; 11+ messages in thread
From: Yinghai Lu @ 2010-02-10  2:26 UTC (permalink / raw)
  To: Suresh Siddha
  Cc: mingo@redhat.com, hpa@zytor.com, linux-kernel@vger.kernel.org,
	stable@kernel.org, tglx@linutronix.de, Zheng, Shaohui,
	linux-tip-commits@vger.kernel.org

On 02/09/2010 06:01 PM, Suresh Siddha wrote:
> On Tue, 2010-02-09 at 10:47 -0800, Yinghai Lu wrote:
>>>  #ifdef CONFIG_X86_32
>>> -	if (num_processors > 8) {
>>> +	if (num_possible_cpus() > 8) {
>>
>> for 32bit you can not use this function yet.
>> that only can be used after prefill_possible_map()
> 
> Yinghai, Agreed. How about the appended patch? I tested and it works.
> Peter wants a small quick fix for this issue (to resolve the boot issue
> reported in the virtualization guest context) so that we can queue it
> for .33 and .32 kernels (as some distributions will be based on these
> kernels).
> 
> Can you please Ack if it is ok?
> 
> thanks,
> suresh
> ---
> 
> From: Suresh Siddha <suresh.b.siddha@intel.com>
> Subject: x86, apic: Don't use logical-flat mode when CPU hotplug may exceed 8 CPUs
> 
> We need to fall back from logical-flat APIC mode to physical-flat mode
> when we have more than 8 CPUs.  However, in the presence of CPU
> hotplug(with bios listing not enabled but possible cpus as disabled cpus in
> MADT), we have to consider the number of possible CPUs rather than
> the number of current CPUs; otherwise we may cross the 8-CPU boundary
> when CPUs are added later.
> 
> 32bit apic code can use more cleanups (like the removal of vendor checks in
> 32bit default_setup_apic_routing()) and more unifications with 64bit code.
> Yinghai has some patches in works already. This patch addresses the boot issue
> that is reported in the virtualization guest context.
> 
> Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
> Acked-by: Shaohui Zheng <shaohui.zheng@intel.com>
> Cc: <stable@kernel.org>
> ---
> 
> diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
> index 036d28a..0acbcdf 100644
> --- a/arch/x86/kernel/acpi/boot.c
> +++ b/arch/x86/kernel/acpi/boot.c
> @@ -1185,9 +1185,6 @@ static void __init acpi_process_madt(void)
>  		if (!error) {
>  			acpi_lapic = 1;
>  
> -#ifdef CONFIG_X86_BIGSMP
> -			generic_bigsmp_probe();
> -#endif
>  			/*
>  			 * Parse MADT IO-APIC entries
>  			 */
> @@ -1197,8 +1194,6 @@ static void __init acpi_process_madt(void)
>  				acpi_ioapic = 1;
>  
>  				smp_found_config = 1;
> -				if (apic->setup_apic_routing)
> -					apic->setup_apic_routing();
>  			}
>  		}
>  		if (error == -EINVAL) {
> diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
> index a85f216..6e29b2a 100644
> --- a/arch/x86/kernel/apic/apic.c
> +++ b/arch/x86/kernel/apic/apic.c
> @@ -1641,9 +1641,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();
> @@ -1891,21 +1889,6 @@ void __cpuinit generic_processor_info(int apicid, int version)
>  	if (apicid > max_physical_apicid)
>  		max_physical_apicid = apicid;
>  
> -#ifdef CONFIG_X86_32
> -	if (num_processors > 8) {
> -		switch (boot_cpu_data.x86_vendor) {
> -		case X86_VENDOR_INTEL:
> -			if (!APIC_XAPIC(version)) {
> -				def_to_bigsmp = 0;
> -				break;
> -			}
> -			/* If P4 and above fall through */
> -		case X86_VENDOR_AMD:
> -			def_to_bigsmp = 1;
> -		}
> -	}
> -#endif
> -
>  #if defined(CONFIG_SMP) || defined(CONFIG_X86_64)
>  	early_per_cpu(x86_cpu_to_apicid, cpu) = apicid;
>  	early_per_cpu(x86_bios_cpu_apicid, cpu) = apicid;
> diff --git a/arch/x86/kernel/apic/probe_32.c b/arch/x86/kernel/apic/probe_32.c
> index 1a6559f..88e78ae 100644
> --- a/arch/x86/kernel/apic/probe_32.c
> +++ b/arch/x86/kernel/apic/probe_32.c
> @@ -54,6 +54,31 @@ late_initcall(print_ipi_mode);
>  
>  void default_setup_apic_routing(void)
>  {
> +	int version = apic_version[boot_cpu_physical_apicid];
> +
> +	if (num_possible_cpus() > 8) {
> +		switch (boot_cpu_data.x86_vendor) {
> +		case X86_VENDOR_INTEL:
> +			if (!APIC_XAPIC(version)) {
> +				def_to_bigsmp = 0;
> +				break;
> +			}
> +			/* If P4 and above fall through */
> +		case X86_VENDOR_AMD:
> +			def_to_bigsmp = 1;
> +		}
> +	}
> +
> +#ifdef CONFIG_X86_BIGSMP
> +	generic_bigsmp_probe();
> +#endif
> +
> +	if (apic->setup_apic_routing)
> +		apic->setup_apic_routing();

the main difference between this patch and
http://patchwork.kernel.org/patch/74525/

is moving apic->setup_apic_routing calling.

wonder if it will affect subarch other than logical flat and physical flat.

YH

> +}
> +
> +void setup_apic_flat_routing(void)
> +{
>  #ifdef CONFIG_X86_IO_APIC
>  	printk(KERN_INFO
>  		"Enabling APIC mode:  Flat.  Using %d I/O APICs\n",
> @@ -103,7 +128,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		= setup_apic_flat_routing,
>  	.multi_timer_check		= NULL,
>  	.apicid_to_node			= default_apicid_to_node,
>  	.cpu_to_logical_apicid		= default_cpu_to_logical_apicid,
> diff --git a/arch/x86/kernel/apic/probe_64.c b/arch/x86/kernel/apic/probe_64.c
> index 450fe20..83e9be4 100644
> --- a/arch/x86/kernel/apic/probe_64.c
> +++ b/arch/x86/kernel/apic/probe_64.c
> @@ -67,7 +67,7 @@ void __init default_setup_apic_routing(void)
>  	}
>  #endif
>  
> -	if (apic == &apic_flat && num_processors > 8)
> +	if (apic == &apic_flat && num_possible_cpus() > 8)
>  			apic = &apic_physflat;
>  
>  	printk(KERN_INFO "Setting APIC routing to %s\n", apic->name);
> diff --git a/arch/x86/kernel/mpparse.c b/arch/x86/kernel/mpparse.c
> index 40b54ce..a2c1edd 100644
> --- a/arch/x86/kernel/mpparse.c
> +++ b/arch/x86/kernel/mpparse.c
> @@ -359,13 +359,6 @@ static int __init smp_read_mpc(struct mpc_table *mpc, unsigned early)
>  		x86_init.mpparse.mpc_record(1);
>  	}
>  
> -#ifdef CONFIG_X86_BIGSMP
> -	generic_bigsmp_probe();
> -#endif
> -
> -	if (apic->setup_apic_routing)
> -		apic->setup_apic_routing();
> -
>  	if (!num_processors)
>  		printk(KERN_ERR "MPTABLE: no processors registered!\n");
>  	return num_processors;
> diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
> index b2ebcba..c08829a 100644
> --- a/arch/x86/kernel/smpboot.c
> +++ b/arch/x86/kernel/smpboot.c
> @@ -1087,9 +1087,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");
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-tip-commits" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [tip:x86/urgent] x86, apic: Don't use logical-flat mode when CPU hotplug may exceed 8 CPUs
  2010-02-10  2:26         ` Yinghai Lu
@ 2010-02-10  3:00           ` Yinghai Lu
  2010-02-10  3:03             ` H. Peter Anvin
  0 siblings, 1 reply; 11+ messages in thread
From: Yinghai Lu @ 2010-02-10  3:00 UTC (permalink / raw)
  To: Suresh Siddha
  Cc: mingo@redhat.com, hpa@zytor.com, linux-kernel@vger.kernel.org,
	stable@kernel.org, tglx@linutronix.de, Zheng, Shaohui,
	linux-tip-commits@vger.kernel.org

On 02/09/2010 06:26 PM, Yinghai Lu wrote:
> On 02/09/2010 06:01 PM, Suresh Siddha wrote:
>> On Tue, 2010-02-09 at 10:47 -0800, Yinghai Lu wrote:
>>>>  #ifdef CONFIG_X86_32
>>>> -	if (num_processors > 8) {
>>>> +	if (num_possible_cpus() > 8) {
>>>
>>> for 32bit you can not use this function yet.
>>> that only can be used after prefill_possible_map()
>>
>> Yinghai, Agreed. How about the appended patch? I tested and it works.
>> Peter wants a small quick fix for this issue (to resolve the boot issue
>> reported in the virtualization guest context) so that we can queue it
>> for .33 and .32 kernels (as some distributions will be based on these
>> kernels).
>>
>> Can you please Ack if it is ok?
>>
>> thanks,
>> suresh
>> ---
>>
>> From: Suresh Siddha <suresh.b.siddha@intel.com>
>> Subject: x86, apic: Don't use logical-flat mode when CPU hotplug may exceed 8 CPUs
>>
>> We need to fall back from logical-flat APIC mode to physical-flat mode
>> when we have more than 8 CPUs.  However, in the presence of CPU
>> hotplug(with bios listing not enabled but possible cpus as disabled cpus in
>> MADT), we have to consider the number of possible CPUs rather than
>> the number of current CPUs; otherwise we may cross the 8-CPU boundary
>> when CPUs are added later.
>>
>> 32bit apic code can use more cleanups (like the removal of vendor checks in
>> 32bit default_setup_apic_routing()) and more unifications with 64bit code.
>> Yinghai has some patches in works already. This patch addresses the boot issue
>> that is reported in the virtualization guest context.
>>
>> Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
>> Acked-by: Shaohui Zheng <shaohui.zheng@intel.com>
>> Cc: <stable@kernel.org>
>> ---
>>
>> diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
>> index 036d28a..0acbcdf 100644
>> --- a/arch/x86/kernel/acpi/boot.c
>> +++ b/arch/x86/kernel/acpi/boot.c
>> @@ -1185,9 +1185,6 @@ static void __init acpi_process_madt(void)
>>  		if (!error) {
>>  			acpi_lapic = 1;
>>  
>> -#ifdef CONFIG_X86_BIGSMP
>> -			generic_bigsmp_probe();
>> -#endif
>>  			/*
>>  			 * Parse MADT IO-APIC entries
>>  			 */
>> @@ -1197,8 +1194,6 @@ static void __init acpi_process_madt(void)
>>  				acpi_ioapic = 1;
>>  
>>  				smp_found_config = 1;
>> -				if (apic->setup_apic_routing)
>> -					apic->setup_apic_routing();
>>  			}
>>  		}
>>  		if (error == -EINVAL) {
>> diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
>> index a85f216..6e29b2a 100644
>> --- a/arch/x86/kernel/apic/apic.c
>> +++ b/arch/x86/kernel/apic/apic.c
>> @@ -1641,9 +1641,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();
>> @@ -1891,21 +1889,6 @@ void __cpuinit generic_processor_info(int apicid, int version)
>>  	if (apicid > max_physical_apicid)
>>  		max_physical_apicid = apicid;
>>  
>> -#ifdef CONFIG_X86_32
>> -	if (num_processors > 8) {
>> -		switch (boot_cpu_data.x86_vendor) {
>> -		case X86_VENDOR_INTEL:
>> -			if (!APIC_XAPIC(version)) {
>> -				def_to_bigsmp = 0;
>> -				break;
>> -			}
>> -			/* If P4 and above fall through */
>> -		case X86_VENDOR_AMD:
>> -			def_to_bigsmp = 1;
>> -		}
>> -	}
>> -#endif
>> -
>>  #if defined(CONFIG_SMP) || defined(CONFIG_X86_64)
>>  	early_per_cpu(x86_cpu_to_apicid, cpu) = apicid;
>>  	early_per_cpu(x86_bios_cpu_apicid, cpu) = apicid;
>> diff --git a/arch/x86/kernel/apic/probe_32.c b/arch/x86/kernel/apic/probe_32.c
>> index 1a6559f..88e78ae 100644
>> --- a/arch/x86/kernel/apic/probe_32.c
>> +++ b/arch/x86/kernel/apic/probe_32.c
>> @@ -54,6 +54,31 @@ late_initcall(print_ipi_mode);
>>  
>>  void default_setup_apic_routing(void)
>>  {
>> +	int version = apic_version[boot_cpu_physical_apicid];
>> +
>> +	if (num_possible_cpus() > 8) {
>> +		switch (boot_cpu_data.x86_vendor) {
>> +		case X86_VENDOR_INTEL:
>> +			if (!APIC_XAPIC(version)) {
>> +				def_to_bigsmp = 0;
>> +				break;
>> +			}
>> +			/* If P4 and above fall through */
>> +		case X86_VENDOR_AMD:
>> +			def_to_bigsmp = 1;
>> +		}
>> +	}
>> +
>> +#ifdef CONFIG_X86_BIGSMP
>> +	generic_bigsmp_probe();
>> +#endif
>> +
>> +	if (apic->setup_apic_routing)
>> +		apic->setup_apic_routing();
> 
> the main difference between this patch and
> http://patchwork.kernel.org/patch/74525/
> 
> is moving apic->setup_apic_routing calling.
> 
> wonder if it will affect subarch other than logical flat and physical flat.

other subarch setup_apic_routing is just pr_info...

so your patch should be ok.

YH

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [tip:x86/urgent] x86, apic: Don't use logical-flat mode when CPU hotplug may exceed 8 CPUs
  2010-02-10  3:00           ` Yinghai Lu
@ 2010-02-10  3:03             ` H. Peter Anvin
  2010-02-10  3:04               ` Yinghai Lu
  0 siblings, 1 reply; 11+ messages in thread
From: H. Peter Anvin @ 2010-02-10  3:03 UTC (permalink / raw)
  To: Yinghai Lu
  Cc: Suresh Siddha, mingo@redhat.com, linux-kernel@vger.kernel.org,
	stable@kernel.org, tglx@linutronix.de, Zheng, Shaohui,
	linux-tip-commits@vger.kernel.org

On 02/09/2010 07:00 PM, Yinghai Lu wrote:
> 
> other subarch setup_apic_routing is just pr_info...
> 
> so your patch should be ok.
> 

Great, can I take that as an Acked-by: or Reviewed-by: from you?

I really appreciate the review.

	-hpa


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [tip:x86/urgent] x86, apic: Don't use logical-flat mode when CPU hotplug may exceed 8 CPUs
  2010-02-10  3:03             ` H. Peter Anvin
@ 2010-02-10  3:04               ` Yinghai Lu
  0 siblings, 0 replies; 11+ messages in thread
From: Yinghai Lu @ 2010-02-10  3:04 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: Suresh Siddha, mingo@redhat.com, linux-kernel@vger.kernel.org,
	stable@kernel.org, tglx@linutronix.de, Zheng, Shaohui,
	linux-tip-commits@vger.kernel.org

On 02/09/2010 07:03 PM, H. Peter Anvin wrote:
> On 02/09/2010 07:00 PM, Yinghai Lu wrote:
>>
>> other subarch setup_apic_routing is just pr_info...
>>
>> so your patch should be ok.
>>
> 
> Great, can I take that as an Acked-by: or Reviewed-by: from you?
> 
sure.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [tip:x86/urgent] x86, apic: Don't use logical-flat mode when CPU hotplug may exceed 8 CPUs
  2010-02-10  2:01       ` Suresh Siddha
  2010-02-10  2:26         ` Yinghai Lu
@ 2010-02-10  3:42         ` Yinghai Lu
  2010-02-10  6:27         ` tip-bot for Suresh Siddha
  2 siblings, 0 replies; 11+ messages in thread
From: Yinghai Lu @ 2010-02-10  3:42 UTC (permalink / raw)
  To: Suresh Siddha
  Cc: mingo@redhat.com, hpa@zytor.com, linux-kernel@vger.kernel.org,
	stable@kernel.org, tglx@linutronix.de, Zheng, Shaohui,
	linux-tip-commits@vger.kernel.org

On 02/09/2010 06:01 PM, Suresh Siddha wrote:
> On Tue, 2010-02-09 at 10:47 -0800, Yinghai Lu wrote:
>>>  #ifdef CONFIG_X86_32
>>> -	if (num_processors > 8) {
>>> +	if (num_possible_cpus() > 8) {
>>
>> for 32bit you can not use this function yet.
>> that only can be used after prefill_possible_map()
> 
> Yinghai, Agreed. How about the appended patch? I tested and it works.
> Peter wants a small quick fix for this issue (to resolve the boot issue
> reported in the virtualization guest context) so that we can queue it
> for .33 and .32 kernels (as some distributions will be based on these
> kernels).
> 
> Can you please Ack if it is ok?
> 
> thanks,
> suresh
> ---
> 
> From: Suresh Siddha <suresh.b.siddha@intel.com>
> Subject: x86, apic: Don't use logical-flat mode when CPU hotplug may exceed 8 CPUs
> 
> We need to fall back from logical-flat APIC mode to physical-flat mode
> when we have more than 8 CPUs.  However, in the presence of CPU
> hotplug(with bios listing not enabled but possible cpus as disabled cpus in
> MADT), we have to consider the number of possible CPUs rather than
> the number of current CPUs; otherwise we may cross the 8-CPU boundary
> when CPUs are added later.
> 
> 32bit apic code can use more cleanups (like the removal of vendor checks in
> 32bit default_setup_apic_routing()) and more unifications with 64bit code.
> Yinghai has some patches in works already. This patch addresses the boot issue
> that is reported in the virtualization guest context.
> 
> Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
> Acked-by: Shaohui Zheng <shaohui.zheng@intel.com>
> Cc: <stable@kernel.org>
> ---
> 
> diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
> index 036d28a..0acbcdf 100644
> --- a/arch/x86/kernel/acpi/boot.c
> +++ b/arch/x86/kernel/acpi/boot.c
> @@ -1185,9 +1185,6 @@ static void __init acpi_process_madt(void)
>  		if (!error) {
>  			acpi_lapic = 1;
>  
> -#ifdef CONFIG_X86_BIGSMP
> -			generic_bigsmp_probe();
> -#endif
>  			/*
>  			 * Parse MADT IO-APIC entries
>  			 */
> @@ -1197,8 +1194,6 @@ static void __init acpi_process_madt(void)
>  				acpi_ioapic = 1;
>  
>  				smp_found_config = 1;
> -				if (apic->setup_apic_routing)
> -					apic->setup_apic_routing();
>  			}
>  		}
>  		if (error == -EINVAL) {
> diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
> index a85f216..6e29b2a 100644
> --- a/arch/x86/kernel/apic/apic.c
> +++ b/arch/x86/kernel/apic/apic.c
> @@ -1641,9 +1641,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();
> @@ -1891,21 +1889,6 @@ void __cpuinit generic_processor_info(int apicid, int version)
>  	if (apicid > max_physical_apicid)
>  		max_physical_apicid = apicid;
>  
> -#ifdef CONFIG_X86_32
> -	if (num_processors > 8) {
> -		switch (boot_cpu_data.x86_vendor) {
> -		case X86_VENDOR_INTEL:
> -			if (!APIC_XAPIC(version)) {
> -				def_to_bigsmp = 0;
> -				break;
> -			}
> -			/* If P4 and above fall through */
> -		case X86_VENDOR_AMD:
> -			def_to_bigsmp = 1;
> -		}
> -	}
> -#endif
> -
>  #if defined(CONFIG_SMP) || defined(CONFIG_X86_64)
>  	early_per_cpu(x86_cpu_to_apicid, cpu) = apicid;
>  	early_per_cpu(x86_bios_cpu_apicid, cpu) = apicid;
> diff --git a/arch/x86/kernel/apic/probe_32.c b/arch/x86/kernel/apic/probe_32.c
> index 1a6559f..88e78ae 100644
> --- a/arch/x86/kernel/apic/probe_32.c
> +++ b/arch/x86/kernel/apic/probe_32.c
> @@ -54,6 +54,31 @@ late_initcall(print_ipi_mode);
>  
>  void default_setup_apic_routing(void)

__init

>  {
> +	int version = apic_version[boot_cpu_physical_apicid];
> +
> +	if (num_possible_cpus() > 8) {
> +		switch (boot_cpu_data.x86_vendor) {
> +		case X86_VENDOR_INTEL:
> +			if (!APIC_XAPIC(version)) {
> +				def_to_bigsmp = 0;
> +				break;
> +			}
> +			/* If P4 and above fall through */
> +		case X86_VENDOR_AMD:
> +			def_to_bigsmp = 1;
> +		}
> +	}
> +
> +#ifdef CONFIG_X86_BIGSMP
> +	generic_bigsmp_probe();
> +#endif
> +
> +	if (apic->setup_apic_routing)
> +		apic->setup_apic_routing();
> +}
> +
> +void setup_apic_flat_routing(void)

static?

YH

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [tip:x86/urgent] x86, apic: Don't use logical-flat mode when CPU hotplug may exceed 8 CPUs
  2010-02-10  2:01       ` Suresh Siddha
  2010-02-10  2:26         ` Yinghai Lu
  2010-02-10  3:42         ` Yinghai Lu
@ 2010-02-10  6:27         ` tip-bot for Suresh Siddha
  2 siblings, 0 replies; 11+ messages in thread
From: tip-bot for Suresh Siddha @ 2010-02-10  6:27 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, yinghai, stable, suresh.b.siddha, tglx,
	shaohui.zheng

Commit-ID:  681ee44d40d7c93b42118320e4620d07d8704fd6
Gitweb:     http://git.kernel.org/tip/681ee44d40d7c93b42118320e4620d07d8704fd6
Author:     Suresh Siddha <suresh.b.siddha@intel.com>
AuthorDate: Tue, 9 Feb 2010 18:01:44 -0800
Committer:  H. Peter Anvin <hpa@zytor.com>
CommitDate: Tue, 9 Feb 2010 20:51:11 -0800

x86, apic: Don't use logical-flat mode when CPU hotplug may exceed 8 CPUs

We need to fall back from logical-flat APIC mode to physical-flat mode
when we have more than 8 CPUs.  However, in the presence of CPU
hotplug(with bios listing not enabled but possible cpus as disabled cpus in
MADT), we have to consider the number of possible CPUs rather than
the number of current CPUs; otherwise we may cross the 8-CPU boundary
when CPUs are added later.

32bit apic code can use more cleanups (like the removal of vendor checks in
32bit default_setup_apic_routing()) and more unifications with 64bit code.
Yinghai has some patches in works already. This patch addresses the boot issue
that is reported in the virtualization guest context.

[ hpa: incorporated function annotation feedback from Yinghai Lu ]

Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
LKML-Reference: <1265767304.2833.19.camel@sbs-t61.sc.intel.com>
Acked-by: Shaohui Zheng <shaohui.zheng@intel.com>
Reviewed-by: Yinghai Lu <yinghai@kernel.org>
Cc: <stable@kernel.org>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
---
 arch/x86/kernel/acpi/boot.c     |    5 -----
 arch/x86/kernel/apic/apic.c     |   17 -----------------
 arch/x86/kernel/apic/probe_32.c |   29 +++++++++++++++++++++++++++--
 arch/x86/kernel/apic/probe_64.c |    2 +-
 arch/x86/kernel/mpparse.c       |    7 -------
 arch/x86/kernel/smpboot.c       |    2 --
 6 files changed, 28 insertions(+), 34 deletions(-)

diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index 036d28a..0acbcdf 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -1185,9 +1185,6 @@ static void __init acpi_process_madt(void)
 		if (!error) {
 			acpi_lapic = 1;
 
-#ifdef CONFIG_X86_BIGSMP
-			generic_bigsmp_probe();
-#endif
 			/*
 			 * Parse MADT IO-APIC entries
 			 */
@@ -1197,8 +1194,6 @@ static void __init acpi_process_madt(void)
 				acpi_ioapic = 1;
 
 				smp_found_config = 1;
-				if (apic->setup_apic_routing)
-					apic->setup_apic_routing();
 			}
 		}
 		if (error == -EINVAL) {
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index 3987e44..dfca210 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -1641,9 +1641,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();
@@ -1891,21 +1889,6 @@ void __cpuinit generic_processor_info(int apicid, int version)
 	if (apicid > max_physical_apicid)
 		max_physical_apicid = apicid;
 
-#ifdef CONFIG_X86_32
-	if (num_processors > 8) {
-		switch (boot_cpu_data.x86_vendor) {
-		case X86_VENDOR_INTEL:
-			if (!APIC_XAPIC(version)) {
-				def_to_bigsmp = 0;
-				break;
-			}
-			/* If P4 and above fall through */
-		case X86_VENDOR_AMD:
-			def_to_bigsmp = 1;
-		}
-	}
-#endif
-
 #if defined(CONFIG_SMP) || defined(CONFIG_X86_64)
 	early_per_cpu(x86_cpu_to_apicid, cpu) = apicid;
 	early_per_cpu(x86_bios_cpu_apicid, cpu) = apicid;
diff --git a/arch/x86/kernel/apic/probe_32.c b/arch/x86/kernel/apic/probe_32.c
index 1a6559f..99d2fe0 100644
--- a/arch/x86/kernel/apic/probe_32.c
+++ b/arch/x86/kernel/apic/probe_32.c
@@ -52,7 +52,32 @@ static int __init print_ipi_mode(void)
 }
 late_initcall(print_ipi_mode);
 
-void default_setup_apic_routing(void)
+void __init default_setup_apic_routing(void)
+{
+	int version = apic_version[boot_cpu_physical_apicid];
+
+	if (num_possible_cpus() > 8) {
+		switch (boot_cpu_data.x86_vendor) {
+		case X86_VENDOR_INTEL:
+			if (!APIC_XAPIC(version)) {
+				def_to_bigsmp = 0;
+				break;
+			}
+			/* If P4 and above fall through */
+		case X86_VENDOR_AMD:
+			def_to_bigsmp = 1;
+		}
+	}
+
+#ifdef CONFIG_X86_BIGSMP
+	generic_bigsmp_probe();
+#endif
+
+	if (apic->setup_apic_routing)
+		apic->setup_apic_routing();
+}
+
+static void setup_apic_flat_routing(void)
 {
 #ifdef CONFIG_X86_IO_APIC
 	printk(KERN_INFO
@@ -103,7 +128,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		= setup_apic_flat_routing,
 	.multi_timer_check		= NULL,
 	.apicid_to_node			= default_apicid_to_node,
 	.cpu_to_logical_apicid		= default_cpu_to_logical_apicid,
diff --git a/arch/x86/kernel/apic/probe_64.c b/arch/x86/kernel/apic/probe_64.c
index 450fe20..83e9be4 100644
--- a/arch/x86/kernel/apic/probe_64.c
+++ b/arch/x86/kernel/apic/probe_64.c
@@ -67,7 +67,7 @@ void __init default_setup_apic_routing(void)
 	}
 #endif
 
-	if (apic == &apic_flat && num_processors > 8)
+	if (apic == &apic_flat && num_possible_cpus() > 8)
 			apic = &apic_physflat;
 
 	printk(KERN_INFO "Setting APIC routing to %s\n", apic->name);
diff --git a/arch/x86/kernel/mpparse.c b/arch/x86/kernel/mpparse.c
index 40b54ce..a2c1edd 100644
--- a/arch/x86/kernel/mpparse.c
+++ b/arch/x86/kernel/mpparse.c
@@ -359,13 +359,6 @@ static int __init smp_read_mpc(struct mpc_table *mpc, unsigned early)
 		x86_init.mpparse.mpc_record(1);
 	}
 
-#ifdef CONFIG_X86_BIGSMP
-	generic_bigsmp_probe();
-#endif
-
-	if (apic->setup_apic_routing)
-		apic->setup_apic_routing();
-
 	if (!num_processors)
 		printk(KERN_ERR "MPTABLE: no processors registered!\n");
 	return num_processors;
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index 678d0b8..b4e870c 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");

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2010-02-10  6:28 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-18 20:10 [patch 1/2] x86, apic: use physical mode for IBM summit platforms Suresh Siddha
2010-01-18 20:10 ` [patch 2/2] x86, apic: use logical flat for systems with <= 8 logical cpus Suresh Siddha
2010-02-09 18:00   ` [tip:x86/urgent] x86, apic: Don't use logical-flat mode when CPU hotplug may exceed 8 CPUs tip-bot for Suresh Siddha
2010-02-09 18:47     ` Yinghai Lu
2010-02-10  2:01       ` Suresh Siddha
2010-02-10  2:26         ` Yinghai Lu
2010-02-10  3:00           ` Yinghai Lu
2010-02-10  3:03             ` H. Peter Anvin
2010-02-10  3:04               ` Yinghai Lu
2010-02-10  3:42         ` Yinghai Lu
2010-02-10  6:27         ` tip-bot for Suresh Siddha

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox