]> git.baikalelectronics.ru Git - kernel.git/commitdiff
powerpc/pseries: Add a helper for form1 cpu distance
authorAneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Thu, 12 Aug 2021 13:22:22 +0000 (18:52 +0530)
committerMichael Ellerman <mpe@ellerman.id.au>
Fri, 13 Aug 2021 12:04:27 +0000 (22:04 +1000)
This helper is only used with the dispatch trace log collection.
A later patch will add Form2 affinity support and this change helps
in keeping that simpler. Also add a comment explaining we don't expect
the code to be called with FORM0

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20210812132223.225214-5-aneesh.kumar@linux.ibm.com
arch/powerpc/include/asm/topology.h
arch/powerpc/mm/numa.c
arch/powerpc/platforms/pseries/lpar.c

index a6425a70c37b75f7cbeb0f279918b58b22f15983..a4712ecad3e9f8c1ec37eb00b15d4a5806520568 100644 (file)
@@ -36,7 +36,7 @@ static inline int pcibus_to_node(struct pci_bus *bus)
                                 cpu_all_mask :                         \
                                 cpumask_of_node(pcibus_to_node(bus)))
 
-extern int cpu_distance(__be32 *cpu1_assoc, __be32 *cpu2_assoc);
+int cpu_relative_distance(__be32 *cpu1_assoc, __be32 *cpu2_assoc);
 extern int __node_distance(int, int);
 #define node_distance(a, b) __node_distance(a, b)
 
@@ -84,7 +84,7 @@ static inline void sysfs_remove_device_from_node(struct device *dev,
 
 static inline void update_numa_cpu_lookup_table(unsigned int cpu, int node) {}
 
-static inline int cpu_distance(__be32 *cpu1_assoc, __be32 *cpu2_assoc)
+static inline int cpu_relative_distance(__be32 *cpu1_assoc, __be32 *cpu2_assoc)
 {
        return 0;
 }
index 3cda37c52f2639d3a704d1444d0e5551db63b4cf..fe3a9a38eddf95e36ff6dc3c72877c69e054e6de 100644 (file)
@@ -166,7 +166,7 @@ static void unmap_cpu_from_node(unsigned long cpu)
 }
 #endif /* CONFIG_HOTPLUG_CPU || CONFIG_PPC_SPLPAR */
 
-int cpu_distance(__be32 *cpu1_assoc, __be32 *cpu2_assoc)
+static int __cpu_form1_relative_distance(__be32 *cpu1_assoc, __be32 *cpu2_assoc)
 {
        int dist = 0;
 
@@ -182,6 +182,14 @@ int cpu_distance(__be32 *cpu1_assoc, __be32 *cpu2_assoc)
        return dist;
 }
 
+int cpu_relative_distance(__be32 *cpu1_assoc, __be32 *cpu2_assoc)
+{
+       /* We should not get called with FORM0 */
+       VM_WARN_ON(affinity_form == FORM0_AFFINITY);
+
+       return __cpu_form1_relative_distance(cpu1_assoc, cpu2_assoc);
+}
+
 /* must hold reference to node during call */
 static const __be32 *of_get_associativity(struct device_node *dev)
 {
index bd1fcb0881ea892a7c2a6aa4cfcb4b4d27dfb7e7..3df6bdfea475ad52d65c17bda4f7384515a1b2bf 100644 (file)
@@ -262,7 +262,7 @@ static int cpu_relative_dispatch_distance(int last_disp_cpu, int cur_disp_cpu)
        if (!last_disp_cpu_assoc || !cur_disp_cpu_assoc)
                return -EIO;
 
-       return cpu_distance(last_disp_cpu_assoc, cur_disp_cpu_assoc);
+       return cpu_relative_distance(last_disp_cpu_assoc, cur_disp_cpu_assoc);
 }
 
 static int cpu_home_node_dispatch_distance(int disp_cpu)
@@ -282,7 +282,7 @@ static int cpu_home_node_dispatch_distance(int disp_cpu)
        if (!disp_cpu_assoc || !vcpu_assoc)
                return -EIO;
 
-       return cpu_distance(disp_cpu_assoc, vcpu_assoc);
+       return cpu_relative_distance(disp_cpu_assoc, vcpu_assoc);
 }
 
 static void update_vcpu_disp_stat(int disp_cpu)