[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [RFC PATCH v2 08/25] x86: NUMA: Sanitize node distance



From: Vijaya Kumar K <Vijaya.Kumar@xxxxxxxxxx>

Introduce acpi_node_distance() and call from __node_distance().
This helps to implement arch specific __node_distance().
Also introduce LOCAL_DISTANCE & REMOTE DISTANCE macros.

Signed-off-by: Vijaya Kumar K <Vijaya.Kumar@xxxxxxxxxx>
---
 xen/arch/x86/srat.c    | 13 +++++++++----
 xen/include/xen/numa.h |  2 ++
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/srat.c b/xen/arch/x86/srat.c
index 3ade36d..7cf4771 100644
--- a/xen/arch/x86/srat.c
+++ b/xen/arch/x86/srat.c
@@ -221,9 +221,9 @@ static int __init slit_valid(struct acpi_table_slit *slit)
                for (j = 0; j < d; j++)  {
                        uint8_t val = slit->entry[d*i + j];
                        if (i == j) {
-                               if (val != 10)
+                               if (val != LOCAL_DISTANCE)
                                        return 0;
-                       } else if (val <= 10)
+                       } else if (val <= LOCAL_DISTANCE)
                                return 0;
                }
        }
@@ -576,13 +576,13 @@ static unsigned node_to_pxm(nodeid_t n)
        return 0;
 }
 
-uint8_t __node_distance(nodeid_t a, nodeid_t b)
+static uint8_t acpi_node_distance(nodeid_t a, nodeid_t b)
 {
        unsigned index;
        uint8_t slit_val;
 
        if (!acpi_slit)
-               return a == b ? 10 : 20;
+               return a == b ? LOCAL_DISTANCE : REMOTE_DISTANCE;
        index = acpi_slit->locality_count * node_to_pxm(a);
        slit_val = acpi_slit->entry[index + node_to_pxm(b)];
 
@@ -593,4 +593,9 @@ uint8_t __node_distance(nodeid_t a, nodeid_t b)
                return slit_val;
 }
 
+uint8_t __node_distance(nodeid_t a, nodeid_t b)
+{
+       return acpi_node_distance(a, b);
+}
+
 EXPORT_SYMBOL(__node_distance);
diff --git a/xen/include/xen/numa.h b/xen/include/xen/numa.h
index 7f6d090..922fbd8 100644
--- a/xen/include/xen/numa.h
+++ b/xen/include/xen/numa.h
@@ -8,6 +8,8 @@
 #endif
 
 #define NUMA_NO_NODE     0xFF
+#define LOCAL_DISTANCE   10
+#define REMOTE_DISTANCE  20
 #define NUMA_NO_DISTANCE 0xFF
 
 #define MAX_NUMNODES    (1 << NODES_SHIFT)
-- 
2.7.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.