Skip to contentSkip to conversation

Some Problems about Xen Numa support $B!*(B

DISCUSSION Keir Fraser 1 participant 1 message May 27, 2008 1 message not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive

Probably Linux lets yuou specify NUMA topology on the command line, or something like that, and the loop you point out is inherited from that support.

-- Keir

Quoted 46 lines · 李亚琼

Hi,All
I am reading the concerned source code of Numa support in Xen source
tree. I have been puzzled with the initialization of Numa support. During the initialization, the function ‘acpi_scan_nodes’ is called to scan the information about numa system. It converts some temporary variables into final variables, such as nodes -> node_data。My puzzles locate in the last lines of this function:
int __init acpi_scan_nodes(u64 start, u64 end)
{
………

         /* Finally register nodes */
         for_each_node_mask(i, nodes_parsed)
                  setup_node_bootmem(i, nodes[i].start, nodes[i].end);
         for (i = 0; i < NR_CPUS; i++) {
                  if (cpu_to_node[i] == NUMA_NO_NODE)
                           continue;
                  if (!node_isset(cpu_to_node[i], nodes_parsed))
                           numa_set_node(i, NUMA_NO_NODE);
         }
        numa_init_array();
        return 0;
}

According my study, the variable ‘cpu_to_node’ has a unified value—NUMA_NO_NODE before this codes being executed. So, the ‘for loop’ will have no effect. Is it correct?
The following function ‘numa_init_array’ will be called. Its source code is here:
void __init numa_init_array(void)

{
         int rr, i;
         /* There are unfortunately some poorly designed mainboards around
           that only connect memory to a single CPU. This breaks the 1:1
cpu->node
           mapping. To avoid this fill in the mapping for all possible
           CPUs, as the number of CPUs is not known yet.
           We round robin the existing nodes. */
         rr = first_node(node_online_map);
         for (i = 0; i < NR_CPUS; i++) {
                  if (cpu_to_node[i] != NUMA_NO_NODE)
                           continue;
                 numa_set_node(i, rr);
                  rr = next_node(rr, node_online_map);
                  if (rr == MAX_NUMNODES)
                           rr = first_node(node_online_map);
         }
Quoted 9 lines

}
I don’t understand why it is called here. I think it should be called after cpu_to_node being initialized with correct value.
Thanks a lot!

-Techie

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel