Skip to content

Commit 3020394

Browse files
npigginmpe
authored andcommitted
powerpc/pseries: Fix numa FORM2 parsing fallback code
In case the FORM2 distance table from firmware is not the expected size, there is fallback code that just populates the lookup table as local vs remote. However it then continues on to use the distance table. Fix. Fixes: 1c6b5a7 ("powerpc/pseries: Add support for FORM2 associativity") Signed-off-by: Nicholas Piggin <[email protected]> Reviewed-by: Aneesh Kumar K.V <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 0bd8127 commit 3020394

File tree

1 file changed

+12
-16
lines changed

1 file changed

+12
-16
lines changed

arch/powerpc/mm/numa.c

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -407,30 +407,26 @@ static void initialize_form2_numa_distance_lookup_table(void)
407407

408408
if (form2_distances_length != max_numa_index * max_numa_index) {
409409
WARN(1, "Wrong NUMA distance information\n");
410-
/* consider everybody else just remote. */
411-
for (i = 0; i < max_numa_index; i++) {
412-
for (j = 0; j < max_numa_index; j++) {
413-
int nodeA = numa_id_index_table[i];
414-
int nodeB = numa_id_index_table[j];
415-
416-
if (nodeA == nodeB)
417-
numa_distance_table[nodeA][nodeB] = LOCAL_DISTANCE;
418-
else
419-
numa_distance_table[nodeA][nodeB] = REMOTE_DISTANCE;
420-
}
421-
}
410+
form2_distances = NULL; // don't use it
422411
}
423-
424412
distance_index = 0;
425413
for (i = 0; i < max_numa_index; i++) {
426414
for (j = 0; j < max_numa_index; j++) {
427415
int nodeA = numa_id_index_table[i];
428416
int nodeB = numa_id_index_table[j];
429-
430-
numa_distance_table[nodeA][nodeB] = form2_distances[distance_index++];
431-
pr_debug("dist[%d][%d]=%d ", nodeA, nodeB, numa_distance_table[nodeA][nodeB]);
417+
int dist;
418+
419+
if (form2_distances)
420+
dist = form2_distances[distance_index++];
421+
else if (nodeA == nodeB)
422+
dist = LOCAL_DISTANCE;
423+
else
424+
dist = REMOTE_DISTANCE;
425+
numa_distance_table[nodeA][nodeB] = dist;
426+
pr_debug("dist[%d][%d]=%d ", nodeA, nodeB, dist);
432427
}
433428
}
429+
434430
of_node_put(root);
435431
}
436432

0 commit comments

Comments
 (0)