diff options
author | David Rientjes <rientjes@google.com> | 2009-09-25 18:20:04 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-10-12 16:56:46 -0400 |
commit | 8716273caef7f55f39fe4fc6c69c5f9f197f41f1 (patch) | |
tree | 7008ec37e866a2f23207a4ef41f0319b567dc7e0 | |
parent | 8ee2debce32412118cf8c239e0026ace56ea1425 (diff) |
x86: Export srat physical topology
This is the counterpart to "x86: export k8 physical topology" for
SRAT. It is not as invasive because the acpi code already seperates
node setup into detection and registration steps, with the
exception of registering e820 active regions in
acpi_numa_memory_affinity_init(). This is now moved to
acpi_scan_nodes() if NUMA emulation is disabled or deferred.
acpi_numa_init() now returns a value which specifies whether an
underlying SRAT was located. If so, that topology can be used by
the emulation code to interleave emulated nodes over physical nodes
or to register the nodes for ACPI.
acpi_get_nodes() may now be used to export the srat physical
topology of the machine for NUMA emulation.
Signed-off-by: David Rientjes <rientjes@google.com>
Cc: Andreas Herrmann <andreas.herrmann3@amd.com>
Cc: Yinghai Lu <yinghai@kernel.org>
Cc: Balbir Singh <balbir@linux.vnet.ibm.com>
Cc: Ankita Garg <ankita@in.ibm.com>
Cc: Len Brown <len.brown@intel.com>
LKML-Reference: <alpine.DEB.1.00.0909251518580.14754@chino.kir.corp.google.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | arch/x86/include/asm/acpi.h | 1 | ||||
-rw-r--r-- | arch/x86/kernel/setup.c | 5 | ||||
-rw-r--r-- | arch/x86/mm/numa_64.c | 4 | ||||
-rw-r--r-- | arch/x86/mm/srat_64.c | 28 | ||||
-rw-r--r-- | drivers/acpi/numa.c | 10 |
5 files changed, 33 insertions, 15 deletions
diff --git a/arch/x86/include/asm/acpi.h b/arch/x86/include/asm/acpi.h index 4518dc500903..e3d4a0daff57 100644 --- a/arch/x86/include/asm/acpi.h +++ b/arch/x86/include/asm/acpi.h | |||
@@ -158,6 +158,7 @@ struct bootnode; | |||
158 | 158 | ||
159 | #ifdef CONFIG_ACPI_NUMA | 159 | #ifdef CONFIG_ACPI_NUMA |
160 | extern int acpi_numa; | 160 | extern int acpi_numa; |
161 | extern int acpi_get_nodes(struct bootnode *physnodes); | ||
161 | extern int acpi_scan_nodes(unsigned long start, unsigned long end); | 162 | extern int acpi_scan_nodes(unsigned long start, unsigned long end); |
162 | #define NR_NODE_MEMBLKS (MAX_NUMNODES*2) | 163 | #define NR_NODE_MEMBLKS (MAX_NUMNODES*2) |
163 | extern void acpi_fake_nodes(const struct bootnode *fake_nodes, | 164 | extern void acpi_fake_nodes(const struct bootnode *fake_nodes, |
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index fda0032c25c6..f89141982702 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c | |||
@@ -938,11 +938,12 @@ void __init setup_arch(char **cmdline_p) | |||
938 | /* | 938 | /* |
939 | * Parse SRAT to discover nodes. | 939 | * Parse SRAT to discover nodes. |
940 | */ | 940 | */ |
941 | acpi_numa_init(); | 941 | acpi = acpi_numa_init(); |
942 | #endif | 942 | #endif |
943 | 943 | ||
944 | #ifdef CONFIG_K8_NUMA | 944 | #ifdef CONFIG_K8_NUMA |
945 | k8 = !k8_numa_init(0, max_pfn); | 945 | if (!acpi) |
946 | k8 = !k8_numa_init(0, max_pfn); | ||
946 | #endif | 947 | #endif |
947 | 948 | ||
948 | initmem_init(0, max_pfn, acpi, k8); | 949 | initmem_init(0, max_pfn, acpi, k8); |
diff --git a/arch/x86/mm/numa_64.c b/arch/x86/mm/numa_64.c index dad5f42dd359..d1a3d94efc8e 100644 --- a/arch/x86/mm/numa_64.c +++ b/arch/x86/mm/numa_64.c | |||
@@ -540,8 +540,8 @@ void __init initmem_init(unsigned long start_pfn, unsigned long last_pfn, | |||
540 | #endif | 540 | #endif |
541 | 541 | ||
542 | #ifdef CONFIG_ACPI_NUMA | 542 | #ifdef CONFIG_ACPI_NUMA |
543 | if (!numa_off && !acpi_scan_nodes(start_pfn << PAGE_SHIFT, | 543 | if (!numa_off && acpi && !acpi_scan_nodes(start_pfn << PAGE_SHIFT, |
544 | last_pfn << PAGE_SHIFT)) | 544 | last_pfn << PAGE_SHIFT)) |
545 | return; | 545 | return; |
546 | nodes_clear(node_possible_map); | 546 | nodes_clear(node_possible_map); |
547 | nodes_clear(node_online_map); | 547 | nodes_clear(node_online_map); |
diff --git a/arch/x86/mm/srat_64.c b/arch/x86/mm/srat_64.c index dbb5381f7b3b..891cbe65b2d5 100644 --- a/arch/x86/mm/srat_64.c +++ b/arch/x86/mm/srat_64.c | |||
@@ -290,8 +290,6 @@ acpi_numa_memory_affinity_init(struct acpi_srat_mem_affinity *ma) | |||
290 | 290 | ||
291 | printk(KERN_INFO "SRAT: Node %u PXM %u %lx-%lx\n", node, pxm, | 291 | printk(KERN_INFO "SRAT: Node %u PXM %u %lx-%lx\n", node, pxm, |
292 | start, end); | 292 | start, end); |
293 | e820_register_active_regions(node, start >> PAGE_SHIFT, | ||
294 | end >> PAGE_SHIFT); | ||
295 | 293 | ||
296 | if (ma->flags & ACPI_SRAT_MEM_HOT_PLUGGABLE) { | 294 | if (ma->flags & ACPI_SRAT_MEM_HOT_PLUGGABLE) { |
297 | update_nodes_add(node, start, end); | 295 | update_nodes_add(node, start, end); |
@@ -338,6 +336,19 @@ static int __init nodes_cover_memory(const struct bootnode *nodes) | |||
338 | 336 | ||
339 | void __init acpi_numa_arch_fixup(void) {} | 337 | void __init acpi_numa_arch_fixup(void) {} |
340 | 338 | ||
339 | int __init acpi_get_nodes(struct bootnode *physnodes) | ||
340 | { | ||
341 | int i; | ||
342 | int ret = 0; | ||
343 | |||
344 | for_each_node_mask(i, nodes_parsed) { | ||
345 | physnodes[ret].start = nodes[i].start; | ||
346 | physnodes[ret].end = nodes[i].end; | ||
347 | ret++; | ||
348 | } | ||
349 | return ret; | ||
350 | } | ||
351 | |||
341 | /* Use the information discovered above to actually set up the nodes. */ | 352 | /* Use the information discovered above to actually set up the nodes. */ |
342 | int __init acpi_scan_nodes(unsigned long start, unsigned long end) | 353 | int __init acpi_scan_nodes(unsigned long start, unsigned long end) |
343 | { | 354 | { |
@@ -350,11 +361,6 @@ int __init acpi_scan_nodes(unsigned long start, unsigned long end) | |||
350 | for (i = 0; i < MAX_NUMNODES; i++) | 361 | for (i = 0; i < MAX_NUMNODES; i++) |
351 | cutoff_node(i, start, end); | 362 | cutoff_node(i, start, end); |
352 | 363 | ||
353 | if (!nodes_cover_memory(nodes)) { | ||
354 | bad_srat(); | ||
355 | return -1; | ||
356 | } | ||
357 | |||
358 | memnode_shift = compute_hash_shift(node_memblk_range, num_node_memblks, | 364 | memnode_shift = compute_hash_shift(node_memblk_range, num_node_memblks, |
359 | memblk_nodeid); | 365 | memblk_nodeid); |
360 | if (memnode_shift < 0) { | 366 | if (memnode_shift < 0) { |
@@ -364,6 +370,14 @@ int __init acpi_scan_nodes(unsigned long start, unsigned long end) | |||
364 | return -1; | 370 | return -1; |
365 | } | 371 | } |
366 | 372 | ||
373 | for_each_node_mask(i, nodes_parsed) | ||
374 | e820_register_active_regions(i, nodes[i].start >> PAGE_SHIFT, | ||
375 | nodes[i].end >> PAGE_SHIFT); | ||
376 | if (!nodes_cover_memory(nodes)) { | ||
377 | bad_srat(); | ||
378 | return -1; | ||
379 | } | ||
380 | |||
367 | /* Account for nodes with cpus and no memory */ | 381 | /* Account for nodes with cpus and no memory */ |
368 | nodes_or(node_possible_map, nodes_parsed, cpu_nodes_parsed); | 382 | nodes_or(node_possible_map, nodes_parsed, cpu_nodes_parsed); |
369 | 383 | ||
diff --git a/drivers/acpi/numa.c b/drivers/acpi/numa.c index 202dd0c976a3..2be2fb66204e 100644 --- a/drivers/acpi/numa.c +++ b/drivers/acpi/numa.c | |||
@@ -283,22 +283,24 @@ acpi_table_parse_srat(enum acpi_srat_type id, | |||
283 | 283 | ||
284 | int __init acpi_numa_init(void) | 284 | int __init acpi_numa_init(void) |
285 | { | 285 | { |
286 | int ret = 0; | ||
287 | |||
286 | /* SRAT: Static Resource Affinity Table */ | 288 | /* SRAT: Static Resource Affinity Table */ |
287 | if (!acpi_table_parse(ACPI_SIG_SRAT, acpi_parse_srat)) { | 289 | if (!acpi_table_parse(ACPI_SIG_SRAT, acpi_parse_srat)) { |
288 | acpi_table_parse_srat(ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY, | 290 | acpi_table_parse_srat(ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY, |
289 | acpi_parse_x2apic_affinity, NR_CPUS); | 291 | acpi_parse_x2apic_affinity, NR_CPUS); |
290 | acpi_table_parse_srat(ACPI_SRAT_TYPE_CPU_AFFINITY, | 292 | acpi_table_parse_srat(ACPI_SRAT_TYPE_CPU_AFFINITY, |
291 | acpi_parse_processor_affinity, NR_CPUS); | 293 | acpi_parse_processor_affinity, NR_CPUS); |
292 | acpi_table_parse_srat(ACPI_SRAT_TYPE_MEMORY_AFFINITY, | 294 | ret = acpi_table_parse_srat(ACPI_SRAT_TYPE_MEMORY_AFFINITY, |
293 | acpi_parse_memory_affinity, | 295 | acpi_parse_memory_affinity, |
294 | NR_NODE_MEMBLKS); | 296 | NR_NODE_MEMBLKS); |
295 | } | 297 | } |
296 | 298 | ||
297 | /* SLIT: System Locality Information Table */ | 299 | /* SLIT: System Locality Information Table */ |
298 | acpi_table_parse(ACPI_SIG_SLIT, acpi_parse_slit); | 300 | acpi_table_parse(ACPI_SIG_SLIT, acpi_parse_slit); |
299 | 301 | ||
300 | acpi_numa_arch_fixup(); | 302 | acpi_numa_arch_fixup(); |
301 | return 0; | 303 | return ret; |
302 | } | 304 | } |
303 | 305 | ||
304 | int acpi_get_pxm(acpi_handle h) | 306 | int acpi_get_pxm(acpi_handle h) |