Skip to content

Commit ba6b1d0

Browse files
mwbringmannZhengShunQian
authored andcommitted
powerpc/numa: Use ibm,max-associativity-domains to discover possible nodes
[ Upstream commit a346137 ] On powerpc systems which allow 'hot-add' of CPU or memory resources, it may occur that the new resources are to be inserted into nodes that were not used for these resources at bootup. In the kernel, any node that is used must be defined and initialized. These empty nodes may occur when, * Dedicated vs. shared resources. Shared resources require information such as the VPHN hcall for CPU assignment to nodes. Associativity decisions made based on dedicated resource rules, such as associativity properties in the device tree, may vary from decisions made using the values returned by the VPHN hcall. * memoryless nodes at boot. Nodes need to be defined as 'possible' at boot for operation with other code modules. Previously, the powerpc code would limit the set of possible nodes to those which have memory assigned at boot, and were thus online. Subsequent add/remove of CPUs or memory would only work with this subset of possible nodes. * memoryless nodes with CPUs at boot. Due to the previous restriction on nodes, nodes that had CPUs but no memory were being collapsed into other nodes that did have memory at boot. In practice this meant that the node assignment presented by the runtime kernel differed from the affinity and associativity attributes presented by the device tree or VPHN hcalls. Nodes that might be known to the pHyp were not 'possible' in the runtime kernel because they did not have memory at boot. This patch ensures that sufficient nodes are defined to support configuration requirements after boot, as well as at boot. This patch set fixes a couple of problems. * Nodes known to powerpc to be memoryless at boot, but to have CPUs in them are allowed to be 'possible' and 'online'. Memory allocations for those nodes are taken from another node that does have memory until and if memory is hot-added to the node. * Nodes which have no resources assigned at boot, but which may still be referenced subsequently by affinity or associativity attributes, are kept in the list of 'possible' nodes for powerpc. Hot-add of memory or CPUs to the system can reference these nodes and bring them online instead of redirecting to one of the set of nodes that were known to have memory at boot. This patch extracts the value of the lowest domain level (number of allocable resources) from the device tree property "ibm,max-associativity-domains" to use as the maximum number of nodes to setup as possibly available in the system. This new setting will override the instruction: nodes_and(node_possible_map, node_possible_map, node_online_map); presently seen in the function arch/powerpc/mm/numa.c:initmem_init(). If the "ibm,max-associativity-domains" property is not present at boot, no operation will be performed to define or enable additional nodes, or enable the above 'nodes_and()'. Signed-off-by: Michael Bringmann <[email protected]> Reviewed-by: Nathan Fontenot <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Signed-off-by: Sasha Levin <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent dcdbe01 commit ba6b1d0

File tree

1 file changed

+34
-3
lines changed

1 file changed

+34
-3
lines changed

arch/powerpc/mm/numa.c

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -951,6 +951,34 @@ static void __init setup_node_data(int nid, u64 start_pfn, u64 end_pfn)
951951
NODE_DATA(nid)->node_spanned_pages = spanned_pages;
952952
}
953953

954+
static void __init find_possible_nodes(void)
955+
{
956+
struct device_node *rtas;
957+
u32 numnodes, i;
958+
959+
if (min_common_depth <= 0)
960+
return;
961+
962+
rtas = of_find_node_by_path("/rtas");
963+
if (!rtas)
964+
return;
965+
966+
if (of_property_read_u32_index(rtas,
967+
"ibm,max-associativity-domains",
968+
min_common_depth, &numnodes))
969+
goto out;
970+
971+
for (i = 0; i < numnodes; i++) {
972+
if (!node_possible(i)) {
973+
setup_node_data(i, 0, 0);
974+
node_set(i, node_possible_map);
975+
}
976+
}
977+
978+
out:
979+
of_node_put(rtas);
980+
}
981+
954982
void __init initmem_init(void)
955983
{
956984
int nid, cpu;
@@ -966,12 +994,15 @@ void __init initmem_init(void)
966994
memblock_dump_all();
967995

968996
/*
969-
* Reduce the possible NUMA nodes to the online NUMA nodes,
970-
* since we do not support node hotplug. This ensures that we
971-
* lower the maximum NUMA node ID to what is actually present.
997+
* Modify the set of possible NUMA nodes to reflect information
998+
* available about the set of online nodes, and the set of nodes
999+
* that we expect to make use of for this platform's affinity
1000+
* calculations.
9721001
*/
9731002
nodes_and(node_possible_map, node_possible_map, node_online_map);
9741003

1004+
find_possible_nodes();
1005+
9751006
for_each_online_node(nid) {
9761007
unsigned long start_pfn, end_pfn;
9771008

0 commit comments

Comments
 (0)