Commit ee3dae22 authored by Andi Kleen's avatar Andi Kleen Committed by Linus Torvalds

[PATCH] x86_64: Fix K8 NUMA discovery

Fix K8 node discovery after nodemask changes.
Signed-off-by: default avatarAndi Kleen <ak@suse.de>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 8f13ed2f
...@@ -47,6 +47,10 @@ int __init k8_scan_nodes(unsigned long start, unsigned long end) ...@@ -47,6 +47,10 @@ int __init k8_scan_nodes(unsigned long start, unsigned long end)
int nodeid, i, nb; int nodeid, i, nb;
int found = 0; int found = 0;
u32 reg; u32 reg;
unsigned numnodes;
nodemask_t nodes_parsed;
nodes_clear(nodes_parsed);
nb = find_northbridge(); nb = find_northbridge();
if (nb < 0) if (nb < 0)
...@@ -55,10 +59,9 @@ int __init k8_scan_nodes(unsigned long start, unsigned long end) ...@@ -55,10 +59,9 @@ int __init k8_scan_nodes(unsigned long start, unsigned long end)
printk(KERN_INFO "Scanning NUMA topology in Northbridge %d\n", nb); printk(KERN_INFO "Scanning NUMA topology in Northbridge %d\n", nb);
reg = read_pci_config(0, nb, 0, 0x60); reg = read_pci_config(0, nb, 0, 0x60);
for (i = 0; i <= ((reg >> 4) & 7); i++) numnodes = ((reg >> 4) & 7) + 1;
node_set_online(i);
printk(KERN_INFO "Number of nodes %d (%x)\n", num_online_nodes(), reg); printk(KERN_INFO "Number of nodes %d\n", numnodes);
memset(&nodes,0,sizeof(nodes)); memset(&nodes,0,sizeof(nodes));
prevbase = 0; prevbase = 0;
...@@ -70,11 +73,11 @@ int __init k8_scan_nodes(unsigned long start, unsigned long end) ...@@ -70,11 +73,11 @@ int __init k8_scan_nodes(unsigned long start, unsigned long end)
nodeid = limit & 7; nodeid = limit & 7;
if ((base & 3) == 0) { if ((base & 3) == 0) {
if (i < num_online_nodes()) if (i < numnodes)
printk("Skipping disabled node %d\n", i); printk("Skipping disabled node %d\n", i);
continue; continue;
} }
if (nodeid >= num_online_nodes()) { if (nodeid >= numnodes) {
printk("Ignoring excess node %d (%lx:%lx)\n", nodeid, printk("Ignoring excess node %d (%lx:%lx)\n", nodeid,
base, limit); base, limit);
continue; continue;
...@@ -90,7 +93,7 @@ int __init k8_scan_nodes(unsigned long start, unsigned long end) ...@@ -90,7 +93,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_online(nodeid)) { if (node_isset(nodeid, nodes_parsed)) {
printk(KERN_INFO "Node %d already present. Skipping\n", printk(KERN_INFO "Node %d already present. Skipping\n",
nodeid); nodeid);
continue; continue;
...@@ -138,6 +141,8 @@ int __init k8_scan_nodes(unsigned long start, unsigned long end) ...@@ -138,6 +141,8 @@ int __init k8_scan_nodes(unsigned long start, unsigned long end)
nodes[nodeid].end = limit; nodes[nodeid].end = limit;
prevbase = base; prevbase = base;
node_set(nodeid, nodes_parsed);
} }
if (!found) if (!found)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment