mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-19 02:04:19 +08:00
[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>
This commit is contained in:
parent
8a336b0a4b
commit
e3f1caeef9
@ -49,11 +49,8 @@ int __init k8_scan_nodes(unsigned long start, unsigned long end)
|
|||||||
int found = 0;
|
int found = 0;
|
||||||
u32 reg;
|
u32 reg;
|
||||||
unsigned numnodes;
|
unsigned numnodes;
|
||||||
nodemask_t nodes_parsed;
|
|
||||||
unsigned dualcore = 0;
|
unsigned dualcore = 0;
|
||||||
|
|
||||||
nodes_clear(nodes_parsed);
|
|
||||||
|
|
||||||
if (!early_pci_allowed())
|
if (!early_pci_allowed())
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
@ -102,7 +99,7 @@ int __init k8_scan_nodes(unsigned long start, unsigned long end)
|
|||||||
nodeid, (base>>8)&3, (limit>>8) & 3);
|
nodeid, (base>>8)&3, (limit>>8) & 3);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (node_isset(nodeid, nodes_parsed)) {
|
if (node_isset(nodeid, node_possible_map)) {
|
||||||
printk(KERN_INFO "Node %d already present. Skipping\n",
|
printk(KERN_INFO "Node %d already present. Skipping\n",
|
||||||
nodeid);
|
nodeid);
|
||||||
continue;
|
continue;
|
||||||
@ -155,7 +152,7 @@ int __init k8_scan_nodes(unsigned long start, unsigned long end)
|
|||||||
|
|
||||||
prevbase = base;
|
prevbase = base;
|
||||||
|
|
||||||
node_set(nodeid, nodes_parsed);
|
node_set(nodeid, node_possible_map);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!found)
|
if (!found)
|
||||||
|
@ -295,7 +295,7 @@ static int __init setup_node_range(int nid, struct bootnode *nodes, u64 *addr,
|
|||||||
ret = -1;
|
ret = -1;
|
||||||
}
|
}
|
||||||
nodes[nid].end = *addr;
|
nodes[nid].end = *addr;
|
||||||
node_set_online(nid);
|
node_set(nid, node_possible_map);
|
||||||
printk(KERN_INFO "Faking node %d at %016Lx-%016Lx (%LuMB)\n", nid,
|
printk(KERN_INFO "Faking node %d at %016Lx-%016Lx (%LuMB)\n", nid,
|
||||||
nodes[nid].start, nodes[nid].end,
|
nodes[nid].start, nodes[nid].end,
|
||||||
(nodes[nid].end - nodes[nid].start) >> 20);
|
(nodes[nid].end - nodes[nid].start) >> 20);
|
||||||
@ -479,7 +479,7 @@ out:
|
|||||||
* SRAT.
|
* SRAT.
|
||||||
*/
|
*/
|
||||||
remove_all_active_ranges();
|
remove_all_active_ranges();
|
||||||
for_each_online_node(i) {
|
for_each_node_mask(i, node_possible_map) {
|
||||||
e820_register_active_regions(i, nodes[i].start >> PAGE_SHIFT,
|
e820_register_active_regions(i, nodes[i].start >> PAGE_SHIFT,
|
||||||
nodes[i].end >> PAGE_SHIFT);
|
nodes[i].end >> PAGE_SHIFT);
|
||||||
setup_node_bootmem(i, nodes[i].start, nodes[i].end);
|
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)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
nodes_clear(node_possible_map);
|
||||||
|
|
||||||
#ifdef CONFIG_NUMA_EMU
|
#ifdef CONFIG_NUMA_EMU
|
||||||
if (cmdline && !numa_emulation(start_pfn, end_pfn))
|
if (cmdline && !numa_emulation(start_pfn, end_pfn))
|
||||||
return;
|
return;
|
||||||
|
nodes_clear(node_possible_map);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_ACPI_NUMA
|
#ifdef CONFIG_ACPI_NUMA
|
||||||
if (!numa_off && !acpi_scan_nodes(start_pfn << PAGE_SHIFT,
|
if (!numa_off && !acpi_scan_nodes(start_pfn << PAGE_SHIFT,
|
||||||
end_pfn << PAGE_SHIFT))
|
end_pfn << PAGE_SHIFT))
|
||||||
return;
|
return;
|
||||||
|
nodes_clear(node_possible_map);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_K8_NUMA
|
#ifdef CONFIG_K8_NUMA
|
||||||
if (!numa_off && !k8_scan_nodes(start_pfn<<PAGE_SHIFT, end_pfn<<PAGE_SHIFT))
|
if (!numa_off && !k8_scan_nodes(start_pfn<<PAGE_SHIFT, end_pfn<<PAGE_SHIFT))
|
||||||
return;
|
return;
|
||||||
|
nodes_clear(node_possible_map);
|
||||||
#endif
|
#endif
|
||||||
printk(KERN_INFO "%s\n",
|
printk(KERN_INFO "%s\n",
|
||||||
numa_off ? "NUMA turned off" : "No NUMA configuration found");
|
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)
|
|||||||
memnodemap[0] = 0;
|
memnodemap[0] = 0;
|
||||||
nodes_clear(node_online_map);
|
nodes_clear(node_online_map);
|
||||||
node_set_online(0);
|
node_set_online(0);
|
||||||
|
node_set(0, node_possible_map);
|
||||||
for (i = 0; i < NR_CPUS; i++)
|
for (i = 0; i < NR_CPUS; i++)
|
||||||
numa_set_node(i, 0);
|
numa_set_node(i, 0);
|
||||||
node_to_cpumask[0] = cpumask_of_cpu(0);
|
node_to_cpumask[0] = cpumask_of_cpu(0);
|
||||||
|
@ -419,19 +419,21 @@ int __init acpi_scan_nodes(unsigned long start, unsigned long end)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
node_possible_map = nodes_parsed;
|
||||||
|
|
||||||
/* Finally register nodes */
|
/* Finally register nodes */
|
||||||
for_each_node_mask(i, nodes_parsed)
|
for_each_node_mask(i, node_possible_map)
|
||||||
setup_node_bootmem(i, nodes[i].start, nodes[i].end);
|
setup_node_bootmem(i, nodes[i].start, nodes[i].end);
|
||||||
/* Try again in case setup_node_bootmem missed one due
|
/* Try again in case setup_node_bootmem missed one due
|
||||||
to missing bootmem */
|
to missing bootmem */
|
||||||
for_each_node_mask(i, nodes_parsed)
|
for_each_node_mask(i, node_possible_map)
|
||||||
if (!node_online(i))
|
if (!node_online(i))
|
||||||
setup_node_bootmem(i, nodes[i].start, nodes[i].end);
|
setup_node_bootmem(i, nodes[i].start, nodes[i].end);
|
||||||
|
|
||||||
for (i = 0; i < NR_CPUS; i++) {
|
for (i = 0; i < NR_CPUS; i++) {
|
||||||
if (cpu_to_node[i] == NUMA_NO_NODE)
|
if (cpu_to_node[i] == NUMA_NO_NODE)
|
||||||
continue;
|
continue;
|
||||||
if (!node_isset(cpu_to_node[i], nodes_parsed))
|
if (!node_isset(cpu_to_node[i], node_possible_map))
|
||||||
numa_set_node(i, NUMA_NO_NODE);
|
numa_set_node(i, NUMA_NO_NODE);
|
||||||
}
|
}
|
||||||
numa_init_array();
|
numa_init_array();
|
||||||
|
Loading…
Reference in New Issue
Block a user