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

Re: [Xen-devel] [RFC PATCH v1 18/21] ARM: NUMA: update node_distance with ACPI support



Hello Vijay,

On 09/02/17 15:57, vijay.kilari@xxxxxxxxx wrote:
From: Vijaya Kumar K <Vijaya.Kumar@xxxxxxxxxx>

Update node_distance() function to handle
ACPI SLIT table information.

Signed-off-by: Vijaya Kumar <Vijaya.Kumar@xxxxxxxxxx>
---
 xen/arch/arm/numa.c | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/numa.c b/xen/arch/arm/numa.c
index 5c49347..50c3dea 100644
--- a/xen/arch/arm/numa.c
+++ b/xen/arch/arm/numa.c
@@ -23,6 +23,7 @@
 #include <xen/acpi.h>
 #include <asm/mm.h>
 #include <xen/numa.h>
+#include <xen/srat.h>
 #include <asm/acpi.h>
 #include <xen/errno.h>
 #include <xen/cpumask.h>
@@ -35,6 +36,7 @@ extern struct node nodes[MAX_NUMNODES] __initdata;
 extern int num_node_memblks;
 extern struct node node_memblk_range[NR_NODE_MEMBLKS];
 extern nodeid_t memblk_nodeid[NR_NODE_MEMBLKS];
+extern struct acpi_table_slit *__read_mostly acpi_slit;

 void __init numa_set_cpu_node(int cpu, unsigned long hwid)
 {
@@ -50,9 +52,24 @@ void __init numa_set_cpu_node(int cpu, unsigned long hwid)

 u8 __node_distance(nodeid_t a, nodeid_t b)
 {
-    if ( !node_distance )
+    unsigned index;
+    u8 slit_val;
+
+    if ( !node_distance && !acpi_slit )
         return a == b ? 10 : 20;

+    if ( acpi_slit )
+    {
+        index = acpi_slit->locality_count * node_to_pxm(a);
+        slit_val = acpi_slit->entry[index + node_to_pxm(b)];
+
+        /* ACPI defines 0xff as an unreachable node and 0-9 are undefined */
+        if ( (slit_val == 0xff) || (slit_val <= 9) )
+            return NUMA_NO_DISTANCE;
+        else
+            return slit_val;
+    }
+

arm/numa.c is the generic code and should not contain any ACPI specific code.

But as I said, the way to get the distance on ACPI is the same on x86 and ARM.

So I would introduce __node_distance callback that will be setup at boot-time to either point to the ACPI version or DT version.

Regards,

--
Julien Grall

_______________________________________________
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®.