Re: [Xen-devel] [RFC PATCH v1 18/21] ARM: NUMA: update node_distance with ACPI support
Hello Vijay, On 03/03/17 12:43, Vijay Kilari wrote: On Thu, Mar 2, 2017 at 10:54 PM, Julien Grallwrote: Hello Vijay, On 09/02/17 15:57, vijay.kil...@gmail.com wrote: From: Vijaya Kumar K Update node_distance() function to handle ACPI SLIT table information. Signed-off-by: Vijaya Kumar --- 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 #include #include +#include #include #include #include @@ -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. Agreed. 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. Instead of callback, Just call acpi's node_distance function if acpi is enabled or else dt based. Why? I don't see any reason to want checking whether acpi is enabled everytime __node_distance is called. The value will never change at runtime. Regards, -- Julien Grall ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
Re: [Xen-devel] [RFC PATCH v1 18/21] ARM: NUMA: update node_distance with ACPI support
On Thu, Mar 2, 2017 at 10:54 PM, Julien Grallwrote: > Hello Vijay, > > > On 09/02/17 15:57, vijay.kil...@gmail.com wrote: >> >> From: Vijaya Kumar K >> >> Update node_distance() function to handle >> ACPI SLIT table information. >> >> Signed-off-by: Vijaya Kumar >> --- >> 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 >> #include >> #include >> +#include >> #include >> #include >> #include >> @@ -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. Agreed. > > 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. Instead of callback, Just call acpi's node_distance function if acpi is enabled or else dt based. ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
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.kil...@gmail.com wrote: From: Vijaya Kumar KUpdate node_distance() function to handle ACPI SLIT table information. Signed-off-by: Vijaya Kumar --- 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 #include #include +#include #include #include #include @@ -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@lists.xen.org https://lists.xen.org/xen-devel
[Xen-devel] [RFC PATCH v1 18/21] ARM: NUMA: update node_distance with ACPI support
From: Vijaya Kumar KUpdate node_distance() function to handle ACPI SLIT table information. Signed-off-by: Vijaya Kumar --- 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 #include #include +#include #include #include #include @@ -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; +} + return _node_distance[a * MAX_NUMNODES + b]; } @@ -140,6 +157,7 @@ static void __init numa_dummy_init(unsigned long start_pfn, nodes_clear(node_online_map); node_set_online(0); +acpi_slit = NULL; for ( i = 0; i < NR_CPUS; i++ ) numa_set_node(i, 0); -- 2.7.4 ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel