Skip to content

Commit 71e6fae

Browse files
npiggindgibson
authored andcommitted
spapr_numa.c: FORM2 table handle nodes with no distance info
A configuration that specifies multiple nodes without distance info results in the non-local points in the FORM2 matrix having a distance of 0. This causes Linux to complain "Invalid distance value range" because a node distance is smaller than the local distance. Fix this by building a simple local / remote fallback for points where distance information is missing. Signed-off-by: Nicholas Piggin <[email protected]> Message-Id: <[email protected]> Reviewed-by: Daniel Henrique Barboza <[email protected]> Signed-off-by: David Gibson <[email protected]>
1 parent 14fe322 commit 71e6fae

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

hw/ppc/spapr_numa.c

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -546,12 +546,24 @@ static void spapr_numa_FORM2_write_rtas_tables(SpaprMachineState *spapr,
546546
* NUMA nodes, but QEMU adds the default NUMA node without
547547
* adding the numa_info to retrieve distance info from.
548548
*/
549-
if (src == dst) {
550-
distance_table[i++] = NUMA_DISTANCE_MIN;
551-
continue;
549+
distance_table[i] = numa_info[src].distance[dst];
550+
if (distance_table[i] == 0) {
551+
/*
552+
* In case QEMU adds a default NUMA single node when the user
553+
* did not add any, or where the user did not supply distances,
554+
* the value will be 0 here. Populate the table with a fallback
555+
* simple local / remote distance.
556+
*/
557+
if (src == dst) {
558+
distance_table[i] = NUMA_DISTANCE_MIN;
559+
} else {
560+
distance_table[i] = numa_info[src].distance[dst];
561+
if (distance_table[i] < NUMA_DISTANCE_MIN) {
562+
distance_table[i] = NUMA_DISTANCE_DEFAULT;
563+
}
564+
}
552565
}
553-
554-
distance_table[i++] = numa_info[src].distance[dst];
566+
i++;
555567
}
556568
}
557569

0 commit comments

Comments
 (0)