diff options
author | Suresh Siddha <suresh.b.siddha@intel.com> | 2007-05-02 13:27:20 -0400 |
---|---|---|
committer | Andi Kleen <andi@basil.nowhere.org> | 2007-05-02 13:27:20 -0400 |
commit | e3f1caeef9a70b0699518092d653c15274b025ab (patch) | |
tree | 23d89175f809cb7a53377fa68b295f6ce162f99b | |
parent | 8a336b0a4b6dfacc8cc5fd617ba1e1904077de2d (diff) |
[PATCH] x86-64: set node_possible_map at runtime - try 2
Set the node_possible_map at runtime on x86_64. On a non NUMA system,
num_possible_nodes() will now say '1'.
Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
Signed-off-by: Andi Kleen <ak@suse.de>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Eric Dumazet <dada1@cosmosbay.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Christoph Lameter <clameter@engr.sgi.com>
-rw-r--r-- | arch/x86_64/mm/k8topology.c | 7 | ||||
-rw-r--r-- | arch/x86_64/mm/numa.c | 10 | ||||
-rw-r--r-- | arch/x86_64/mm/srat.c | 8 |
3 files changed, 15 insertions, 10 deletions
diff --git a/arch/x86_64/mm/k8topology.c b/arch/x86_64/mm/k8topology.c index b5b8dba28b4e..60e860e5ef4c 100644 --- a/arch/x86_64/mm/k8topology.c +++ b/arch/x86_64/mm/k8topology.c | |||
@@ -49,11 +49,8 @@ int __init k8_scan_nodes(unsigned long start, unsigned long end) | |||
49 | int found = 0; | 49 | int found = 0; |
50 | u32 reg; | 50 | u32 reg; |
51 | unsigned numnodes; | 51 | unsigned numnodes; |
52 | nodemask_t nodes_parsed; | ||
53 | unsigned dualcore = 0; | 52 | unsigned dualcore = 0; |
54 | 53 | ||
55 | nodes_clear(nodes_parsed); | ||
56 | |||
57 | if (!early_pci_allowed()) | 54 | if (!early_pci_allowed()) |
58 | return -1; | 55 | return -1; |
59 | 56 | ||
@@ -102,7 +99,7 @@ int __init k8_scan_nodes(unsigned long start, unsigned long end) | |||
102 | nodeid, (base>>8)&3, (limit>>8) & 3); | 99 | nodeid, (base>>8)&3, (limit>>8) & 3); |
103 | return -1; | 100 | return -1; |
104 | } | 101 | } |
105 | if (node_isset(nodeid, nodes_parsed)) { | 102 | if (node_isset(nodeid, node_possible_map)) { |
106 | printk(KERN_INFO "Node %d already present. Skipping\n", | 103 | printk(KERN_INFO "Node %d already present. Skipping\n", |
107 | nodeid); | 104 | nodeid); |
108 | continue; | 105 | continue; |
@@ -155,7 +152,7 @@ int __init k8_scan_nodes(unsigned long start, unsigned long end) | |||
155 | 152 | ||
156 | prevbase = base; | 153 | prevbase = base; |
157 | 154 | ||
158 | node_set(nodeid, nodes_parsed); | 155 | node_set(nodeid, node_possible_map); |
159 | } | 156 | } |
160 | 157 | ||
161 | if (!found) | 158 | if (!found) |
diff --git a/arch/x86_64/mm/numa.c b/arch/x86_64/mm/numa.c index 5ee07bc41eb5..51548947ad3b 100644 --- a/arch/x86_64/mm/numa.c +++ b/arch/x86_64/mm/numa.c | |||
@@ -295,7 +295,7 @@ static int __init setup_node_range(int nid, struct bootnode *nodes, u64 *addr, | |||
295 | ret = -1; | 295 | ret = -1; |
296 | } | 296 | } |
297 | nodes[nid].end = *addr; | 297 | nodes[nid].end = *addr; |
298 | node_set_online(nid); | 298 | node_set(nid, node_possible_map); |
299 | printk(KERN_INFO "Faking node %d at %016Lx-%016Lx (%LuMB)\n", nid, | 299 | printk(KERN_INFO "Faking node %d at %016Lx-%016Lx (%LuMB)\n", nid, |
300 | nodes[nid].start, nodes[nid].end, | 300 | nodes[nid].start, nodes[nid].end, |
301 | (nodes[nid].end - nodes[nid].start) >> 20); | 301 | (nodes[nid].end - nodes[nid].start) >> 20); |
@@ -479,7 +479,7 @@ out: | |||
479 | * SRAT. | 479 | * SRAT. |
480 | */ | 480 | */ |
481 | remove_all_active_ranges(); | 481 | remove_all_active_ranges(); |
482 | for_each_online_node(i) { | 482 | for_each_node_mask(i, node_possible_map) { |
483 | e820_register_active_regions(i, nodes[i].start >> PAGE_SHIFT, | 483 | e820_register_active_regions(i, nodes[i].start >> PAGE_SHIFT, |
484 | nodes[i].end >> PAGE_SHIFT); | 484 | nodes[i].end >> PAGE_SHIFT); |
485 | setup_node_bootmem(i, nodes[i].start, nodes[i].end); | 485 | setup_node_bootmem(i, nodes[i].start, nodes[i].end); |
@@ -494,20 +494,25 @@ void __init numa_initmem_init(unsigned long start_pfn, unsigned long end_pfn) | |||
494 | { | 494 | { |
495 | int i; | 495 | int i; |
496 | 496 | ||
497 | nodes_clear(node_possible_map); | ||
498 | |||
497 | #ifdef CONFIG_NUMA_EMU | 499 | #ifdef CONFIG_NUMA_EMU |
498 | if (cmdline && !numa_emulation(start_pfn, end_pfn)) | 500 | if (cmdline && !numa_emulation(start_pfn, end_pfn)) |
499 | return; | 501 | return; |
502 | nodes_clear(node_possible_map); | ||
500 | #endif | 503 | #endif |
501 | 504 | ||
502 | #ifdef CONFIG_ACPI_NUMA | 505 | #ifdef CONFIG_ACPI_NUMA |
503 | if (!numa_off && !acpi_scan_nodes(start_pfn << PAGE_SHIFT, | 506 | if (!numa_off && !acpi_scan_nodes(start_pfn << PAGE_SHIFT, |
504 | end_pfn << PAGE_SHIFT)) | 507 | end_pfn << PAGE_SHIFT)) |
505 | return; | 508 | return; |
509 | nodes_clear(node_possible_map); | ||
506 | #endif | 510 | #endif |
507 | 511 | ||
508 | #ifdef CONFIG_K8_NUMA | 512 | #ifdef CONFIG_K8_NUMA |
509 | if (!numa_off && !k8_scan_nodes(start_pfn<<PAGE_SHIFT, end_pfn<<PAGE_SHIFT)) | 513 | if (!numa_off && !k8_scan_nodes(start_pfn<<PAGE_SHIFT, end_pfn<<PAGE_SHIFT)) |
510 | return; | 514 | return; |
515 | nodes_clear(node_possible_map); | ||
511 | #endif | 516 | #endif |
512 | printk(KERN_INFO "%s\n", | 517 | printk(KERN_INFO "%s\n", |
513 | numa_off ? "NUMA turned off" : "No NUMA configuration found"); | 518 | numa_off ? "NUMA turned off" : "No NUMA configuration found"); |
@@ -521,6 +526,7 @@ void __init numa_initmem_init(unsigned long start_pfn, unsigned long end_pfn) | |||
521 | memnodemap[0] = 0; | 526 | memnodemap[0] = 0; |
522 | nodes_clear(node_online_map); | 527 | nodes_clear(node_online_map); |
523 | node_set_online(0); | 528 | node_set_online(0); |
529 | node_set(0, node_possible_map); | ||
524 | for (i = 0; i < NR_CPUS; i++) | 530 | for (i = 0; i < NR_CPUS; i++) |
525 | numa_set_node(i, 0); | 531 | numa_set_node(i, 0); |
526 | node_to_cpumask[0] = cpumask_of_cpu(0); | 532 | node_to_cpumask[0] = cpumask_of_cpu(0); |
diff --git a/arch/x86_64/mm/srat.c b/arch/x86_64/mm/srat.c index 2efe215fc76a..1e76bb0a7277 100644 --- a/arch/x86_64/mm/srat.c +++ b/arch/x86_64/mm/srat.c | |||
@@ -419,19 +419,21 @@ int __init acpi_scan_nodes(unsigned long start, unsigned long end) | |||
419 | return -1; | 419 | return -1; |
420 | } | 420 | } |
421 | 421 | ||
422 | node_possible_map = nodes_parsed; | ||
423 | |||
422 | /* Finally register nodes */ | 424 | /* Finally register nodes */ |
423 | for_each_node_mask(i, nodes_parsed) | 425 | for_each_node_mask(i, node_possible_map) |
424 | setup_node_bootmem(i, nodes[i].start, nodes[i].end); | 426 | setup_node_bootmem(i, nodes[i].start, nodes[i].end); |
425 | /* Try again in case setup_node_bootmem missed one due | 427 | /* Try again in case setup_node_bootmem missed one due |
426 | to missing bootmem */ | 428 | to missing bootmem */ |
427 | for_each_node_mask(i, nodes_parsed) | 429 | for_each_node_mask(i, node_possible_map) |
428 | if (!node_online(i)) | 430 | if (!node_online(i)) |
429 | setup_node_bootmem(i, nodes[i].start, nodes[i].end); | 431 | setup_node_bootmem(i, nodes[i].start, nodes[i].end); |
430 | 432 | ||
431 | for (i = 0; i < NR_CPUS; i++) { | 433 | for (i = 0; i < NR_CPUS; i++) { |
432 | if (cpu_to_node[i] == NUMA_NO_NODE) | 434 | if (cpu_to_node[i] == NUMA_NO_NODE) |
433 | continue; | 435 | continue; |
434 | if (!node_isset(cpu_to_node[i], nodes_parsed)) | 436 | if (!node_isset(cpu_to_node[i], node_possible_map)) |
435 | numa_set_node(i, NUMA_NO_NODE); | 437 | numa_set_node(i, NUMA_NO_NODE); |
436 | } | 438 | } |
437 | numa_init_array(); | 439 | numa_init_array(); |