aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDou Liyang <douly.fnst@cn.fujitsu.com>2016-09-06 22:21:33 -0400
committerIngo Molnar <mingo@kernel.org>2016-09-08 02:11:03 -0400
commitc291b015158577be533dd5a959dfc09bab119eed (patch)
treeb91e42c318b00d6fd80dd8ade3ef026a85070654
parentdb91e2370e087967cb6b6425c092188767fb5e00 (diff)
x86/apic: Fix num_processors value in case of failure
If the topology package map check of the APIC ID and the CPU is a failure, we don't generate the processor info for that APIC ID yet we increase disabled_cpus by one - which is buggy. Only increase num_processors once we are sure we don't fail. Signed-off-by: Dou Liyang <douly.fnst@cn.fujitsu.com> Acked-by: David Rientjes <rientjes@google.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Link: http://lkml.kernel.org/r/1473214893-16481-1-git-send-email-douly.fnst@cn.fujitsu.com [ Rewrote the changelog. ] Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r--arch/x86/kernel/apic/apic.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index 50c95af0f017..f3e9b2df4b16 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -2093,7 +2093,6 @@ int generic_processor_info(int apicid, int version)
2093 return -EINVAL; 2093 return -EINVAL;
2094 } 2094 }
2095 2095
2096 num_processors++;
2097 if (apicid == boot_cpu_physical_apicid) { 2096 if (apicid == boot_cpu_physical_apicid) {
2098 /* 2097 /*
2099 * x86_bios_cpu_apicid is required to have processors listed 2098 * x86_bios_cpu_apicid is required to have processors listed
@@ -2116,10 +2115,13 @@ int generic_processor_info(int apicid, int version)
2116 2115
2117 pr_warning("APIC: Package limit reached. Processor %d/0x%x ignored.\n", 2116 pr_warning("APIC: Package limit reached. Processor %d/0x%x ignored.\n",
2118 thiscpu, apicid); 2117 thiscpu, apicid);
2118
2119 disabled_cpus++; 2119 disabled_cpus++;
2120 return -ENOSPC; 2120 return -ENOSPC;
2121 } 2121 }
2122 2122
2123 num_processors++;
2124
2123 /* 2125 /*
2124 * Validate version 2126 * Validate version
2125 */ 2127 */