diff mbox

[RFC,v2,05/25] x86: NUMA: Move generic dummy_numa_init to separate function

Message ID 1490716413-19796-6-git-send-email-vijay.kilari@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Vijay Kilari March 28, 2017, 3:53 p.m. UTC
From: Vijaya Kumar K <Vijaya.Kumar@cavium.com>

Split numa_initmem_init() so that the numa fallback code is moved
as separate function which is generic.

Signed-off-by: Vijaya Kumar K <Vijaya.Kumar@cavium.com>
---
 xen/arch/x86/numa.c | 29 +++++++++++++++++------------
 1 file changed, 17 insertions(+), 12 deletions(-)

Comments

Julien Grall April 20, 2017, 4:12 p.m. UTC | #1
Hi Vijay,

On 28/03/17 16:53, vijay.kilari@gmail.com wrote:
> From: Vijaya Kumar K <Vijaya.Kumar@cavium.com>
>
> Split numa_initmem_init() so that the numa fallback code is moved
> as separate function which is generic.
>
> Signed-off-by: Vijaya Kumar K <Vijaya.Kumar@cavium.com>
> ---
>  xen/arch/x86/numa.c | 29 +++++++++++++++++------------
>  1 file changed, 17 insertions(+), 12 deletions(-)
>
> diff --git a/xen/arch/x86/numa.c b/xen/arch/x86/numa.c
> index 6b794a7..0888d53 100644
> --- a/xen/arch/x86/numa.c
> +++ b/xen/arch/x86/numa.c
> @@ -268,21 +268,10 @@ static int __init numa_emulation(uint64_t start_pfn, uint64_t end_pfn)
>  }
>  #endif
>
> -void __init numa_initmem_init(unsigned long start_pfn, unsigned long end_pfn)
> +static void __init numa_dummy_init(unsigned long start_pfn, unsigned long end_pfn)
>  {
>      int i;
>
> -#ifdef CONFIG_NUMA_EMU
> -    if ( get_numa_fake() && !numa_emulation(start_pfn, end_pfn) )
> -        return;
> -#endif
> -
> -#ifdef CONFIG_ACPI_NUMA
> -    if ( !is_numa_off() && !acpi_scan_nodes((uint64_t)start_pfn << PAGE_SHIFT,
> -         (uint64_t)end_pfn << PAGE_SHIFT) )
> -        return;
> -#endif
> -
>      printk(KERN_INFO "%s\n",
>             is_numa_off() ? "NUMA turned off" : "No NUMA configuration found");
>
> @@ -301,6 +290,22 @@ void __init numa_initmem_init(unsigned long start_pfn, unsigned long end_pfn)
>                      (paddr_t)end_pfn << PAGE_SHIFT);
>  }
>
> +void __init numa_initmem_init(unsigned long start_pfn, unsigned long end_pfn)
> +{
> +#ifdef CONFIG_NUMA_EMU
> +    if ( get_numa_fake() && !numa_emulation(start_pfn, end_pfn) )
> +        return;
> +#endif

I am not sure where to comment about it in this series, so I will say it 
here.

As asked on v1, why don't you consider fake NUMA? This would help to 
test the series on non-NUMA platform.

> +
> +#ifdef CONFIG_ACPI_NUMA
> +    if ( !is_numa_off() && !acpi_scan_nodes((uint64_t)start_pfn << PAGE_SHIFT,
> +         (uint64_t)end_pfn << PAGE_SHIFT) )
> +        return;
> +#endif
> +
> +    numa_dummy_init(start_pfn, end_pfn);
> +}
> +
>  void numa_add_cpu(int cpu)
>  {
>      cpumask_set_cpu(cpu, &node_to_cpumask[cpu_to_node(cpu)]);
>

Cheers,
Vijay Kilari April 25, 2017, 6:59 a.m. UTC | #2
On Thu, Apr 20, 2017 at 9:42 PM, Julien Grall <julien.grall@arm.com> wrote:
> Hi Vijay,
>
>
> On 28/03/17 16:53, vijay.kilari@gmail.com wrote:
>>
>> From: Vijaya Kumar K <Vijaya.Kumar@cavium.com>
>>
>> Split numa_initmem_init() so that the numa fallback code is moved
>> as separate function which is generic.
>>
>> Signed-off-by: Vijaya Kumar K <Vijaya.Kumar@cavium.com>
>> ---
>>  xen/arch/x86/numa.c | 29 +++++++++++++++++------------
>>  1 file changed, 17 insertions(+), 12 deletions(-)
>>
>> diff --git a/xen/arch/x86/numa.c b/xen/arch/x86/numa.c
>> index 6b794a7..0888d53 100644
>> --- a/xen/arch/x86/numa.c
>> +++ b/xen/arch/x86/numa.c
>> @@ -268,21 +268,10 @@ static int __init numa_emulation(uint64_t start_pfn,
>> uint64_t end_pfn)
>>  }
>>  #endif
>>
>> -void __init numa_initmem_init(unsigned long start_pfn, unsigned long
>> end_pfn)
>> +static void __init numa_dummy_init(unsigned long start_pfn, unsigned long
>> end_pfn)
>>  {
>>      int i;
>>
>> -#ifdef CONFIG_NUMA_EMU
>> -    if ( get_numa_fake() && !numa_emulation(start_pfn, end_pfn) )
>> -        return;
>> -#endif
>> -
>> -#ifdef CONFIG_ACPI_NUMA
>> -    if ( !is_numa_off() && !acpi_scan_nodes((uint64_t)start_pfn <<
>> PAGE_SHIFT,
>> -         (uint64_t)end_pfn << PAGE_SHIFT) )
>> -        return;
>> -#endif
>> -
>>      printk(KERN_INFO "%s\n",
>>             is_numa_off() ? "NUMA turned off" : "No NUMA configuration
>> found");
>>
>> @@ -301,6 +290,22 @@ void __init numa_initmem_init(unsigned long
>> start_pfn, unsigned long end_pfn)
>>                      (paddr_t)end_pfn << PAGE_SHIFT);
>>  }
>>
>> +void __init numa_initmem_init(unsigned long start_pfn, unsigned long
>> end_pfn)
>> +{
>> +#ifdef CONFIG_NUMA_EMU
>> +    if ( get_numa_fake() && !numa_emulation(start_pfn, end_pfn) )
>> +        return;
>> +#endif
>
>
> I am not sure where to comment about it in this series, so I will say it
> here.
>
> As asked on v1, why don't you consider fake NUMA? This would help to test
> the series on non-NUMA platform.

I have not tested non-NUMA case with this series. Agreed this two
lines should be added
to numa_initmem_init() of arm (xen/arch/arm/numa/numa.c)

>
>> +
>> +#ifdef CONFIG_ACPI_NUMA
>> +    if ( !is_numa_off() && !acpi_scan_nodes((uint64_t)start_pfn <<
>> PAGE_SHIFT,
>> +         (uint64_t)end_pfn << PAGE_SHIFT) )
>> +        return;
>> +#endif
>> +
>> +    numa_dummy_init(start_pfn, end_pfn);
>> +}
>> +
>>  void numa_add_cpu(int cpu)
>>  {
>>      cpumask_set_cpu(cpu, &node_to_cpumask[cpu_to_node(cpu)]);
>>
>
> Cheers,
>
> --
>  Julien Grall
Jan Beulich June 30, 2017, 2:08 p.m. UTC | #3
>>> <vijay.kilari@gmail.com> 03/28/17 5:54 PM >>>
> @@ -301,6 +290,22 @@ void __init numa_initmem_init(unsigned long start_pfn, unsigned long end_pfn)
>                      (paddr_t)end_pfn << PAGE_SHIFT);
>  }
>  
> +void __init numa_initmem_init(unsigned long start_pfn, unsigned long end_pfn)
> +{
> +#ifdef CONFIG_NUMA_EMU
> +    if ( get_numa_fake() && !numa_emulation(start_pfn, end_pfn) )
> +        return;
> +#endif
> +
> +#ifdef CONFIG_ACPI_NUMA
> +    if ( !is_numa_off() && !acpi_scan_nodes((uint64_t)start_pfn << PAGE_SHIFT,
> +         (uint64_t)end_pfn << PAGE_SHIFT) )

Please use pfn_to_paddr() as you move this code.

Jan
diff mbox

Patch

diff --git a/xen/arch/x86/numa.c b/xen/arch/x86/numa.c
index 6b794a7..0888d53 100644
--- a/xen/arch/x86/numa.c
+++ b/xen/arch/x86/numa.c
@@ -268,21 +268,10 @@  static int __init numa_emulation(uint64_t start_pfn, uint64_t end_pfn)
 }
 #endif
 
-void __init numa_initmem_init(unsigned long start_pfn, unsigned long end_pfn)
+static void __init numa_dummy_init(unsigned long start_pfn, unsigned long end_pfn)
 {
     int i;
 
-#ifdef CONFIG_NUMA_EMU
-    if ( get_numa_fake() && !numa_emulation(start_pfn, end_pfn) )
-        return;
-#endif
-
-#ifdef CONFIG_ACPI_NUMA
-    if ( !is_numa_off() && !acpi_scan_nodes((uint64_t)start_pfn << PAGE_SHIFT,
-         (uint64_t)end_pfn << PAGE_SHIFT) )
-        return;
-#endif
-
     printk(KERN_INFO "%s\n",
            is_numa_off() ? "NUMA turned off" : "No NUMA configuration found");
 
@@ -301,6 +290,22 @@  void __init numa_initmem_init(unsigned long start_pfn, unsigned long end_pfn)
                     (paddr_t)end_pfn << PAGE_SHIFT);
 }
 
+void __init numa_initmem_init(unsigned long start_pfn, unsigned long end_pfn)
+{
+#ifdef CONFIG_NUMA_EMU
+    if ( get_numa_fake() && !numa_emulation(start_pfn, end_pfn) )
+        return;
+#endif
+
+#ifdef CONFIG_ACPI_NUMA
+    if ( !is_numa_off() && !acpi_scan_nodes((uint64_t)start_pfn << PAGE_SHIFT,
+         (uint64_t)end_pfn << PAGE_SHIFT) )
+        return;
+#endif
+
+    numa_dummy_init(start_pfn, end_pfn);
+}
+
 void numa_add_cpu(int cpu)
 {
     cpumask_set_cpu(cpu, &node_to_cpumask[cpu_to_node(cpu)]);