Skip to content

Commit

Permalink
x86_64: fake apicid_to_node mapping for fake numa
Browse files Browse the repository at this point in the history
When we are in the emulated NUMA case, we need to make sure that all existing
apicid_to_node mappings that point to real node ID's now point to the
equivalent fake node ID's.

If we simply iterate over all apicid_to_node[] members for each node, we risk
remapping an entry if it shares a node ID with a real node.  Since apicid's
may not be consecutive, we're forced to create an automatic array of
apicid_to_node mappings and then copy it over once we have finished remapping
fake to real nodes.

Signed-off-by: David Rientjes <rientjes@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
David Rientjes authored and Linus Torvalds committed Jul 22, 2007
1 parent 3484d79 commit 08705b8
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion arch/x86_64/mm/srat.c
Original file line number Diff line number Diff line change
Expand Up @@ -470,10 +470,13 @@ static int __init find_node_by_addr(unsigned long addr)
*/
void __init acpi_fake_nodes(const struct bootnode *fake_nodes, int num_nodes)
{
int i;
int i, j;
int fake_node_to_pxm_map[MAX_NUMNODES] = {
[0 ... MAX_NUMNODES-1] = PXM_INVAL
};
unsigned char fake_apicid_to_node[MAX_LOCAL_APIC] = {
[0 ... MAX_LOCAL_APIC-1] = NUMA_NO_NODE
};

printk(KERN_INFO "Faking PXM affinity for fake nodes on real "
"topology.\n");
Expand All @@ -487,9 +490,17 @@ void __init acpi_fake_nodes(const struct bootnode *fake_nodes, int num_nodes)
if (pxm == PXM_INVAL)
continue;
fake_node_to_pxm_map[i] = pxm;
/*
* For each apicid_to_node mapping that exists for this real
* node, it must now point to the fake node ID.
*/
for (j = 0; j < MAX_LOCAL_APIC; j++)
if (apicid_to_node[j] == nid)
fake_apicid_to_node[j] = i;
}
for (i = 0; i < num_nodes; i++)
__acpi_map_pxm_to_node(fake_node_to_pxm_map[i], i);
memcpy(apicid_to_node, fake_apicid_to_node, sizeof(apicid_to_node));

nodes_clear(nodes_parsed);
for (i = 0; i < num_nodes; i++)
Expand Down

0 comments on commit 08705b8

Please sign in to comment.