diff options
Diffstat (limited to 'arch/x86/kernel')
-rw-r--r-- | arch/x86/kernel/acpi/boot.c | 3 | ||||
-rw-r--r-- | arch/x86/kernel/apic/apic.c | 2 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/amd.c | 47 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/intel.c | 3 | ||||
-rw-r--r-- | arch/x86/kernel/smpboot.c | 6 |
5 files changed, 34 insertions, 27 deletions
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c index b3a71137983a..a7bca59ec595 100644 --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c | |||
@@ -589,11 +589,10 @@ static void acpi_map_cpu2node(acpi_handle handle, int cpu, int physid) | |||
589 | nid = acpi_get_node(handle); | 589 | nid = acpi_get_node(handle); |
590 | if (nid == -1 || !node_online(nid)) | 590 | if (nid == -1 || !node_online(nid)) |
591 | return; | 591 | return; |
592 | set_apicid_to_node(physid, nid); | ||
592 | #ifdef CONFIG_X86_64 | 593 | #ifdef CONFIG_X86_64 |
593 | apicid_to_node[physid] = nid; | ||
594 | numa_set_node(cpu, nid); | 594 | numa_set_node(cpu, nid); |
595 | #else /* CONFIG_X86_32 */ | 595 | #else /* CONFIG_X86_32 */ |
596 | apicid_2_node[physid] = nid; | ||
597 | cpu_to_node_map[cpu] = nid; | 596 | cpu_to_node_map[cpu] = nid; |
598 | #endif | 597 | #endif |
599 | 598 | ||
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c index 0f4f3c152311..4686ea59b7a0 100644 --- a/arch/x86/kernel/apic/apic.c +++ b/arch/x86/kernel/apic/apic.c | |||
@@ -2026,7 +2026,7 @@ int default_x86_32_numa_cpu_node(int cpu) | |||
2026 | int apicid = early_per_cpu(x86_cpu_to_apicid, cpu); | 2026 | int apicid = early_per_cpu(x86_cpu_to_apicid, cpu); |
2027 | 2027 | ||
2028 | if (apicid != BAD_APICID) | 2028 | if (apicid != BAD_APICID) |
2029 | return apicid_2_node[apicid]; | 2029 | return __apicid_to_node[apicid]; |
2030 | return NUMA_NO_NODE; | 2030 | return NUMA_NO_NODE; |
2031 | #else | 2031 | #else |
2032 | return 0; | 2032 | return 0; |
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c index 7c7bedb83c5a..3cce8f2bb2e1 100644 --- a/arch/x86/kernel/cpu/amd.c +++ b/arch/x86/kernel/cpu/amd.c | |||
@@ -234,17 +234,21 @@ static void __cpuinit init_amd_k7(struct cpuinfo_x86 *c) | |||
234 | #endif | 234 | #endif |
235 | 235 | ||
236 | #if defined(CONFIG_NUMA) && defined(CONFIG_X86_64) | 236 | #if defined(CONFIG_NUMA) && defined(CONFIG_X86_64) |
237 | /* | ||
238 | * To workaround broken NUMA config. Read the comment in | ||
239 | * srat_detect_node(). | ||
240 | */ | ||
237 | static int __cpuinit nearby_node(int apicid) | 241 | static int __cpuinit nearby_node(int apicid) |
238 | { | 242 | { |
239 | int i, node; | 243 | int i, node; |
240 | 244 | ||
241 | for (i = apicid - 1; i >= 0; i--) { | 245 | for (i = apicid - 1; i >= 0; i--) { |
242 | node = apicid_to_node[i]; | 246 | node = __apicid_to_node[i]; |
243 | if (node != NUMA_NO_NODE && node_online(node)) | 247 | if (node != NUMA_NO_NODE && node_online(node)) |
244 | return node; | 248 | return node; |
245 | } | 249 | } |
246 | for (i = apicid + 1; i < MAX_LOCAL_APIC; i++) { | 250 | for (i = apicid + 1; i < MAX_LOCAL_APIC; i++) { |
247 | node = apicid_to_node[i]; | 251 | node = __apicid_to_node[i]; |
248 | if (node != NUMA_NO_NODE && node_online(node)) | 252 | if (node != NUMA_NO_NODE && node_online(node)) |
249 | return node; | 253 | return node; |
250 | } | 254 | } |
@@ -339,26 +343,35 @@ static void __cpuinit srat_detect_node(struct cpuinfo_x86 *c) | |||
339 | int node; | 343 | int node; |
340 | unsigned apicid = c->apicid; | 344 | unsigned apicid = c->apicid; |
341 | 345 | ||
342 | node = per_cpu(cpu_llc_id, cpu); | 346 | node = numa_cpu_node(cpu); |
347 | if (node == NUMA_NO_NODE) | ||
348 | node = per_cpu(cpu_llc_id, cpu); | ||
343 | 349 | ||
344 | if (apicid_to_node[apicid] != NUMA_NO_NODE) | ||
345 | node = apicid_to_node[apicid]; | ||
346 | if (!node_online(node)) { | 350 | if (!node_online(node)) { |
347 | /* Two possibilities here: | 351 | /* |
348 | - The CPU is missing memory and no node was created. | 352 | * Two possibilities here: |
349 | In that case try picking one from a nearby CPU | 353 | * |
350 | - The APIC IDs differ from the HyperTransport node IDs | 354 | * - The CPU is missing memory and no node was created. In |
351 | which the K8 northbridge parsing fills in. | 355 | * that case try picking one from a nearby CPU. |
352 | Assume they are all increased by a constant offset, | 356 | * |
353 | but in the same order as the HT nodeids. | 357 | * - The APIC IDs differ from the HyperTransport node IDs |
354 | If that doesn't result in a usable node fall back to the | 358 | * which the K8 northbridge parsing fills in. Assume |
355 | path for the previous case. */ | 359 | * they are all increased by a constant offset, but in |
356 | 360 | * the same order as the HT nodeids. If that doesn't | |
361 | * result in a usable node fall back to the path for the | ||
362 | * previous case. | ||
363 | * | ||
364 | * This workaround operates directly on the mapping between | ||
365 | * APIC ID and NUMA node, assuming certain relationship | ||
366 | * between APIC ID, HT node ID and NUMA topology. As going | ||
367 | * through CPU mapping may alter the outcome, directly | ||
368 | * access __apicid_to_node[]. | ||
369 | */ | ||
357 | int ht_nodeid = c->initial_apicid; | 370 | int ht_nodeid = c->initial_apicid; |
358 | 371 | ||
359 | if (ht_nodeid >= 0 && | 372 | if (ht_nodeid >= 0 && |
360 | apicid_to_node[ht_nodeid] != NUMA_NO_NODE) | 373 | __apicid_to_node[ht_nodeid] != NUMA_NO_NODE) |
361 | node = apicid_to_node[ht_nodeid]; | 374 | node = __apicid_to_node[ht_nodeid]; |
362 | /* Pick a nearby node */ | 375 | /* Pick a nearby node */ |
363 | if (!node_online(node)) | 376 | if (!node_online(node)) |
364 | node = nearby_node(apicid); | 377 | node = nearby_node(apicid); |
diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c index d16c2c53d6bf..6052004bf4f4 100644 --- a/arch/x86/kernel/cpu/intel.c +++ b/arch/x86/kernel/cpu/intel.c | |||
@@ -279,11 +279,10 @@ static void __cpuinit srat_detect_node(struct cpuinfo_x86 *c) | |||
279 | #if defined(CONFIG_NUMA) && defined(CONFIG_X86_64) | 279 | #if defined(CONFIG_NUMA) && defined(CONFIG_X86_64) |
280 | unsigned node; | 280 | unsigned node; |
281 | int cpu = smp_processor_id(); | 281 | int cpu = smp_processor_id(); |
282 | int apicid = cpu_has_apic ? hard_smp_processor_id() : c->apicid; | ||
283 | 282 | ||
284 | /* Don't do the funky fallback heuristics the AMD version employs | 283 | /* Don't do the funky fallback heuristics the AMD version employs |
285 | for now. */ | 284 | for now. */ |
286 | node = apicid_to_node[apicid]; | 285 | node = numa_cpu_node(cpu); |
287 | if (node == NUMA_NO_NODE || !node_online(node)) { | 286 | if (node == NUMA_NO_NODE || !node_online(node)) { |
288 | /* reuse the value from init_cpu_to_node() */ | 287 | /* reuse the value from init_cpu_to_node() */ |
289 | node = cpu_to_node(cpu); | 288 | node = cpu_to_node(cpu); |
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c index 5319cdd53765..b7cfce535cb0 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c | |||
@@ -71,10 +71,6 @@ | |||
71 | #include <asm/smpboot_hooks.h> | 71 | #include <asm/smpboot_hooks.h> |
72 | #include <asm/i8259.h> | 72 | #include <asm/i8259.h> |
73 | 73 | ||
74 | #ifdef CONFIG_X86_32 | ||
75 | u8 apicid_2_node[MAX_LOCAL_APIC]; | ||
76 | #endif | ||
77 | |||
78 | /* State of each CPU */ | 74 | /* State of each CPU */ |
79 | DEFINE_PER_CPU(int, cpu_state) = { 0 }; | 75 | DEFINE_PER_CPU(int, cpu_state) = { 0 }; |
80 | 76 | ||
@@ -170,7 +166,7 @@ static void map_cpu_to_logical_apicid(void) | |||
170 | int cpu = smp_processor_id(); | 166 | int cpu = smp_processor_id(); |
171 | int node; | 167 | int node; |
172 | 168 | ||
173 | node = apic->x86_32_numa_cpu_node(cpu); | 169 | node = numa_cpu_node(cpu); |
174 | if (!node_online(node)) | 170 | if (!node_online(node)) |
175 | node = first_online_node; | 171 | node = first_online_node; |
176 | 172 | ||