* [PATCH v2 1/2] powerpc/pseries: rename numa_dist_table to form2_distances
@ 2021-11-09 6:48 Nicholas Piggin
2021-11-09 6:49 ` [PATCH v2 2/2] powerpc/pseries: Fix numa FORM2 parsing fallback code Nicholas Piggin
2021-11-17 11:23 ` [PATCH v2 1/2] powerpc/pseries: rename numa_dist_table to form2_distances Michael Ellerman
0 siblings, 2 replies; 3+ messages in thread
From: Nicholas Piggin @ 2021-11-09 6:48 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Aneesh Kumar K . V, Nicholas Piggin
The name of the local variable holding the "form2" property address
conflicts with the numa_distance_table global.
This patch does 's/numa_dist_table/form2_distances/g' over the function,
which also renames numa_dist_table_length to form2_distances_length.
Suggested-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
arch/powerpc/mm/numa.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index 6f14c8fb6359..53e990140916 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -376,9 +376,9 @@ static void initialize_form2_numa_distance_lookup_table(void)
{
int i, j;
struct device_node *root;
- const __u8 *numa_dist_table;
+ const __u8 *form2_distances;
const __be32 *numa_lookup_index;
- int numa_dist_table_length;
+ int form2_distances_length;
int max_numa_index, distance_index;
if (firmware_has_feature(FW_FEATURE_OPAL))
@@ -392,20 +392,20 @@ static void initialize_form2_numa_distance_lookup_table(void)
max_numa_index = of_read_number(&numa_lookup_index[0], 1);
/* first element of the array is the size and is encode-int */
- numa_dist_table = of_get_property(root, "ibm,numa-distance-table", NULL);
- numa_dist_table_length = of_read_number((const __be32 *)&numa_dist_table[0], 1);
+ form2_distances = of_get_property(root, "ibm,numa-distance-table", NULL);
+ form2_distances_length = of_read_number((const __be32 *)&form2_distances[0], 1);
/* Skip the size which is encoded int */
- numa_dist_table += sizeof(__be32);
+ form2_distances += sizeof(__be32);
- pr_debug("numa_dist_table_len = %d, numa_dist_indexes_len = %d\n",
- numa_dist_table_length, max_numa_index);
+ pr_debug("form2_distances_len = %d, numa_dist_indexes_len = %d\n",
+ form2_distances_length, max_numa_index);
for (i = 0; i < max_numa_index; i++)
/* +1 skip the max_numa_index in the property */
numa_id_index_table[i] = of_read_number(&numa_lookup_index[i + 1], 1);
- if (numa_dist_table_length != max_numa_index * max_numa_index) {
+ if (form2_distances_length != max_numa_index * max_numa_index) {
WARN(1, "Wrong NUMA distance information\n");
/* consider everybody else just remote. */
for (i = 0; i < max_numa_index; i++) {
@@ -427,7 +427,7 @@ static void initialize_form2_numa_distance_lookup_table(void)
int nodeA = numa_id_index_table[i];
int nodeB = numa_id_index_table[j];
- numa_distance_table[nodeA][nodeB] = numa_dist_table[distance_index++];
+ numa_distance_table[nodeA][nodeB] = form2_distances[distance_index++];
pr_debug("dist[%d][%d]=%d ", nodeA, nodeB, numa_distance_table[nodeA][nodeB]);
}
}
--
2.23.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH v2 2/2] powerpc/pseries: Fix numa FORM2 parsing fallback code
2021-11-09 6:48 [PATCH v2 1/2] powerpc/pseries: rename numa_dist_table to form2_distances Nicholas Piggin
@ 2021-11-09 6:49 ` Nicholas Piggin
2021-11-17 11:23 ` [PATCH v2 1/2] powerpc/pseries: rename numa_dist_table to form2_distances Michael Ellerman
1 sibling, 0 replies; 3+ messages in thread
From: Nicholas Piggin @ 2021-11-09 6:49 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Aneesh Kumar K . V, Nicholas Piggin
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.
Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Fixes: 1c6b5a7e7405 ("powerpc/pseries: Add support for FORM2 associativity")
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
This just rebases on the rename, and sets form2_distances pointer to
NULL rather than using a separate good variable.
Thanks,
Nick
arch/powerpc/mm/numa.c | 28 ++++++++++++----------------
1 file changed, 12 insertions(+), 16 deletions(-)
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index 53e990140916..59d3cfcd7887 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -407,30 +407,26 @@ static void initialize_form2_numa_distance_lookup_table(void)
if (form2_distances_length != max_numa_index * max_numa_index) {
WARN(1, "Wrong NUMA distance information\n");
- /* consider everybody else just remote. */
- for (i = 0; i < max_numa_index; i++) {
- for (j = 0; j < max_numa_index; j++) {
- int nodeA = numa_id_index_table[i];
- int nodeB = numa_id_index_table[j];
-
- if (nodeA == nodeB)
- numa_distance_table[nodeA][nodeB] = LOCAL_DISTANCE;
- else
- numa_distance_table[nodeA][nodeB] = REMOTE_DISTANCE;
- }
- }
+ form2_distances = NULL; // don't use it
}
-
distance_index = 0;
for (i = 0; i < max_numa_index; i++) {
for (j = 0; j < max_numa_index; j++) {
int nodeA = numa_id_index_table[i];
int nodeB = numa_id_index_table[j];
-
- numa_distance_table[nodeA][nodeB] = form2_distances[distance_index++];
- pr_debug("dist[%d][%d]=%d ", nodeA, nodeB, numa_distance_table[nodeA][nodeB]);
+ int dist;
+
+ if (form2_distances)
+ dist = form2_distances[distance_index++];
+ else if (nodeA == nodeB)
+ dist = LOCAL_DISTANCE;
+ else
+ dist = REMOTE_DISTANCE;
+ numa_distance_table[nodeA][nodeB] = dist;
+ pr_debug("dist[%d][%d]=%d ", nodeA, nodeB, dist);
}
}
+
of_node_put(root);
}
--
2.23.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2 1/2] powerpc/pseries: rename numa_dist_table to form2_distances
2021-11-09 6:48 [PATCH v2 1/2] powerpc/pseries: rename numa_dist_table to form2_distances Nicholas Piggin
2021-11-09 6:49 ` [PATCH v2 2/2] powerpc/pseries: Fix numa FORM2 parsing fallback code Nicholas Piggin
@ 2021-11-17 11:23 ` Michael Ellerman
1 sibling, 0 replies; 3+ messages in thread
From: Michael Ellerman @ 2021-11-17 11:23 UTC (permalink / raw)
To: linuxppc-dev, Nicholas Piggin; +Cc: Aneesh Kumar K . V
On Tue, 9 Nov 2021 16:48:59 +1000, Nicholas Piggin wrote:
> The name of the local variable holding the "form2" property address
> conflicts with the numa_distance_table global.
>
> This patch does 's/numa_dist_table/form2_distances/g' over the function,
> which also renames numa_dist_table_length to form2_distances_length.
>
>
> [...]
Applied to powerpc/fixes.
[1/2] powerpc/pseries: rename numa_dist_table to form2_distances
https://git.kernel.org/powerpc/c/0bd81274e3f1195ee7c820ef02d62f31077c42c3
[2/2] powerpc/pseries: Fix numa FORM2 parsing fallback code
https://git.kernel.org/powerpc/c/302039466f6a3b9421ecb9a6a2c528801dc24a86
cheers
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-11-17 11:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-09 6:48 [PATCH v2 1/2] powerpc/pseries: rename numa_dist_table to form2_distances Nicholas Piggin
2021-11-09 6:49 ` [PATCH v2 2/2] powerpc/pseries: Fix numa FORM2 parsing fallback code Nicholas Piggin
2021-11-17 11:23 ` [PATCH v2 1/2] powerpc/pseries: rename numa_dist_table to form2_distances Michael Ellerman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).