diff options
-rw-r--r-- | arch/x86_64/kernel/setup.c | 21 | ||||
-rw-r--r-- | arch/x86_64/mm/numa.c | 3 | ||||
-rw-r--r-- | arch/x86_64/mm/srat.c | 17 | ||||
-rw-r--r-- | include/asm-x86_64/numa.h | 2 |
4 files changed, 21 insertions, 22 deletions
diff --git a/arch/x86_64/kernel/setup.c b/arch/x86_64/kernel/setup.c index 9aec524be3eb..976ebcf96f3e 100644 --- a/arch/x86_64/kernel/setup.c +++ b/arch/x86_64/kernel/setup.c | |||
@@ -765,6 +765,7 @@ static void __init amd_detect_cmp(struct cpuinfo_x86 *c) | |||
765 | int cpu = smp_processor_id(); | 765 | int cpu = smp_processor_id(); |
766 | int node = 0; | 766 | int node = 0; |
767 | unsigned bits; | 767 | unsigned bits; |
768 | unsigned apicid = phys_proc_id[cpu]; | ||
768 | 769 | ||
769 | bits = 0; | 770 | bits = 0; |
770 | while ((1 << bits) < c->x86_num_cores) | 771 | while ((1 << bits) < c->x86_num_cores) |
@@ -777,15 +778,19 @@ static void __init amd_detect_cmp(struct cpuinfo_x86 *c) | |||
777 | 778 | ||
778 | #ifdef CONFIG_NUMA | 779 | #ifdef CONFIG_NUMA |
779 | /* When an ACPI SRAT table is available use the mappings from SRAT | 780 | /* When an ACPI SRAT table is available use the mappings from SRAT |
780 | instead. */ | 781 | instead. */ |
781 | if (acpi_numa <= 0) { | 782 | node = phys_proc_id[cpu]; |
782 | node = phys_proc_id[cpu]; | 783 | if (acpi_numa > 0) { |
783 | if (!node_online(node)) | 784 | if (apicid_to_node[apicid] != NUMA_NO_NODE) |
784 | node = first_node(node_online_map); | 785 | node = apicid_to_node[apicid]; |
785 | cpu_to_node[cpu] = node; | 786 | else |
786 | } else { | 787 | printk(KERN_ERR |
787 | node = cpu_to_node[cpu]; | 788 | "SRAT: Didn't specify node for CPU %d(%d)\n", |
789 | cpu, apicid); | ||
788 | } | 790 | } |
791 | if (!node_online(node)) | ||
792 | node = first_node(node_online_map); | ||
793 | cpu_to_node[cpu] = node; | ||
789 | #endif | 794 | #endif |
790 | 795 | ||
791 | printk(KERN_INFO "CPU %d(%d) -> Node %d -> Core %d\n", | 796 | printk(KERN_INFO "CPU %d(%d) -> Node %d -> Core %d\n", |
diff --git a/arch/x86_64/mm/numa.c b/arch/x86_64/mm/numa.c index 04f7a33e144c..5b1518629893 100644 --- a/arch/x86_64/mm/numa.c +++ b/arch/x86_64/mm/numa.c | |||
@@ -29,6 +29,9 @@ int memnode_shift; | |||
29 | u8 memnodemap[NODEMAPSIZE]; | 29 | u8 memnodemap[NODEMAPSIZE]; |
30 | 30 | ||
31 | unsigned char cpu_to_node[NR_CPUS] __read_mostly = { [0 ... NR_CPUS-1] = NUMA_NO_NODE }; | 31 | unsigned char cpu_to_node[NR_CPUS] __read_mostly = { [0 ... NR_CPUS-1] = NUMA_NO_NODE }; |
32 | unsigned char apicid_to_node[256] __cpuinitdata = { | ||
33 | [0 ... NR_CPUS-1] = NUMA_NO_NODE | ||
34 | }; | ||
32 | cpumask_t node_to_cpumask[MAX_NUMNODES] __read_mostly; | 35 | cpumask_t node_to_cpumask[MAX_NUMNODES] __read_mostly; |
33 | 36 | ||
34 | int numa_off __initdata; | 37 | int numa_off __initdata; |
diff --git a/arch/x86_64/mm/srat.c b/arch/x86_64/mm/srat.c index 8e3d097a9ddd..92f6ec79b232 100644 --- a/arch/x86_64/mm/srat.c +++ b/arch/x86_64/mm/srat.c | |||
@@ -20,9 +20,6 @@ | |||
20 | 20 | ||
21 | static struct acpi_table_slit *acpi_slit; | 21 | static struct acpi_table_slit *acpi_slit; |
22 | 22 | ||
23 | /* Internal processor count */ | ||
24 | static unsigned int __initdata num_processors = 0; | ||
25 | |||
26 | static nodemask_t nodes_parsed __initdata; | 23 | static nodemask_t nodes_parsed __initdata; |
27 | static nodemask_t nodes_found __initdata; | 24 | static nodemask_t nodes_found __initdata; |
28 | static struct node nodes[MAX_NUMNODES] __initdata; | 25 | static struct node nodes[MAX_NUMNODES] __initdata; |
@@ -104,18 +101,10 @@ acpi_numa_processor_affinity_init(struct acpi_table_processor_affinity *pa) | |||
104 | bad_srat(); | 101 | bad_srat(); |
105 | return; | 102 | return; |
106 | } | 103 | } |
107 | if (num_processors >= NR_CPUS) { | 104 | apicid_to_node[pa->apic_id] = node; |
108 | printk(KERN_ERR "SRAT: Processor #%d (lapic %u) INVALID. (Max ID: %d).\n", | ||
109 | num_processors, pa->apic_id, NR_CPUS); | ||
110 | bad_srat(); | ||
111 | return; | ||
112 | } | ||
113 | cpu_to_node[num_processors] = node; | ||
114 | acpi_numa = 1; | 105 | acpi_numa = 1; |
115 | printk(KERN_INFO "SRAT: PXM %u -> APIC %u -> CPU %u -> Node %u\n", | 106 | printk(KERN_INFO "SRAT: PXM %u -> APIC %u -> Node %u\n", |
116 | pxm, pa->apic_id, num_processors, node); | 107 | pxm, pa->apic_id, node); |
117 | |||
118 | num_processors++; | ||
119 | } | 108 | } |
120 | 109 | ||
121 | /* Callback for parsing of the Proximity Domain <-> Memory Area mappings */ | 110 | /* Callback for parsing of the Proximity Domain <-> Memory Area mappings */ |
diff --git a/include/asm-x86_64/numa.h b/include/asm-x86_64/numa.h index 5c363a1482e4..3aaf70027213 100644 --- a/include/asm-x86_64/numa.h +++ b/include/asm-x86_64/numa.h | |||
@@ -16,6 +16,8 @@ extern void numa_add_cpu(int cpu); | |||
16 | extern void numa_init_array(void); | 16 | extern void numa_init_array(void); |
17 | extern int numa_off; | 17 | extern int numa_off; |
18 | 18 | ||
19 | extern unsigned char apicid_to_node[256]; | ||
20 | |||
19 | #define NUMA_NO_NODE 0xff | 21 | #define NUMA_NO_NODE 0xff |
20 | 22 | ||
21 | #endif | 23 | #endif |