diff options
author | keith mannthey <kmannth@us.ibm.com> | 2006-09-29 04:58:46 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-09-29 12:18:03 -0400 |
commit | 3b08606dc2991bcdab14139efd9ed9d492f5f901 (patch) | |
tree | c225c9fc5a7b3cdfe516c4279f77e40068396162 | |
parent | 3528a95322b5c1ce882ab723f175a1845430cd89 (diff) |
[PATCH] convert i386 Summit subarch to use SRAT info for apicid_to_node calls
Convert the i386 summit subarch apicid_to_node to use node information
provided by the SRAT. It was discussed a little on LKML a few weeks ago
and was seen as an acceptable fix. The current way of obtaining the nodeid
static inline int apicid_to_node(int logical_apicid)
{
return logical_apicid >> 5;
}
is just not correct for all summit systems/bios. Assuming the apicid
matches the Linux node number require a leap of faith that the bios mapped
out the apicids a set way. Modern summit HW (IBM x460) does not layout its
bios in the manner for various reasons and is unable to boot i386 numa.
The best way to get the correct apicid to node information is from the SRAT
table during boot. It lays out what apicid belongs to what node. I use
this information to create a table for use at run time.
Signed-off-by: Keith Mannthey <kmannth@us.ibm.com>
Cc: Andi Kleen <ak@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | arch/i386/kernel/smpboot.c | 5 | ||||
-rw-r--r-- | arch/i386/kernel/srat.c | 7 | ||||
-rw-r--r-- | include/asm-i386/mach-summit/mach_apic.h | 2 | ||||
-rw-r--r-- | include/asm-i386/smp.h | 2 |
4 files changed, 14 insertions, 2 deletions
diff --git a/arch/i386/kernel/smpboot.c b/arch/i386/kernel/smpboot.c index 020d873b7d21..82b26d5ce476 100644 --- a/arch/i386/kernel/smpboot.c +++ b/arch/i386/kernel/smpboot.c | |||
@@ -102,6 +102,8 @@ u8 x86_cpu_to_apicid[NR_CPUS] __read_mostly = | |||
102 | { [0 ... NR_CPUS-1] = 0xff }; | 102 | { [0 ... NR_CPUS-1] = 0xff }; |
103 | EXPORT_SYMBOL(x86_cpu_to_apicid); | 103 | EXPORT_SYMBOL(x86_cpu_to_apicid); |
104 | 104 | ||
105 | u8 apicid_2_node[MAX_APICID]; | ||
106 | |||
105 | /* | 107 | /* |
106 | * Trampoline 80x86 program as an array. | 108 | * Trampoline 80x86 program as an array. |
107 | */ | 109 | */ |
@@ -645,7 +647,7 @@ static void map_cpu_to_logical_apicid(void) | |||
645 | { | 647 | { |
646 | int cpu = smp_processor_id(); | 648 | int cpu = smp_processor_id(); |
647 | int apicid = logical_smp_processor_id(); | 649 | int apicid = logical_smp_processor_id(); |
648 | int node = apicid_to_node(apicid); | 650 | int node = apicid_to_node(hard_smp_processor_id()); |
649 | 651 | ||
650 | if (!node_online(node)) | 652 | if (!node_online(node)) |
651 | node = first_online_node; | 653 | node = first_online_node; |
@@ -954,6 +956,7 @@ static int __devinit do_boot_cpu(int apicid, int cpu) | |||
954 | 956 | ||
955 | irq_ctx_init(cpu); | 957 | irq_ctx_init(cpu); |
956 | 958 | ||
959 | x86_cpu_to_apicid[cpu] = apicid; | ||
957 | /* | 960 | /* |
958 | * This grunge runs the startup process for | 961 | * This grunge runs the startup process for |
959 | * the targeted processor. | 962 | * the targeted processor. |
diff --git a/arch/i386/kernel/srat.c b/arch/i386/kernel/srat.c index 32413122c4c2..f7e735c077c3 100644 --- a/arch/i386/kernel/srat.c +++ b/arch/i386/kernel/srat.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <linux/nodemask.h> | 30 | #include <linux/nodemask.h> |
31 | #include <asm/srat.h> | 31 | #include <asm/srat.h> |
32 | #include <asm/topology.h> | 32 | #include <asm/topology.h> |
33 | #include <asm/smp.h> | ||
33 | 34 | ||
34 | /* | 35 | /* |
35 | * proximity macros and definitions | 36 | * proximity macros and definitions |
@@ -54,6 +55,7 @@ struct node_memory_chunk_s { | |||
54 | static struct node_memory_chunk_s node_memory_chunk[MAXCHUNKS]; | 55 | static struct node_memory_chunk_s node_memory_chunk[MAXCHUNKS]; |
55 | 56 | ||
56 | static int num_memory_chunks; /* total number of memory chunks */ | 57 | static int num_memory_chunks; /* total number of memory chunks */ |
58 | static u8 __initdata apicid_to_pxm[MAX_APICID]; | ||
57 | 59 | ||
58 | extern void * boot_ioremap(unsigned long, unsigned long); | 60 | extern void * boot_ioremap(unsigned long, unsigned long); |
59 | 61 | ||
@@ -69,6 +71,8 @@ static void __init parse_cpu_affinity_structure(char *p) | |||
69 | /* mark this node as "seen" in node bitmap */ | 71 | /* mark this node as "seen" in node bitmap */ |
70 | BMAP_SET(pxm_bitmap, cpu_affinity->proximity_domain); | 72 | BMAP_SET(pxm_bitmap, cpu_affinity->proximity_domain); |
71 | 73 | ||
74 | apicid_to_pxm[cpu_affinity->apic_id] = cpu_affinity->proximity_domain; | ||
75 | |||
72 | printk("CPU 0x%02X in proximity domain 0x%02X\n", | 76 | printk("CPU 0x%02X in proximity domain 0x%02X\n", |
73 | cpu_affinity->apic_id, cpu_affinity->proximity_domain); | 77 | cpu_affinity->apic_id, cpu_affinity->proximity_domain); |
74 | } | 78 | } |
@@ -235,6 +239,9 @@ static int __init acpi20_parse_srat(struct acpi_table_srat *sratp) | |||
235 | printk("Number of logical nodes in system = %d\n", num_online_nodes()); | 239 | printk("Number of logical nodes in system = %d\n", num_online_nodes()); |
236 | printk("Number of memory chunks in system = %d\n", num_memory_chunks); | 240 | printk("Number of memory chunks in system = %d\n", num_memory_chunks); |
237 | 241 | ||
242 | for (i = 0; i < MAX_APICID; i++) | ||
243 | apicid_2_node[i] = pxm_to_node(apicid_to_pxm[i]); | ||
244 | |||
238 | for (j = 0; j < num_memory_chunks; j++){ | 245 | for (j = 0; j < num_memory_chunks; j++){ |
239 | struct node_memory_chunk_s * chunk = &node_memory_chunk[j]; | 246 | struct node_memory_chunk_s * chunk = &node_memory_chunk[j]; |
240 | printk("chunk %d nid %d start_pfn %08lx end_pfn %08lx\n", | 247 | printk("chunk %d nid %d start_pfn %08lx end_pfn %08lx\n", |
diff --git a/include/asm-i386/mach-summit/mach_apic.h b/include/asm-i386/mach-summit/mach_apic.h index a81b05961595..254a0fe01c6a 100644 --- a/include/asm-i386/mach-summit/mach_apic.h +++ b/include/asm-i386/mach-summit/mach_apic.h | |||
@@ -88,7 +88,7 @@ static inline void clustered_apic_check(void) | |||
88 | 88 | ||
89 | static inline int apicid_to_node(int logical_apicid) | 89 | static inline int apicid_to_node(int logical_apicid) |
90 | { | 90 | { |
91 | return logical_apicid >> 5; /* 2 clusterids per CEC */ | 91 | return apicid_2_node[logical_apicid]; |
92 | } | 92 | } |
93 | 93 | ||
94 | /* Mapping from cpu number to logical apicid */ | 94 | /* Mapping from cpu number to logical apicid */ |
diff --git a/include/asm-i386/smp.h b/include/asm-i386/smp.h index 32ac8c91d5c5..915c26a31b79 100644 --- a/include/asm-i386/smp.h +++ b/include/asm-i386/smp.h | |||
@@ -46,6 +46,8 @@ extern u8 x86_cpu_to_apicid[]; | |||
46 | 46 | ||
47 | #define cpu_physical_id(cpu) x86_cpu_to_apicid[cpu] | 47 | #define cpu_physical_id(cpu) x86_cpu_to_apicid[cpu] |
48 | 48 | ||
49 | extern u8 apicid_2_node[]; | ||
50 | |||
49 | #ifdef CONFIG_HOTPLUG_CPU | 51 | #ifdef CONFIG_HOTPLUG_CPU |
50 | extern void cpu_exit_clear(void); | 52 | extern void cpu_exit_clear(void); |
51 | extern void cpu_uninit(void); | 53 | extern void cpu_uninit(void); |